I have a simple script that adds a new folder to an existing folder called “current event” and at the same tim,e creates a new Project in Aperture with the same name. The script is as follows;
Script 1
try
set newLoc to "Macintosh HD:users:Event:Sites:x3a2108:current_event:"
set {text returned:desc} to display dialog "Type the class name here" default answer "XXXX-XXXX-##" buttons {"OK", "Cancel"} default button "OK"
do shell script "/bin/mkdir -p " & quoted form of POSIX path of newLoc & ¬
quoted form of (desc) & ""
on error errmsg number errNum
if errNum is not -128 then display dialog errmsg
end try
tell application "Aperture"
tell library 1
make new project with properties {name:desc}
end tell
end tell
Now I have another Folder Action Script, Script 2 below, attached to the folder “current event” which in turn adds a third script to the new folder. (The third script scales the image files accordingly in the new Photos & Thumbs subfolders.)
Script 2
on adding folder items to this_folder after receiving these_items
set PathtoFolderaction to "Macintosh HD:Users:eventphotography:Library:Scripts:Folder Action Scripts:Scale2.scpt"
repeat with a_item in these_items
if folder of (info for a_item) is true then
try
tell application "Finder"
set Photos to make new folder at a_item with properties {name:"Photos"}
set Thumbs to make new folder at a_item with properties {name:"Thumbs"}
end tell
tell application "System Events"
attach action to folder (a_item as text) using PathtoFolderaction
end tell
end try
end if
end repeat
end adding folder items to
This all works very well but what I would like to do is tell Aperture to watch the new folder created by Script 1 and import all images that arrive in that folder into the corresponding Project created by the first script. I have tried various things but have not got anything to work yet. I know I can create an Automator workflow to attach to each folder, but this is a tedious manual process that would need doing for each and every photo event I shoot. Any help with this would be much appreciated.
Up until now I have been downloading memory cards using the Aperture Import facility and will continue to do this at some events, but as I am now shooting much more with wireless between camera and computer, I need a slightly different workflow.
UPDATE
I have appended Script 2 above to include a second set PathFolderaction… to attach a second script as follows,
on adding folder items to this_folder after receiving these_items
tell application "Aperture"
tell library 1
--import by reference
with timeout of 600 seconds
import these_items by referencing into project "Ring 6"
end timeout
end tell
end tell
end adding folder items to
This works but will import all files into project “Ring 6” when I could have Rings 1 to 10. I need to change this “Ring 6” to a variable that matches the the name of the folder it is attached to.
Thanks in advance.
Michael