arminius Posted June 18, 2008 Share Posted June 18, 2008 ok here is the code CODEWhile 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run("C:\Documents and Settings\Cieran\My Documents\Scripts\Screensaver\Good.exe") Case $msg = $Button_2 ShellExecute("Bad.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver", "Run") Case $msg = $Button_3 ShellExecute("Surreal.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver", "Run") Case $msg = $Button_6 ShellExecute("Chatter.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Chat Programs", "Run") Case $msg = $Button_7 Run("C:\Documents and Settings\Cieran\My Documents\Scripts\Chat Programs\Chatter - Logoff.exe") EndSelect Wend the shellexecutes are how I had it at the early state so I could make edits to the programs, but now that I want to compile them, I click on the buttons with .exe, and nothing happens, no error message, just doesn't wanna execute? Link to comment Share on other sites More sharing options...
Clipper34 Posted June 18, 2008 Share Posted June 18, 2008 I tried this i wrote real quick and it uses a button to run an .exe and it works: #include <GUIConstants.au3> GUICreate("Test", 70, 20) $button = GUICtrlCreateButton("Run .exe", 1, 1, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button Run("Notepad.exe") Sleep(1000) ShellExecute("Notepad.exe") EndSelect WEnd GUIDelete() Exitbut you could try removing the C:\DOCUMENTS ect. and just use the name of the file with the extension. Hope thats helps, Clipper34 Link to comment Share on other sites More sharing options...
rasim Posted June 18, 2008 Share Posted June 18, 2008 arminius I click on the buttons with .exe, and nothing happens, no error message, just doesn't wanna executeWrong Run parameter in ShellExecute() func. From the help: verb [optional] The "verb" to use, common verbs include: open = (default) Opens the file specified. The file can be an executable file, a document file, or a folder edit = Launches an editor and opens the document for editing. If "filename" is not a document file, the function will fail print = Prints the document file specified. If "filename" is not a document file, the function will fail properties = Displays the file or folder's propertieswhere you found the Run parameter? Link to comment Share on other sites More sharing options...
arminius Posted June 22, 2008 Author Share Posted June 22, 2008 I just wanna run an .exe is that possible? Link to comment Share on other sites More sharing options...
Valuater Posted June 22, 2008 Share Posted June 22, 2008 Run("notepad.exe") If it is not a registered exe then use the full path to the exe 8) Link to comment Share on other sites More sharing options...
arminius Posted June 22, 2008 Author Share Posted June 22, 2008 I've tried just the file name, it says cannot find external file, I try the full path and when I click on the button nothing happens, no error message but no script execution Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 22, 2008 Moderators Share Posted June 22, 2008 (edited) I've tried just the file name, it says cannot find external file, I try the full path and when I click on the button nothing happens, no error message but no script executionYou probably have spaces in the exe path.$s_Path = "My Exe Path And My ExeName.exe"Run('"' & $s_Path & '"')Surround them by double quotes.Edit:P.S..au3 extension is not an executable.To do that as an executable, you need to use /AutoIt3ExecuteScript .Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $s_MyAu3File & '"') Edited June 22, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted June 22, 2008 Share Posted June 22, 2008 Another approach, I used this to run an au3 file in the same folder Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptDir & "\4.au3")) 8) Link to comment Share on other sites More sharing options...
arminius Posted June 22, 2008 Author Share Posted June 22, 2008 I tried your code CODE$s_Path = "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver\Good.exe" CODECase $msg = $Button_1 Run('"' & $s_Path & '"') and nothing happened as normal Link to comment Share on other sites More sharing options...
Valuater Posted June 22, 2008 Share Posted June 22, 2008 (edited) Try this... $s_Path = "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver\Good.exe" $s_Path = FileGetShortName($s_Path) Case $msg = $Button_1 If Not FileExists($s_Path) Then MsgBox(0x0, "Error", "The file was not found ", 5) Else Run($s_Path) EndIf 8) Edited June 22, 2008 by Valuater Link to comment Share on other sites More sharing options...
arminius Posted June 22, 2008 Author Share Posted June 22, 2008 it didn't come up with a message box, but it also didn't execute the script Link to comment Share on other sites More sharing options...
Valuater Posted June 22, 2008 Share Posted June 22, 2008 are there any arguments/parameters needed??? try this with "working directory" ( replace the run statement ABOVE ) Run($s_Path, @WorkingDir) 8) Link to comment Share on other sites More sharing options...
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