Charles Turner wrote: > 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>})
That looks like the slightly mangled output from CommandError.__repr__(), although you don't say if its your code or your editor that's formatting it this way. You'll get a much more readable error message from CommandError.__str__(). Digging through it, the error number is -1720, 'invalid range'. I'm not familiar with Skim, but a quick test confirms the same commands produce the same error in AppleScript too: tell application "Skim" set r to item 1 of (get selection of note 1 of document 1) get contents of r end tell -- error "Skim got an error: Invalid range." number -1720 from characters 222 thru 286 of text of page 4 of document "points-of-view.pdf" So I would suggest taking it up with the Skim authors, as it's probably a bug in their scripting support. HTH has -- Learn AppleScript, 3rd edition, Sanderson & Rosenthal: http://apress.com/book/view/9781430223610 Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG