Morphears Posted July 29, 2014 Posted July 29, 2014 I would like to run a setup.exe via a button, the button scripting/ creation is wicked, but why can't I call the exe as part of the GUI, looked on google, you tube etc but nothing, sure it's a one line command but I can't find it......any help much appreciated :-)
Draygoes Posted July 29, 2014 Posted July 29, 2014 Could you please proved an example of any code that you tried, if you made any? If not, we will still try to help. So, are you trying to create a GUI, with a single button, that is set to run a .exe file when clicked? Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.
computergroove Posted July 30, 2014 Posted July 30, 2014 KODA will easily allow you to make a WYSIWYG program window and you just have to enter the right code and you're done. -> '?do=embed' frameborder='0' data-embedContent>> Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Morphears Posted July 30, 2014 Author Posted July 30, 2014 Sorry, I don't really have any code as yet, basically I have just run Koda, dragged a button in called office install, generated that code and pasted into the editor and run, that bit works and you can depress the button, but obviously it doesn't do anything as yet. I think this programme is excellent but having not used it before, any information you guys can give to help me understand it will really help, I'm pretty good at picking stuff up as I get used to it, but as I'm sure you have experienced, in the beginning it is quite a lot to take in. Thanks again for your swift replies. Andy
Jfish Posted July 30, 2014 Posted July 30, 2014 You should start by reading the help file. It has tons of information. If you are interested in running a program a search of the help file will show you several ways. These two functions are a good start. Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] ) ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] ) Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
JohnOne Posted July 30, 2014 Posted July 30, 2014 Show your code, and say what you want to happen when the button is clicked. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ZacUSNYR Posted July 30, 2014 Posted July 30, 2014 (edited) I added Calculator to the GUICreate example in the Help file, used Run to open calc.exe #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Local $CreatedButton = GUICtrlCreateButton("Click to Open Calculator", 50, 50, 150, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $CreatedButton Run("calc.exe") ;Run the EXE. EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Edited July 30, 2014 by ZacUSNYR
JohnOne Posted July 30, 2014 Posted July 30, 2014 So you have it now? Just replace calc.exe with your setup.exe or is it something else? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
somdcomputerguy Posted July 30, 2014 Posted July 30, 2014 ..any information you guys can give to help me understand it will really help, I'm pretty good at picking stuff up as I get used to it..I see that this has been suggested to you earlier, but I must say it again. Read the Help file, once, twice, or a hundred times.. As Jfish said, it has tons of information. Nearly every native AutoIt function, and the supplied UDF's (User Defined Functions), have not only great instructions, but also example code. There are lots of tutorials available, not only on this Forum, but YouTube and probably lots of other places too.>Welcome to AutoIt 1-2-3, and Welcome to the Forum. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Morphears Posted July 31, 2014 Author Posted July 31, 2014 Thank you for your advice, I have copied the code you have written to run the calculator. I had already made it run for notepad or cmd but couldn't make the office install run and I couldn't see why. I have added the information to run my office installer in your code as shown below but it still doesn't launch the installer. Any help, thank you #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Local $CreatedButton = GUICtrlCreateButton("Click to Install Office", 50, 50, 150, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $CreatedButton Run("setup.exe", "C:supportApplicationsMicrosoft_Office_2010_ProPlusx86") ;Run the EXE. EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example
computergroove Posted July 31, 2014 Posted July 31, 2014 Try this: Run("C:\support\Applications\Microsoft_Office_2010_ProPlus\x86\setup.exe") ;Run the EXE. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Morphears Posted July 31, 2014 Author Posted July 31, 2014 (edited) Unfortunately this is the option I tried first, sorry I didn't say that before. Thank you for your help Also as an update, the string you mention above does run from the run box when cut and pasted, and it starts the office installer, just doesn't in autoit.... Notepad, like calc works fine, is this because they are native apps in system32? I need to understand how to force a directory then run an exe from there...I am a network/hardware guy but I do have an analytical mind, once I have the basics, the world is my oyster... :-) Thank you all. Edited July 31, 2014 by Morphears
computergroove Posted August 1, 2014 Posted August 1, 2014 You can try @ComSpec. I am not very versed in this but you can try: Run(@ComSpec & '/c ' & 'C:supportApplicationsMicrosoft_Office_2010_ProPlusx86Setup.exe') If that doesn't work then try /k instead of /c Report back if that didn't work. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Morphears Posted August 1, 2014 Author Posted August 1, 2014 Unfortunately still no joy, but thanks so much for all of your input everyone. I have 2 weeks development time the week after next, and if I can get the basics down by then, I will be able to create a new USB imaging system for our engineers to run when onsite doing replacement workstation builds, I already have a PE boot that re images the machines, I just want a wizard to pop up where they can choose what anti virus, which version of office etc they want and it will all be automated, could save half a day per visit so worth the time beforehand. Really appreciating the assistance and hope I can repay on some of the other topics in the future.
Jfish Posted August 1, 2014 Posted August 1, 2014 (edited) You may need to run it as an admin (from AutoIt). The other programs are already installed. Edited August 1, 2014 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
computergroove Posted August 1, 2014 Posted August 1, 2014 (edited) #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Local $CreatedButton = GUICtrlCreateButton("Click to Install Office", 50, 50, 150, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $CreatedButton Run("C:\Server\Microsoft Office 2010 Professional Plus x86 & X64 SP1\Setup.exe") ;Run the EXE. EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example This worked for me. What are you doing differently? I'm using Windows 7 x64 and logged in as Member of administrator. Edited August 1, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Developers Jos Posted August 1, 2014 Developers Posted August 1, 2014 Run(@ComSpec & '/c ' & 'C:supportApplicationsMicrosoft_Office_2010_ProPlusx86Setup.exe') Geez... Thought we went through this before. Is it really that difficult to code a @Comspec line with spaces at the right places? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
computergroove Posted August 1, 2014 Posted August 1, 2014 Geez... Thought we went through this before. Is it really that difficult to code a @Comspec line with spaces at the right places? Yeah but we were called out on hijacking someone elses thread and you left my question unanswered. Run(@ComSpec & '/c C:\support\Applications\Microsoft_Office_2010_ProPlus\x86\Setup.exe') Is this better? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Developers Jos Posted August 1, 2014 Developers Posted August 1, 2014 (edited) Yeah but we were called out on hijacking someone elses thread and you left my question unanswered. Run(@ComSpec & '/c C:\support\Applications\Microsoft_Office_2010_ProPlus\x86\Setup.exe') Is this better? Not really!.. You are missing a space in front of the /c which means that the command will fail. Edited August 1, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Morphears Posted August 1, 2014 Author Posted August 1, 2014 (edited) Line 15 error ladies, if you wanna challenge each other in a dual, fair doos, I am appreciative of all input, I would put my autoit skills around the 5yo child just learning area....hence why I asked for your completely amazing input. I say you make it your mission to get my one button working and I will (honestly) send you a gift if you can do it, together if poss. For me, saying a space will make it fail, then great, but as someone who happily accepts he's pants at this scipting business, i'll take anything I can get.... Cheers chaps Andy Edited August 1, 2014 by Morphears
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now