iPhoto - Automator Import Script Improvements

Hi All,


I'm mainly working on Lightroom but uses iPhoto to get a better integration into OS X.

My main issue was syncing both librairies and I came to this with an automator script that I'm proud about. I hope it could help some guys also.

I will detail my script below, but I basically have a Lightroom jpegs export into finder folders and an applescript that import them into iPhoto with correct album name.

I have 3 ideas to improve that workflow but didn't manage to script it.


1) First improvement - don't copy files during import to saves space.

For now, iPhoto is copying the files to the library during import.

I want to improve this script by not copying the files into iPhoto library during import but I didn't manage to do it.

I tried to uncheck the tick box "copy the files to iPhoto library" but it didn't works. Import works but files still copied into iPhoto library...

So, I'm struggling with HD space because I've the photos twice on my hard disk (once in folder, once in iPhoto library)


2) Make a daily check of my photo folder content to launch the script automatically during night if there were some changes.

Something like :

If photofolder content (qty of files) is different than the day before, launch the import process

Else

End if


3) Don't import hidden folder

The "dispense item incrementally" is also scanning hidden folder (e.g : 'album data.xml' folder) that I didn't want to appear into iPhoto library.

I didn't find any option to not scan hidden folders right now.


My workflow in Automator :


Delete current iPhoto library

Create new one

List photos folder with "dispense folder incrementally"

Set folder name as a variable

Import this folder content to new iPhoto album with the above variable as album name.

Loop until dispense folder incrementally is done


Hoping that my post could support some guys who need that kind of workflow and hoping you guys could support my needs!


Regards

Posted on Jun 28, 2014 11:40 AM

Reply
17 replies

Aug 21, 2015 6:11 AM in response to olivev

Hi,


olivev wrote:


No solution ?


The term album does not work, you must use container.

The term photo does not work, you must use media item.


It is not possible to filter by type since this property does not exist.

So you need to include a list of names in the script to exclude folder albums ans smart albums.

Example :

set excludedAlbums to {"Vacance", "Événements iPhoto", "Favorites"}

if newFolderNames is not {} then -- to synchronize album

set oldModifDates to newModifDates-- update list

set oldFolderNames to newFolderNames-- update list

tell application "Photos"

set imAlb to name of last import album

set albNames to name of containers whose its name is not imAlb

repeat with i in albNames-- check the name of this album with the names of the subFolders

set alb_Name to contents of i

if alb_Name is not in excludedAlbums and alb_Name is not in newFolderNames then

-- delete this album because the subfolder no longer exists in the whole Photo folder.

set thisAlbum to container alb_Name

--delete media items of thisAlbum -- not possible

--delete thisAlbum -- not possible

end if

end repeat

end tell

end if

--------------------


It's not possible to delete an album or a photo, because delete and remove commands no longer exists in the AppleScript dictionary of Photos, maybe in the future version of Photos.

This may be possible from the photo database ("Library.apdb") by using the sqlite3 command in a shell script.


-------

This thread is a question for iPhoto, if you have a question for the "Photos" application, start a new thread.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iPhoto - Automator Import Script Improvements

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.