Jump to content
Sign in to follow this  
AskThatDude

Variable inside run command.

Recommended Posts

AskThatDude

Hi everyone,

I am trying to pass a variable into the run command but it fails everytime. I have found other scripts in the forum that have the same feature but also fail. Was there a change made in the new AutoIT that no longer permits this? Here is an example.

$Blue = "C:\Windows\Programs\testing.exe"

Run($Blue)

When I execute the script I get an error saying:

Unable to find Run($Blue)

Is there something I am missing?

Thanks

Share this post


Link to post
Share on other sites
Richard Robertson

Does the program actually exist? What version of AutoIt are you using?

Share this post


Link to post
Share on other sites
AskThatDude

Does the program actually exist? What version of AutoIt are you using?

I am using 3.2.10.0

The program does exist because if I just use Run("C:\Windows\Programs\testing.exe") it will work. I'm not sure what it's doing.

Share this post


Link to post
Share on other sites
Richard Robertson

Wait, you wrote that it says unable to find "Run($blue)". Does it include Run in the error message? Is that the entire error, or is there more to it?

Share this post


Link to post
Share on other sites
Levenson

Try to reinstall AutoIt.

Edited by Levenson

Share this post


Link to post
Share on other sites
MHz

...Here is an example...

Since your example is mentioned in a large scope concerning Run(), then perhaps some attempts are with paths with whitespace. Use double quotes with function call. Installed programs may require a working directory to be passed also.

$file = 'testing.exe'
$path = 'C:\Windows\Programs'

If FileExists($path & '\' & $file) Then
    MsgBox(0x40000, 'Command to Run ', _
            '"' & $path & '\' & $file & '"' & _
            ' with the working directory of ' & $path)
    Run('"' & $path & '\' & $file & '"', $path)
Else
    MsgBox(0x40000, Default, $path & '\' & $file & ' not found')
EndIf

:)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.