Guest Beefteck Posted March 13, 2007 Share Posted March 13, 2007 Ok well i am whipping something up for a site and found here that... well I am having problems again with running another type of .exe... Here is what I have for questions: 1) How do i run a .exe file from a script (compiled or not) that is in a sub folder (i.e. ...>Parent (script in this)>Data>More Data\Setup.exe) 2) How would I make a simple custom error message, one that if any type of error ocurred like file not found etc i could have a msg be made instead of the autoit one. Thank-you so much for your time in even reading this. -Beefteck Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 13, 2007 Moderators Share Posted March 13, 2007 $hFile = 'FileLocation\FileName.Extension' If FileExists($hFile) Then ShellExecute($hFile) Else MsgBox(16, 'Error', 'File does not exist.') EndIf 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...
Guest Beefteck Posted March 13, 2007 Share Posted March 13, 2007 nice, ok now i just really need help with the .exe run in a sub-folder.... =( plz help this is my biggest issue here... -Beefteck Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 13, 2007 Moderators Share Posted March 13, 2007 nice, ok now i just really need help with the .exe run in a sub-folder.... =( plz help this is my biggest issue here...-BeefteckI or anyone would help if we had a clue what you were talking about. 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...
Shevilie Posted March 13, 2007 Share Posted March 13, 2007 The answer to your main problem is $hFile = 'FileLocation\FileName.Extension' If FileExists($hFile) Then ShellExecute($hFile) Else MsgBox(16, 'Error', 'File does not exist.') EndIf Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Guest Beefteck Posted March 13, 2007 Share Posted March 13, 2007 lol ok well I am running a script in a first folder, 3 sub folders in is a setup.exe file that for some reason will not allow me to run it from my script (compiled or not)Break down of folders with filesFolder A: Script>Folder B: Data>>Folder C: Setup.exeso here is my run that won't workRun (@ScriptDir & "\Data\MSWorks\Setup.exe")I get this error:Error: Unable to execute the external program.The request operation requires elevation.Any ideas? Link to comment Share on other sites More sharing options...
flyingboz Posted March 13, 2007 Share Posted March 13, 2007 "requires elevation" sounds like you've got permission / security issues totally unrelated to the nature of your posed question. You may need to investigate the wonderful vagaries of RunAs() Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 13, 2007 Moderators Share Posted March 13, 2007 (edited) 1. In what I gave you, do you see "Run" anywhere? So now you have introduced a problem you have, that you never iterated you had to begin with... see an issue with this? If you run this in an .au3 file by itself, do you get the msgbox? If FileExists(@ScriptDir & "\Data\MSWorks\Setup.exe") = 0 Then MsgBox(64, 'Info', @ScriptDir & "\Data\MSWorks\Setup.exe" & @CRLF & 'Does Not exist.')oÝ÷ Øò¢çhm¶§¶©jØb±Ê+ç-N§êeiǦÉ(^Q1yË{«¢+ÙIÕ¸ ÌäìÅÕ½ÐìÌäìµÀìMÉ¥ÁѥȵÀìÌäìÀäÈíÑÀäÈí5M]½ÉÌÀäÈíMÑÕÀ¹áÅÕ½ÐìÌäì and see if that works Edited March 13, 2007 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...
Guest Beefteck Posted March 13, 2007 Share Posted March 13, 2007 well now i know why it never worked (i had to run as an admin cause i am using vista).... also SmOke_N that second code you gave me works like a charm thanks so much and i am testing out that 1st one in ur last post too. thanks evey1 -beefteck 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