[Pythonmac-SIG] Help with py-appscript?

Charles Turner vze26m98 at optonline.net
Thu Jun 17 22:52:12 CEST 2010


Hi all-

Although I'm sure I qualify as a Python noobie as well as with Applescript and Skim, I've run into the following and hope someone could shed some light for me.

I have the following script:

from appscript import *

skim = app('Skim.app')
reference = skim.documents[1].notes[1].selection.get()[0]
print reference

which produces the reference:

app(u'/Applications/Skim.app').documents[u'blair-2004.pdf'].pages[1].text.characters[app.documents[u'blair-2004.pdf'].pages[1].text.characters[1022]:app.documents[u'blair-2004.pdf'].pages[1].text.characters[1147]]

If I change the last line of the script to:

print reference.get()

it generates:

CommandError: app(u'/Applications/Skim.app').documents[u'blair-2004.pdf'].pages[1].text.characters[app.documents[u'blair-2004.pdf'].pages[1].text.characters[1022]:app.documents[u'blair-2004.pdf'].pages[1].text.characters[1147]].get, ((), {}), aem.EventError(-1720, '', {'errn': <aem.ae.AEDesc type='long' size=4>, 'erob': <aem.ae.AEDesc type='obj ' size=932>})

function __call__ in untitled at line 499
raise CommandError(self, (args, kargs), e, self.AS_appdata)

Can someone point out what I'm doing wrong here?

Thanks in advance,

Charles





More information about the Pythonmac-SIG mailing list