Sign in to follow this  
Followers 0
AskThatDude

Variable inside run command.

6 posts in this topic

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



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

Share this post


Link to post
Share on other sites

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

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

#5 ·  Posted (edited)

Try to reinstall AutoIt.

Edited by Levenson

Share this post


Link to post
Share on other sites

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