我正试图用applescript/iphoto获得专辑的名称。到目前为止我已经拿到这个了
tell application "iPhoto"
activate
set theEvents to get every album
repeat with aEvent in theEvents
log name of aEvent
end repeat
end tell但当它打印出名字时,我得到了这个:
(*name of album id 6.442450942E+9*)
(*name of album id 6.442450941E+9*)
(*name of album id 6.44245094E+9*)不完全是我想要的。我对applescript非常陌生,所以我怀疑一些基本的东西出了问题,但是我在网上看到的几个例子似乎都是这样的。任何帮助都很感激。
更新
可能已经找到答案了。我看到了一些暗示,即不可能直接使用applescript访问事件名称,不像专辑名(对我来说似乎很傻,但这正是我目前所发现的)
发布于 2013-01-13 04:00:39
试试这个:
tell application "iPhoto"
activate
set theEvents to get every album
repeat with aEvent in theEvents
log (get name of aEvent)
end repeat
end telllog命令不会隐式取消要传递的对象说明符。添加一个get命令可以做到这一点。
发布于 2013-01-13 16:36:24
答案之一,已经被接受了,但我想把这个张贴给未来的读者。
tell application "iPhoto" to set theEvents to get name of every album
#You can then use the theEvents list.
#Example - log items of theEvents
log theEvents
--> {"Events", "Faces", "Places", "Photos", "Last 12 Months", "Last Import", "Flagged","Trash", "My Photo Stream", "Holiday 2008", "Holiday Sep 2008"}
#Example - work though the items of theEvents with a repeat loop
repeat with i from 1 to number of items in theEvents
set this_item to item i of theEvents
if this_item contains "Holiday" then
log this_item
-->(*Holiday 2008*)
-->(*Holiday Sep 2008*)
end if
end repeathttps://stackoverflow.com/questions/14299624
复制相似问题