Applescript安装光盘映像并将照片导入iphoto库

时间:2011-08-31 06:30:01

标签: automation applescript iphoto

我有一系列光盘图像是由我的数码相机的存储卡制成的。所以,基本上,DCIM文件夹中的一堆照片和视频。

在我看来,应该有一种方法可以让那些光盘图像安装,并将所有这些照片添加到我的iphoto库中,将事件分开。我也希望它导入JUST照片 - 跳过所有视频。

任何人都知道魔法代码?

1 个答案:

答案 0 :(得分:-1)

这应该有所帮助。我刚从互联网上把它拼凑起来。如果有效,请告诉我。 :)

tell application "Finder"
  if not (exists "disk_image_name")
    do shell script hdiutil mount "disk_image_name".dmg
  end if
end tell
tell application "iPhoto"
        import from "disk_image_name"
        delay 5 -- wait for import to finish
        tell (the first album whose name is "albumtoimportto") to select photos
        assign keyword string "autoimport"
        select (the first album whose name is "autoimport")
        close application "iPhoto"
    end tell