I'm trying to run the AppleScript inside of my Python script but it does not work. When I run the same AppleScript in the AppleScriptEditor it works perfectly!
This is my code:
script = '''
tell application "System Events"
set position of first window of application process "%(app)s" to {100, 100}
end tell
''' % {'app': app}
print(script)
p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
stdout, stderr = p.communicate(script)
I'm printing the script and eveything is correct
tell application "System Events"
set position of first window of application process "Terminal" to {100, 100}
end tell
but I do not know why it does not move the Terminal window. Any idea?