Jump to content

Why does it not run this file ?


Wacken
 Share

Recommended Posts

If i make this simple script 2 lines long:

MsgBox(0,"",FileExists("C:\Program Files\Internet Explorer\iexplore.exe"))

Run("iexplore.exe","C:\Program Files\Internet Explorer")

The message box tells me "1" so the file exists, but then i get

"Error, Unable to Execute the external program.

The system cannot find the file specified."

Can anyone explain this and tell me how to solve it ?

Edited by Wacken
Link to comment
Share on other sites

Run("C:\Program Files\Internet Explorer\iexplore.exe")oÝ÷ ÚÞ½éÚºÚ"µÍ[ÙÜ[Q[Ñ   [È ][ÝÉÌLÒ[]^ÜÌLÚY^ÜK^I][ÝÊ
Thanks.

thats not how it is stated in the help files and i thought i tried this, but i must have made a type when trying it :)

Link to comment
Share on other sites

I found out, i did not make a typo when testing.

After some more testing, it does work when i start internet explorer, but it does not work when i try to start this particular executable that i want to start.

The strange thing is, when i do not have the pathname in the Run function and i have the au3 file in the same folder with the executable to start, it DOES work.

As soon as i have the au3 on desktop and the whole pathname in the Run function, it does not work.

I also tried copying another file in the target directory, and that does open just fine.

Does anyone have an idea what could cause this ?

Link to comment
Share on other sites

  • Moderators

I found out, i did not make a typo when testing.

After some more testing, it does work when i start internet explorer, but it does not work when i try to start this particular executable that i want to start.

The strange thing is, when i do not have the pathname in the Run function and i have the au3 file in the same folder with the executable to start, it DOES work.

As soon as i have the au3 on desktop and the whole pathname in the Run function, it does not work.

I also tried copying another file in the target directory, and that does open just fine.

Does anyone have an idea what could cause this ?

If the path has spaces in it, you may need to surround it by double quotes:

Run('"' & @ProgramFilesDir & '\SomeFile.txt"')
as an example.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I just don't get it...

My script needs to run a file called "casino.exe".

It will first search for this file in the default casino, and if it doesn't find it, it should ask the user where it is.

The path is then stored for later use.

Since now the path is used as a variable, i think its difficult to use phrases like "@ProgramFilesDir"

Ignore the asking for an storage of the path for now and just look at the default path:

C:\Program Files\Intercasino$$$\casino.exe

First i place the script in the intercasino $$ folder.

Run("casino.exe")

-This works

Now i place the script on desktop.

Run("C:\Program Files\Intercasino$$$\casino.exe")

-Does not work.

Run("C:\Program Files\Internet Explorer\iexplore.exe")

-Works just fine

Now i see those $$$ and think they may cause a problem. So i place iexplore.exe in the Intercasino folder

Run("C:\Program Files\Intercasino$$$\iexplore.exe")

-Works fine

Now i try using a bat file. I create the file start.bat. Inside it is only "casino.exe". This batfile is in the intercasino folder.

-I click the bat file, Intercasino starts.

Run("C:\Program Files\Intercasino$$$\start.bat")

-Does not work

I place the script back in the intercasino folder.

Run("start.bat")

-Works fine

:whistle:

If i make a typo in the script, or i try to start a file that is not there, i get an error message.

In the situations above however, i do not get this error message. My PC just seems to think for a while and then decides to do nothing.

Edited by Wacken
Link to comment
Share on other sites

try this

Run("C:\Program Files\Internet Explorer\iexplore.exe","C:\Program Files\Internet Explorer")

:whistle:

I assume you mean: Run("C:\Program Files\Intercasino$$$\casino.exe","C:\Program Files\Intercasino$$$")

(or you just didnt read my post)

That doesn't work either.

Link to comment
Share on other sites

Hmm, that is kind of odd..

start > run > iexplore.exe

and internet explorer runs.

there are are a lot of .exe files which run straight from a run box...

iexplore.exe

winword.exe (any office .exe actually)

but dont run from the run command in autoIT..

and there are a list of them that do:

cmd.exe

notepad.exe

regedit.exe

.... i had always assumed that the autoIT Run command emulated the MS Winodws Run box somehow.. it may appear that it doesn't?

in any case, its probably safer to specify the exact location.

Link to comment
Share on other sites

  • Moderators

You've been given your answer already... Do you see spaces in the path (between Program and Files)?

Run('"' & @ProgramFilesDir & '\Intercasino$$$\casino.exe"')

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...