Jump to content
Sign in to follow this  
Morphears

I'm a newbie, any advice really appreciated

Recommended Posts

Morphears

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 :-)

Share this post


Link to post
Share on other sites
Draygoes

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.

 

 

Share this post


Link to post
Share on other sites
Morphears

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

Share this post


Link to post
Share on other sites
Jfish

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

Share this post


Link to post
Share on other sites
ZacUSNYR

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 by ZacUSNYR

Share this post


Link to post
Share on other sites
somdcomputerguy

..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. B)


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Morphears

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

Share this post


Link to post
Share on other sites
computergroove

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

Share this post


Link to post
Share on other sites
Morphears

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 by Morphears

Share this post


Link to post
Share on other sites
computergroove

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

Share this post


Link to post
Share on other sites
Morphears

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.  :thumbsup:

Share this post


Link to post
Share on other sites
computergroove

#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 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

Share this post


Link to post
Share on other sites
Jos

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?

 


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
computergroove

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

Share this post


Link to post
Share on other sites
Jos

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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Morphears

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 by Morphears

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×