2011-04-30 52 views
1

我發現我的iPhoto圖庫中的數千張照片沒有正確的圖標。我試過重建數據庫,但沒有奏效。但是,一種可以工作的技術只需單擊「編輯」,然後單擊「增強」按鈕。讓iPhoto增強數千張照片?

我發現如果我編輯系列中的第一張照片,我可以通過在「增強」按鈕和右箭頭按鈕之間來回切換來修復它們。

有什麼辦法可以自動化嗎?

回答

1

我還沒有用過iPhoto那麼多,但我已經用了很長時間的蘋果。我猜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:護理解釋?

+0

這不適用於iPhoto。 iPhoto不會編輯文件系統中的圖像。它維護着自己的照片數據庫。您需要選擇iPhoto中的每張照片,進行編輯,然後移至下一張。 – vy32 2011-07-23 04:53:36

+0

對不起。我沒有使用iPhoto AT ALL。我只是在做一些事情。 :( – fireshadow52 2011-07-23 15:28:44

+0

我更新了答案 – fireshadow52 2011-07-23 17:50:27