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

Automation Applescript安装光盘图像并将照片导入iphoto库,automation,applescript,iphoto,Automation,Applescript,Iphoto,我有一系列的光盘图像,它们是用我的数码相机的存储卡制作的。所以,基本上,在DCIM文件夹中有一堆照片和视频 在我看来,应该有一种方法让applescript挂载这些光盘图像,并将所有这些照片添加到我的iphoto库中,以事件分隔日期。我还希望它只导入照片——跳过所有视频 任何人都知道魔法密码吗?这应该会有帮助。我刚从网上把它拼凑起来。让我知道它是否有效。:) tell application "Finder" if not (exists "disk_image_name") do

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

在我看来,应该有一种方法让applescript挂载这些光盘图像,并将所有这些照片添加到我的iphoto库中,以事件分隔日期。我还希望它只导入照片——跳过所有视频


任何人都知道魔法密码吗?

这应该会有帮助。我刚从网上把它拼凑起来。让我知道它是否有效。:)

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