Jump to content

Stuck on simple thing: why won't my Run work?


Recommended Posts

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

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 ~ getENVvars
My 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

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

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 ~ getENVvars
My 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

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 Gude
How 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

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

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 Gude
How 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

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 by LondonNDIB
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...