Jump to content

folder as variable and running the app


ayatest
 Share

Go to solution Solved by ayatest,

Recommended Posts

I'm still "blind" to coding (tried some combinations but with no luck), so forgive me such.simple questions.

While experimenting, I was able to get some folders of interest and define them as custom variables (is this method correct? I tried to read these custom variables via some example messagebox, and they seem to work fine).

What I'm stuck with - is the syntax to run the app.

    Local $sEnvVar = EnvGet("ProgramFiles(x86)")
    $test = $sEnvVar
    Local $sEnvVar = EnvGet("APPDATA")
    $test2 = $sEnvVar
 

Run($test & "subfolder namesubfolder nameapp name.exe")

How to fix it and start the app?

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

  • Moderators

Why not just use the built in macros?

Run(@ProgramFilesDir & "\Subfolder\MyApp.exe")

or

#AutoIt3Wrapper_UseX64 = Y

Run(@ProgramFilesDir & "\Subfolder\MyApp.exe")

if you want to specify C:Program Files on a 64bit machine.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Because I don't know too much on macros yet.

But definately I will want to use various types of custom folder paths, defined as custom variables.

So the problem I have here is - how to combine a variable that represents some path - with the rest of filepath, and with the Run command. (path string contains spaces as well as you can see)

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

  • Moderators

The problem in your first post is you're overwriting your $sEnvVar variable. This works just fine for me:

Local $sEnvVar = EnvGet("ProgramFiles(x86)")
    $test = $sEnvVar
Local $sEnvVar1 = EnvGet("APPDATA")
     $test2 = $sEnvVar1


ConsoleWrite($test & "\subfolder name\subfolder name\app name.exe" & @CRLF)
ConsoleWrite($test2 & "\subfolder name\subfolder name\app name.exe" & @CRLF)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

So defining multiple variables is a matter of separate question. Still - when having this:

    Local $sEnvVar = EnvGet("ProgramFiles(x86)")
    $test = $sEnvVar

ConsoleWrite($test & "folder name1folder name2app name.exe" & @CRLF)

it isn't starting the app

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

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