[Pythonmac-SIG] Trying to use appscript need some help

has hengist.podd at virgin.net
Tue Jun 30 21:15:30 CEST 2009


Jan Erik Moström wrote:

> I'm trying to learn how to use appscript but I don't understand what  
> I'm missing. I want to read photo info from iPhoto and have things  
> working ... partly
> [...]
>    # set ptitle to date of item 1 of the selection
>    # app(u'iPhoto').selection.items[1].date.get()
>    print 'Date  : ', item.date.get()
>    # AttributeError: Unknown property, element or command: 'date'
>
> The problem is the line where I try to get the date info, the first  
> commented line is the applescript line I'm trying to translate, the  
> second is what ASTranslate tells me, and the third is the error  
> message I get.

ASTranslate is wrong here; it should be 'date_' with a trailing  
underscore, not 'date'.

In situations where application-defined terms conflict with built-in  
terms (i.e. use the same keyword but a different four-char code),  
appscript appends an underscore to the application-defined term to  
prevent any problems.

There was a known inconsistency in how older versions of appscript  
applied these escapes; that has been fixed in the latest appscript and  
ASDictionary releases, but I've not had time to update ASTranslate yet.

Meantime, if in doubt, go by the appscript-style dictionary, which you  
can export as HTML from ASDictionary or browse via appscript's built- 
in help() method (see the appscript manual for details).

HTH

has

-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



More information about the Pythonmac-SIG mailing list