|
|
|
|
#1 |
|
Prospect
Join Date: Aug 2007
Posts: 47
|
retroactively import pictures into iphoto
I have no apple script experience.
I have recently decided to begin copying pictures upon import into iPhoto rather than not (option in iphoto preferences). Is there a way to make a script that will retroactively go through all the photos i have now in iphoto, find where they are on the computer, and reimport them with copying? I can't do it one by one for thousands of pictures! thanks Last edited by anp12; 05-17-2012 at 01:13 AM. Reason: no tags |
|
|
|
|
|
#2 |
|
Major Leaguer
Join Date: Apr 2010
Posts: 324
|
Can't write it for you right now, but it looks possible.
Assuming you have Lion, it looks like you'll need to * select the photo * use System Events to click the menu item which reveals where the file is on the computer * save the file alias to a variable (ie: tell app "finder" to set aliasPhotoFile to (selection as alias) * tell application "iPhoto" to import from aliasPhotoFile and put that on a repeat loop.
__________________
see a problem; solve a problem. |
|
|
|
|
|
#3 |
|
MVP
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,009
|
(In my opinion, scripting the GUI through System Events is an abomination. If you start clicking menu items and such-like, you're already on the path to madness. At best, you'll produce a brittle, buggy kludge that, even if it works once, is likely to break in the very nearfuture for no discernible reason. Other opinions may vary.)
Here's a script to build a folder of aliases to those photos in your current iPhoto selection whose originals are still not copied into the library. By all means, back up your iPhoto library before running it, and test it out on some small selections. The script will prompt for a folder to put the aliases in. It's probably best if you give it a new empty folder, so the aliases it produces won't get commingled with whatever's already in the folder. (The script won't get confused, but you might be.) You can then drag the folder or selected aliases into iPhoto to re-import the originals. Unfortunately, iPhoto will create duplicate photos when you do this, so as not to discard any edits that you may have already done, and also because it can't be sure you're really re-importing the same photo. It will detect the duplicates and ask what you want to do, but unless you agree to make duplicates nothing will happen. I recommend that you work on one album/event at a time, to make the task of resolving duplicates manageable. (That's why the script always operates on your current selection, rather than addressing the entire library in one fell swoop.) Code:
set libraryPath to (POSIX path of (path to pictures folder)) & "iPhoto Library/"
set aliasFolder to choose folder with prompt "Where should aliases to unimported photos be created?"
set aliasNumber to 0
set lostOriginals to 0
tell application "iPhoto"
set sel to (get the selection)
repeat with aPhoto in sel
set itsPath to (image path of aPhoto)
if itsPath does not start with libraryPath then
my makeAliasFor(itsPath)
end if
end repeat
end tell
if lostOriginals is not 0 then
display dialog "" & lostOriginals & " photos have already lost their originals." buttons {"Sigh"} default button 1
end if
on makeAliasFor(aPath)
global aliasFolder, aliasNumber, lostOriginals
try
set anAlias to (POSIX file aPath as alias)
on error
set lostOriginals to lostOriginals + 1
return
end try
repeat
try
set aliasNumber to aliasNumber + 1
set aliasName to "Photo alias " & aliasNumber
tell application "Finder"
make new alias file at aliasFolder to anAlias with properties {name:aliasName}
exit repeat
end tell
end try
end repeat
end makeAliasFor
|
|
|
|
|
|
#4 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 2,933
|
It sounds like you have pictures in your iPhoto library that you want copies of in the Finder. The simplest way to do that is to export your entire iPhoto library to a folder. I would suggest creating a folder on your desktop. Then from iPhoto, select all of the pictures and drag them to your desktop folder, or choose File > Export.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|