[Pythonmac-SIG] aeve and Safari
Bob Ippolito
bob at redivi.com
Wed Jan 14 07:16:12 EST 2004
On Jan 14, 2004, at 7:00 AM, John Weeks wrote:
> 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")
Try this:
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("document.readyState",
in_=saf.documents[1])
-bob
More information about the Pythonmac-SIG
mailing list