Snapper Posted October 1, 2009 Posted October 1, 2009 Hello, Earlier today I was working on a few AutoIt scripts and was changing a few functions within the scripts to some other functions for testing, when all of a sudden, programs that were written prior to this were unable to open programs I have scripted to run during certain events. For example; any program with the RUN() function will no longer run, but SHELLEXECUTE() will work fine. I experimented with several variations with this, such as running notepad.exe, moving to another directory, and testing with another machine. The other machine has the word-for-word writing and can run perfectly fine. I take the compiled script from my other machine and run it with the same programs installed to the Program Files and it cannot run, saying the file does not exist. I am unable to troubleshoot this issue, and was wondering if there is some sort of global registry or any other potential fix to this issue. Thank you.
Snapper Posted October 2, 2009 Author Posted October 2, 2009 Interesting development with my issue with RUN() no longer working; using run with any .exes within Program Files does not work, but when I try to launch an .exe from my desktop, it works fine. Any input on this problem?
Richard Robertson Posted October 4, 2009 Posted October 4, 2009 Are you actually using the full path the program, as is required with the Run function?
Snapper Posted October 8, 2009 Author Posted October 8, 2009 Sorry about my lack of information: WinXP SP2, and some sample code: ; Checks to see if the file exists If FileExists( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) Then MsgBox(0, "", "True") ; Launches the executable Run( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) The message box comes up as True, yet, cannot run the executable. ; Checks to see if the file exists If FileExists( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) Then MsgBox(0, "", "True") ; Launches the executable ShellExecute( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) The message box comes up as True and launches the executable. ; Checks to see if the file exists If FileExists( "C:\Documents and Settings\MyComputerUserName\Desktop\Firefox Setup 3.5.exe" ) Then MsgBox(0, "", "True") ; Launches the executable Run( "C:\Documents and Settings\MyComputerUserNAme\Desktop\Firefox Setup 3.5.exe" ) The message box comes up as True and launches the executable. It seems like the RUN() command works for executable files in places other than Program Files, but still works for places other than Program Files. Any suggestions into this issue?
Richard Robertson Posted October 8, 2009 Posted October 8, 2009 Have you tried supplying a working directory?
Snapper Posted October 8, 2009 Author Posted October 8, 2009 I tried the following: ; Checks to see if the file exists If FileExists( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) Then MsgBox(0, "", "True") ; Launches the executable Run( "C:\Program Files\SSH Communications Security\SSH Secure Shell", "SshClient.exe" ) This produced a result of the executable running. The strange thing is that all of my old scripts had just a directory straight to the executable (like my first AutoIt script example) and worked fine until recently.
ChrisL Posted October 8, 2009 Posted October 8, 2009 Wrapped the run path in speach marks. Included the full path to the exe and set te working directory as the exe path. Try that ; Checks to see if the file exists If FileExists( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) Then MsgBox(0, "", "True") ; Launches the executable Run( '"C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe"', "C:\Program Files\SSH Communications Security\SSH Secure Shell") [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Snapper Posted October 9, 2009 Author Posted October 9, 2009 ; Checks to see if the file exists If FileExists( "C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe" ) Then MsgBox(0, "", "True") ; Launches the executable Run( '"C:\Program Files\SSH Communications Security\SSH Secure Shell\SshClient.exe"', "C:\Program Files\SSH Communications Security\SSH Secure Shell") This change to the AutoIt script does work on my computer. Were there any changes to the Run() function recently that might cause it to not work?
ChrisL Posted October 9, 2009 Posted October 9, 2009 This change to the AutoIt script does work on my computer. Were there any changes to the Run() function recently that might cause it to not work?Nope, if you have spaces in the path to the exe then you should surround it with quotes like I did or use Run(FileGetShortName("c:\a\long\path\with spaces\in.exe"),"c:\a\long\path\with spaces") [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Richard Robertson Posted October 9, 2009 Posted October 9, 2009 Oh yeah. I don't know why I didn't catch that. The spaces do need to be quoted.
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