[Pythonmac-SIG] aeve and Safari
John Weeks
john.weeks at insead.edu
Wed Jan 14 07:00:18 EST 2004
Trying to see how aeve handles the scripting of Safari and compare
it to AppScripting, I am having problems figuring out how to call
"do JavaScript" using aeve as well.
I have a little program that works fine:
import aeve
saf = aeve.talkto('com.apple.safari')
from aeve.Applications import Safari
newdoc = saf.make(new=Safari.document)
newdoc.URL = "http://web.lexis-nexis.com/"
Looking at the aeve-generated dictionary for Safari, I tried to
implement the AppleScript:
set the load_status to (do JavaScript "document.readyState" in document 1)
as:
import aeve
saf = aeve.talkto('com.apple.safari')
from aeve.Applications import Safari
newdoc = saf.make(new=Safari.document)
newdoc.URL = "http://web.lexis-nexis.com/"
load_status = newdoc.do_JavaScript("document.readyState")
But I get the following error:
File "test2.py", line 5, in ?
newdoc.URL = "http://web.lexis-nexis.com/"
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeve/aetypes/aecomplex.py", line 246, in __set__
ObjectSpecifier.__set__(self, frominstance, tovalue)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeve/aetypes/aecomplex.py", line 127, in __set__
_from_instance=frominstance,
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeve/aetypes/aecomplex.py", line 468, in bound_event_method
return self(inst, *args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeve/aetypes/aecomplex.py", line 493, in __call__
raise aetools.Error, aetools.decodeerror(_reply, _arguments, _attributes)
aeve.aetypes.aetools.Error: (1, u'NSReceiverEvaluationScriptError: 4', None)
I also tried:
import aeve
saf = aeve.talkto('com.apple.safari')
from aeve.Applications import Safari
newdoc = saf.make(new=Safari.document)
newdoc.URL = "http://web.lexis-nexis.com/"
load_status = saf.do_JavaScript(in_=newdoc,_object='document.readyState')
But I get the same error.
Thanks for any help,
John
More information about the Pythonmac-SIG
mailing list