CarlD Posted June 3, 2015 Share Posted June 3, 2015 (edited) I'm new to AutoIt, having used it only for a couple of weeks. I'm running the latest version of AutoIt3 on 64-bit Windows 7 (Home Premium) and having a problem with the Run() and ShellExecute() functions.I have a small library of user-defined functions, let's call it Library.au3. It works like this: At the command prompt I command Library.au3 foo. The script checks to see if user function foo is defined: if so, it executes it, otherwise does nothing. Although this works at the command prompt, if I try to call a Library function from a script with Run("d:\path\Library.au3 foo") or ShellExecute("d:\path\Library.au3 foo"), I get the error message "Windows cannot find "d:\path\Library.au3 foo", check to see if you spelled the name correctly, etc. etc." It appears that the argument "foo" is gumming up the works -- AutoIt or Windows is trying to execute a file named "d:\path\Library.au3 foo" instead of d:\path\Library.au3 with argument "foo".Help appreciated: What am I doing wrong?CarlPS: I tried prefixing "cmd.exe /c" and "cmd.exe /c start" to the command, but I get the same error message. Edited June 4, 2015 by CarlD PS Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 4, 2015 Moderators Share Posted June 4, 2015 Hi, CarlD, welcome to the forum. It depends on how you are running the uncompiled scripts. If you are simply wanting to run them on a machine with AutoIt installed, you can do something like this:ShellExecute("d\pth\library.au3","","","Run")If you are running it on a machine that does not have AutoIt installed, please see the link below (bottom of the page) for running an uncompiled script from a compiled executable:https://www.autoitscript.com/autoit3/docs/intro/running.htm "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
CarlD Posted June 4, 2015 Author Share Posted June 4, 2015 Hi, CarlD, welcome to the forum. It depends on how you are running the uncompiled scripts. If you are simply wanting to run them on a machine with AutoIt installed, you can do something like this:ShellExecute("d\pth\library.au3","","","Run")If you are running it on a machine that does not have AutoIt installed, please see the link below (bottom of the page) for running an uncompiled script from a compiled executable:https://www.autoitscript.com/autoit3/docs/intro/running.htmThanks for the welcome, and the lightning-fast response! For now, I'm running it on a machine with AutoIt installed -- and, yes, the ShellExecute statement with four parameters works!Is there a full list of "verbs" somewhere? I don't see "Run" in the documentation for ShellExecute.Thanks again! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 4, 2015 Moderators Share Posted June 4, 2015 Glad your issue was resolved. I would look at the MSDN link below if you are interested in the verbs available to you.https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspxIn essence, if you don't specify one of the 5 verbs shown, it uses the default verb, then the "open" verb. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
CarlD Posted June 4, 2015 Author Share Posted June 4, 2015 Helpful link -- thanks! Link to comment Share on other sites More sharing options...
CarlD Posted June 5, 2015 Author Share Posted June 5, 2015 Actually, I've been running (no pun intended) into problems with the verb "Run". When the command is an EXEcutable file, ShellExecute returns an error message to the effect that there is no Windows application associated with this type of file -- weird. If I change "Run" to "" or "Open", the error goes away. Link to comment Share on other sites More sharing options...
AdamUL Posted June 5, 2015 Share Posted June 5, 2015 From the webpage, link to by JLogan3o13. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs. Adam 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