Skrip Posted July 5, 2006 Share Posted July 5, 2006 $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) Why does that not work? I copy and pasted the name, and the path. Please reply. Thanks. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Paulie Posted July 6, 2006 Share Posted July 6, 2006 $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) Why does that not work? I copy and pasted the name, and the path. Please reply. Thanks.Just as a stab in the dark, (I am not sure if its right) but as a guess, try deleing the .exe from the path so then $path = C:\Autoit3\Folder_Protector\ again, just a guess Link to comment Share on other sites More sharing options...
MHz Posted July 6, 2006 Share Posted July 6, 2006 $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) Why does that not work? I copy and pasted the name, and the path. Please reply. Thanks.You are trying to run "TPT_Watcher.exe" which is a relative path and not a absolute path (fullpath). A relative path is seen by the script as to the Working Directory of the script as of that line being processed. When using relative addressing, the script should always check 1st what the working directory is. Checking includes if the script is in the same directory as "TPT_Watcher.exe" as the working directory is not always @ScriptDir. With the above code, I could not be sure of where your script is and what the working directory is. The working directory parameter of Run() is passed onto the executeble and is not the working directory of the script. FileChangeDir() changes the working directory of the script if needed. To ensure Run() will work, then you need to be sure the executables path is seen by the script. Some examples below. ; Script is in the @ScriptDir $name = @ScriptDir & "\TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector" Run($name, $path) ; Script is in the @ScriptDir If @WorkingDir <> @ScriptDir Then FileChangeDir(@ScriptDir) EndIf $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector" Run($name, $path) ; Script is NOT in the @ScriptDir $name = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector" Run($name, $path) ; Script is NOT in the @ScriptDir If FileChangeDir("C:\AutoIt3\Folder_Protector") Then $name = "TPT_Watcher.exe" Run($name) EndIf Link to comment Share on other sites More sharing options...
i542 Posted July 6, 2006 Share Posted July 6, 2006 $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) Why does that not work? I copy and pasted the name, and the path. Please reply. Thanks. Why you using variables? Run("TPT_Watcher.exe","C:\AutoIt3\Folder_Protector\TPT_Watcher.exe") ;;;;;;;Not tested;;;;;;;;; i542 I can do signature me. Link to comment Share on other sites More sharing options...
CyberSlug Posted July 6, 2006 Share Posted July 6, 2006 The second parameter in the Run command is usually not needed. Make sure the first paramter contains the full path or use FileChangeDir like in MHz's example. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
AzKay Posted July 6, 2006 Share Posted July 6, 2006 Run("C:\AutoIt3\Folder_Protector\TPT_Watcher.exe") oO # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
emendelson Posted July 6, 2006 Share Posted July 6, 2006 (edited) The second parameter in the Run command is the working directory, not the pathname of the executable. The following will not work because the second parameter, $path, is a filename, but it must be the name of a directory, or else the command will fail: $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) However, this should work (untested; you may not need the final backslash in the $path): $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\" Run($name, $path) Edited July 6, 2006 by Edward Mendelson Link to comment Share on other sites More sharing options...
MHz Posted July 6, 2006 Share Posted July 6, 2006 The second parameter in the Run command is the working directory, not the pathname of the executable. The following will not work because the second parameter, $path, is a filename, but it must be the name of a directory, or else the command will fail: $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\TPT_Watcher.exe" Run($name, $path) However, this should work (untested; you may not need the final backslash in the $path): $name = "TPT_Watcher.exe" $path = "C:\AutoIt3\Folder_Protector\" Run($name, $path)Please read my last post. When using relative addressing, always check the working directory of the script. For example, if the script is executed from the registry, then @HomeDrive will be the working directory and finding "TPT_Watcher.exe" will fail if it is not there. Link to comment Share on other sites More sharing options...
i542 Posted July 7, 2006 Share Posted July 7, 2006 I almost forgoted. So try this: ;;;;Not tested;;;;; Global $name = "TPT_Watcher.exe" Global $path = "C:\AutoIt3\Folder_Protector\" Run($name,$path) If @error Then MsgBox(16,"Error","It doesn' t work :(") Or if you think Run command really NEVER doesn't work try to run some else program to test it, for example Notepad. If Run really never doesn't work (if fail on Notepad) try download new beta. i542 I can do signature me. 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