App.open to run .exe file with environment variable

Asked by cat123

Dear RaiMan,

Thank you again for your helpfulness (related to question 24669 (Unable to run .exe file with environment variable)).

Is it possible to run an. exe file through the settings of environment variables with App class?

Thus I would like to have something like:

#MyApp environment variable is created in system in variables under System\Advanced Settings
App.open('"%MyApp%")

In my previous question, I tried to use subprocess.call('"%MyApp%") but it is too high maintenance with respect to App class I guess.

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
cat123
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

As already mentioned in the question 24663 (you should set it to solved, if it is no longer open for you), in your script you can access the environment like this:

myApp = os.environ["MYAPP"]

this would save the string you put with your settings into variable myApp.

If the string is ok for App class to find and open your app:
App.open(myApp)

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Sorry, the other question was 24693.

Revision history for this message
cat123 (jazzycat2013) said :
#3

Thank you so much RaiMan, you are great.