I'm trying to perform the following applescript with the appscript Python module:

tell application "System Events"
        tell process "Preview" to click button "OK" of every window
end tell

Is this possible?  The closest I got was

import appscript
appscript.app('System Events').processes['Preview'].windows[1].buttons[1].click()

but I get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
File "build/bdist.macosx-10.3-fat/egg/appscript/reference.py", line 492, in __call__
appscript.reference.CommandError: Command failed:
                OSERROR: -609
                MESSAGE: Connection is invalid.
COMMAND: app(u'/System/Library/CoreServices/System Events.app').processes['Preview'].windows[1].buttons[1].click()

Any advice or know of documentation that would help me?

Thanks.

Charlie

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to