LondonNDIB Posted January 20, 2015 Share Posted January 20, 2015 I don't get it. I have this: Run( "E:\Program Files (x86)\Folder\Sub Folder With Spaces\Program.exe" ) Simple enough, right? The program doesn't launch. I've confirmed (absolutely) that the path and file name is correct and if I just copy it and paste it into Windows Explorer it launches as expected so there aren't any typos. I even did a If FileExists check and it comes back true. In the help file, it says: Paths with spaces need to be enclosed in quotation marks. I don't know why it says that, considering paths without spaces also need to be enclosed (afterall, that's how we enter text strings, right?) but whatever... mine is. note that my @ProgramFilesDir is *not* "E:Program Files (x86)", which is why I've hardcoded it. I doubt that has anything to do with anything, just thought I'd mention it. What am I doing wrong on this simple matter? Link to comment Share on other sites More sharing options...
MikahS Posted January 20, 2015 Share Posted January 20, 2015 Any chance you can tell us what application you are trying to run so that we can try and reproduce? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Sure, it is Camtasia's Recorder. They have a trial version which I'd imagine would work the same. Specifically, it is the CamRecorder.exe application. This works though; Run( @ComSpec & ' /c "E:\Program Files (x86)\TechSmith\Camtasia Studio 8\CamRecorder.exe"', "", @SW_HIDE ) But I don't understand why it would and not directly. It isn't a command line app. Link to comment Share on other sites More sharing options...
MikahS Posted January 20, 2015 Share Posted January 20, 2015 I will give it a test and let you know if the same thing happens to me. The only time I have hit problems is when I accidentally wanted to use Run for a file, which will return a 0 because you are not starting a process. I'll let you know, and hope someone with more knowledge can show up and help out more than me. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2015 Share Posted January 20, 2015 Run( '"E:\Program Files (x86)\Folder\Sub Folder With Spaces\Program.exe"' ) I surrounded the whole thing in single quotes, that way the path and file name are inside the double quotes. See if that works for you. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Thanks MikahS Just a further thought: Perhaps its not anything to do with that application, but rather the path of my script. When I ran the @comspec command with /k and @SW_SHOW (so I could see what's going on), I noted that windows gave me a warning about UNC paths not being supported. It then defaulted to C:Windows as the working directory and worked fine. Maybe (?) the Run command also doesn't support UNC paths and fails because it doesn't default? Just a thought. My scripts are located on a server. I run them at a workstation. Hmm, but then I would think this would work: Run( "E:\Program Files (x86)\TechSmith\Camtasia Studio 8\CamRecorder.exe", "c:\Windows" ) but it also fails. I also tried enclosing the quoted string in quotes: Run( '"E:\Program Files (x86)\TechSmith\Camtasia Studio 8\CamRecorder.exe"', "c:\Windows" ) Still nothing. So confused Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2015 Share Posted January 20, 2015 Are you using #RequireAdmin in the script? If so, that means that the Administrator account doesn't have an E: drive. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Are you using #RequireAdmin in the script? No, I'm not Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted January 20, 2015 Share Posted January 20, 2015 Change the working directory away from C:windows. Try pointing it to the CamRecorder program directory. Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 (edited) Yeah, I did that first. I only went with C:Windows because that's what CMD does after it fails with the UNC directory. It really shouldn't matter though. The working directory isn't the path, its just the directory from where the program is called. Other than UNC not being supported, because I have no output or files created it really shouldn't matter what the working directory is so long as it is valid. Edited January 20, 2015 by LondonNDIB Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted January 20, 2015 Share Posted January 20, 2015 Will it open if you use 'shellexecute' rather than run? Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Isn't ShellExecute for opening a file (by way of its associated application), not an application? Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted January 20, 2015 Share Posted January 20, 2015 (edited) I believe it just uses the default handler specified by windows shell. So you should be able to open applications with it, I don't know if its ideal or not, just something to try. Edited January 20, 2015 by DicatoroftheUSA Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
willichan Posted January 20, 2015 Share Posted January 20, 2015 You already stated in post #3 that Run( @ComSpec & ' /c "E:\Program Files (x86)\TechSmith\Camtasia Studio 8\CamRecorder.exe"', "", @SW_HIDE ) works. Is there a reason why you do not want to do it that way? My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Nope. Curiosity I guess. It doesn't feel right that I have to go round-a-bout on something that should be straight forward. Link to comment Share on other sites More sharing options...
willichan Posted January 20, 2015 Share Posted January 20, 2015 A quick Google search turned up this document and this thread. CamRecorder.exe was designed to be called from a batch file. Most such EXEs need to be called using the command interpreter to function. That is why you need to use the @ComSpec call to make it work. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 20, 2015 Author Share Posted January 20, 2015 Thanks! 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