Skip to content
This repository has been archived by the owner on Mar 14, 2018. It is now read-only.

Opening app with context on windows #264

Open
dariuskrs opened this issue May 31, 2017 · 1 comment
Open

Opening app with context on windows #264

dariuskrs opened this issue May 31, 2017 · 1 comment

Comments

@dariuskrs
Copy link

Let's say I want to open an app on windows, but I want it to be executed in another context path.
I know how to call the app:

openApp("C:\Program Files (x86)\MyApp\Launcher\launcher.exe")

But how can I tell it to run in a specific context, like say C:\Program Files (x86)\MyApp\Execution context?

Also, how can I know when the app has loaded (the 'wait' solution does not seem reliable)?
regards.

@glitchassassin
Copy link

Try using os.chdir() to set the current directory before calling the executable. Haven't tested it, but I think that should work.

If you use the App class to create your app, you can wait until it creates a window:

a = App.open("C:\Program Files (x86)\MyApp\Launcher\launcher.exe")
while not a.hasWindow():
    sleep(1)

Note that it's a good idea to add a timeout in case the app doesn't launch - otherwise it'll wait forever.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants