【问题标题】:Get iPhoto to Enhance thousands of photographs?获取 iPhoto 以增强数千张照片?
【发布时间】:2011-07-28 09:35:00
【问题描述】:

我发现我的 iPhoto 库中的数千张照片没有正确的图标。我试过重建数据库,但没有奏效。但是,一种可行的技术是简单地单击“编辑”,然后单击“增强”按钮。

我发现,如果我编辑系列中的第一张照片,我可以通过在“增强”按钮和右箭头按钮之间来回切换来修复它们。

有什么办法可以自动完成吗?

【问题讨论】:

    标签: applescript iphoto


    【解决方案1】:

    我使用 iPhoto 的次数不多,但我使用 applescript 已经有一段时间了。我猜Enhance 按钮位于Edit 菜单下。如果这是真的,那么你可以......

    tell application "System Events" to tell process "iPhoto" to click menu item "Enhance" of menu "Edit" of menu bar 1
    

    您说您有数千张照片需要增强。 AppleScript 非常适合做这样的事情。要完全自动化它(加载图像并增强它们),您可以使用 droplet,如下所示:

    on open the_images
        repeat with i from 1 to the count of the_images
            set this_image to item i of the_images as alias --the current image
            --Verify that the file is actually an image and not just a random file
            tell application "Finder"
                if (this_image) as string does not end with ":" then --a folder, cannot use
                    if the name extension of this_image is in {"jpg","tif","gif","png","psd"} then --add additional extensions as needed
                        --This is an image, so enhance it
                        my enhance(this_image)
                    else
                        display dialog "The file " & name of this_image & " is not an image. It cannot be enhanced." buttons{"OK"} default button 1
                    end if
                else
                    display dialog "The folder " & name of this_image & " is not an image. It cannot be enhanced." buttons{"OK"} default button 1
                end if
            end tell
        end repeat
    end open
    
    on enhance(this_image)
        tell application "iPhoto"
            activate
            open this_image
        end tell
        tell application "System Events" to tell process "iPhoto" to click menu item "Enhance" of menu "Edit" of menu bar 1
        tell application "iPhoto" to close this_image
    end enhance
    

    编辑:上面的代码不起作用(我没有删除它以显示其他人不应该做的事情),但是这个应该......

    tell application "iPhoto"
        set the_images to (get the selection) as list
        repeat with i from 1 to the count of the_images
            set this_image to item i of the_images
            my enhance()
            save this_image in this_image
        end repeat
    end tell
    
    on enhance()
        tell application "System Events" to tell process "iPhoto" to click menu item "Enhance" of menu "Edit" of menu bar 1
    end enhance
    

    如果这个也不起作用,我深表歉意;我对 iPhoto 完全陌生,我正在尽力而为。 :S

    EDIT2:好的,我很抱歉。上面的脚本不起作用(没有删除以显示其他人不应该做的事情)。这个可能行不通,但还是试试吧……

    tell application "iPhoto"
        set these_images to (get the selection) as list
        repeat with i from 1 to the count of these_images
            set this_image to item i of these_images
            my enhance(this_image)
            save this_image in this_image
        end repeat
    end tell
    
    on enhance(this_image)
        tell application "System Events"
            tell process "iPhoto"
                keystroke return
                --possible pseudo-code
                click menu item "Edit" of menu bar 2
                click menu item "Enhance" of menu "Quick Fixes"
                --end possible pseudo-code
            end tell
         end tell
    end enhance
    

    :S

    @Downvoter:需要解释一下吗?

    【讨论】:

    • 这不适用于 iPhoto。 iPhoto 不会编辑文件系统中的图像。它维护自己的照片数据库。您需要在 iPhoto 中选择每张照片,对其进行编辑,然后移至下一张。
    • 对不起。我根本没有使用过 iPhoto。我只是假设一些事情。 :(
    • 所以我采用第二个程序,将其保存在自动机脚本中,然后运行 ​​iphoto,选择要增强的照片,然后运行自动机脚本?
    • 是的,就是这样。附注:如果您想偷懒并让脚本自己激活 iPhoto,只需将 activate 放在开头即可:P 如果它仍然不起作用,请告诉我。跨度>
    • 好的。这不起作用有两个原因。 1) 你不是在 Automator 中做的,而是在 AppleScript Editor 中做的。 2) AppleScript Error: "System Events got an error: Can't get menu item "Enhance" of menu "Edit" of menu bar 1 of process "iPhoto.". 原来没有 Enhance 菜单选项。跨度>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多