I have a simple visual basic window (or 'form'), and at the click of a button on the form, I want my Python script to run. How would I go about this?
Asked
Active
Viewed 7,319 times
4
-
Why did this get down-voted? Just wondering is all. – just_a_programmer Apr 14 '14 at 21:03
-
2because some persons thinking themselves funny or smart come and put -1 on a question ! it happened to me on many question, you ask they put you -1 like kids ! They don't understand that there is nothing called a wrong question ... anyway man never mind i will vote you +1 so that you get 0 instead of -1 :) – JustGreat Apr 18 '14 at 22:23
-
@JustGreat Ok, thanks! ...I'm kinda new to StackOverflow ;) – just_a_programmer Apr 20 '14 at 22:16
3 Answers
4
You can do something like :
Dim ReturnValue
ReturnValue= Shell("C:\python23\python ""C:\Myscripts\Mypythonscript.py"" ", vbHide)

JustGreat
- 551
- 1
- 11
- 26
4
Edit to answer this question. Some referenced the used of the command "shell". This is not a good practice, rather, use Process.Start().

TheWhiteHood
- 117
- 2
- 10
3
If you just want to run it, then double click the button, then once you see the code responsible for your button once you click it, enter this code, but with your specific location and script name;
obj = CreateObject("WScript.Shell")
obj.run("C:\Directory\File.py")
Hope this helps!

Virtual Vengance
- 31
- 1