← Back to team overview

sikuli-driver team mailing list archive

[Question #295347]: Trying to launch an EXE or LNK file

 

New question #295347 on Sikuli:
https://answers.launchpad.net/sikuli/+question/295347

Sikuli 1.1.1 Nightly November build
Windows 10 x64


Good morning,


in my automation scripts I was defining an app instance like this:


import mySettings
import os
import DBChecks

program = App(os.path.join(r"C:\tssmoketest", Settings.Version, "program.exe"))


I then would call that in this context:

program.open()
DBChecks.checkFor_CantConnectError()
DBChecks.checkFor_EntitlementError()

the problem now is that our EXE has changed in code and now calls a separate DLL file that also resides in that same directory.  What happens now is that when Im calling the EXE using an app instance, it is being called in a weird state that ignores that DLL file.

I can reproduce this manually by going to command prompt in windows, CD\ to C:\ and then calling the application by the full path C:\tssmoketest\2017\program.exe

if I go into command prompt and CD\ tssmoketest\2017 

and then just call program.exe

I have no issues which is why our desktop shortcut has no issues either because the shortcut establishes a "start in" directory.


Since my development team is not going to fix the issue since customers would never call it this way, i need a work around so I tried this:

os.chdir(os.path.join(r"C:\tssmoketest", Setings.Version,)) 
os.system(program.exe)
DBChecks.checkFor_CantConnectError()
DBChecks.checkFor_EntitlementError()



but running this way didnt work because the program would launch and then nothing else would happen. it was like the IDE was waiting for ever and I had to shift+ctrl+c to stop the script.

then i thought what if I could just call the LNK file on the desktop since I know its there and I know its path.

I tried using

subprocess.Popen(r"C:\Users", "Public", "Desktop", "program.LNK")

but I guess subprocess or Popen isnt in Jython so then I tried:

os.system(r"C:\Users", "Public", "Desktop", "program.LNK")


but it did the same thing as earlier where the program launched but IDE is frozen or waiting for ever.


I'm sorry this sounds so complicated and maybe there is an easier way to do what i'm trying to do but in reality im simply looking for something as elegant as:

program = App(os.path.join(r"C:\tssmoketest", Settings.Version, "program.exe"))
program.open()


but with the ability to define a start in directory JUST for that instance

so that I do not have to do the less pretty method of:

type('r', keyModifier.WIN)
wait(.5)
paste('CMD'
wait(.5)
type('cd\tssmoketest\2017', + Key.ENTER)
wait(.5)
type('program.exe', + Key.ENTER)
wait(.5)

thank you for any advice or help.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.