Hi
It is problem in new El-Captain version.
Sikuli run Application using osascript: osascript -e 'tell app "Application" to activate'
It working from terminal, but not from python subprocess
cmd=['osascript','-e','tell app "Firefox" to activate'] subprocess.Popen([cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
It is becouse it is running not as logged user, and don't have acces to GUI. It can be fixed adding "sudo"
cmd=['sudo','-u','LoggedUserName','osascript','-e','tell app "Firefox" to activate'] subprocess.Popen([cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
In next step You can make switchApp myApp=switchApp("Firefox")
args=['sudo','-u',user,'osascript','-e','tell app "Firefox"\n activate\n end tell']
It is problem with the user who run firefox it is not You, and he don't access to gui components. You must add "sudo"
user='YourName' args=['sudo','-u',user,'osascript','-e','tell app "Firefox"\n activate\n end tell'] subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
wait(2) myApp=switchApp("Firefox")
Hi
It is problem in new El-Captain version.
Sikuli run Application using osascript:
osascript -e 'tell app "Application" to activate'
It working from terminal, but not from python subprocess
cmd=['osascript ','-e', 'tell app "Firefox" to activate'] Popen([ cmd,stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
subprocess.
It is becouse it is running not as logged user, and don't have acces to GUI.
It can be fixed adding "sudo"
cmd=['sudo' ,'-u',' LoggedUserName' ,'osascript' ,'-e',' tell app "Firefox" to activate'] Popen([ cmd,stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
subprocess.
In next step You can make switchApp ("Firefox" )
myApp=switchApp
args=[' sudo',' -u',user, 'osascript' ,'-e',' tell app "Firefox"\n activate\n end tell']
It is problem with the user who run firefox it is not You, and he don't access to gui components.
You must add "sudo"
user='YourName' sudo',' -u',user, 'osascript' ,'-e',' tell app "Firefox"\n activate\n end tell'] Popen(args, stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
args=['
subprocess.
wait(2) ("Firefox" )
myApp=switchApp