← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #234119]: How to use switchApp() to check whether the specified

 

Question #234119 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/234119

Techno.Scavenger posted a new comment:
Ok, looks jython behaves different with respect to pipes... you  can try
this.

import subprocess
px = subprocess.Popen("tasklist",stdout=subprocess.PIPE)
py = subprocess.Popen("findstr notepad",stdin=px.stdout,stdout=subprocess.PIPE)
px.stdout.close()
out = py.communicate()[0]
py.returncode
#assuming notepad is not running, this will return 1


#now open notepad
px = subprocess.Popen("tasklist",stdout=subprocess.PIPE)
py = subprocess.Popen("findstr notepad",stdin=px.stdout,stdout=subprocess.PIPE)
px.stdout.close()
out = py.communicate()[0]
py.returncode
#this returns zero.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.