我发现我的 iPhoto 库中的数千张照片没有合适的图标。我试过重建数据库,但没有奏效。但是,一种有效的技术是简单地单击“编辑”,然后单击“增强”按钮。
我发现,如果我编辑系列中的第一张照片,我可以通过在“增强”按钮和右箭头按钮之间来回切换来修复它们。
有什么办法可以自动化吗?
我发现我的 iPhoto 库中的数千张照片没有合适的图标。我试过重建数据库,但没有奏效。但是,一种有效的技术是简单地单击“编辑”,然后单击“增强”按钮。
我发现,如果我编辑系列中的第一张照片,我可以通过在“增强”按钮和右箭头按钮之间来回切换来修复它们。
有什么办法可以自动化吗?
我使用 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 非常适合做这样的事情。要完全自动化它(加载图像并增强它们),您将使用一个液滴,如下所示:
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:愿意解释一下吗?