Sorry for the beginner question but …
How do I create a new list based on the items of another list?
for example
set isoImageDate to projectYear & delimiter & projectMonth & delimiter & projectDay as string
I now want to file a list of images within each item of the isoImageDate list (which changes on each loop).
How can I set 2010-08-25, 2010-08-26, 2010-08-27 to be 3 separate lists?
Thanks for the time.
set end of can append items to the end of a list like this:
set newList to {} --make a new empty list
repeat with x from 1 to 10
set end of newList to x --append a new item to the list
end
return newList
My first script … sorry for the mess.
Rather than have the move command from the section
– File the photos into the corresponding project
included in the loop, I would like to assign the list of images who meet the criteria to the corresponding item of the isoUniqueDateList. I would then like to move them all at once at the end of the script. I think that will make it faster ?!?!
Any other suggestions on style, speed, saving steps would be appreciated!
tell application "Aperture"
set imageSel to selection
if imageSel is {} then
error "Please select a Project from the Library tab in the sidebar and try again."
else
set imageSel to item 1 of imageSel
tell imageSel
set projSel to id of parent
end tell
set imageList to every image version of project id projSel
set dateList to the value of EXIF tag "ImageDate" of every image version of project id projSel
-- Check if there is a "Imported by Date" folder to file the projects in
tell library 1
if not (exists folder "Imported by Date") then
make new folder with properties {name:"Imported by Date"}
end if
-- Get unique dates for the projects and format the dates into YYYY-MM-DD
set isoDateList to {}
set isoUniqueDateList to {}
set isoImageDate to {}
set uniqueDateList to {}
repeat with i from 1 to count of imageList
tell (item i of imageList)
set theDate to value of EXIF tag "ImageDate"
set delimiter to "-"
set projectYear to year of theDate
set projectMonth to month of theDate as integer as string
if length of projectMonth is 1 then
set projectMonth to "0" & projectMonth
end if
set projectDay to day of theDate as integer as string
if length of projectDay is 1 then
set projectDay to "0" & projectDay
end if
set isoImageDate to projectYear & delimiter & projectMonth & delimiter & projectDay as string
set end of isoDateList to isoImageDate
if not (isoUniqueDateList contains isoImageDate) then
set end of isoUniqueDateList to isoImageDate
set end of uniqueDateList to theDate
end if
end tell
end repeat
-- Create a new project for each unique date
repeat with counter from 1 to length of uniqueDateList
tell folder "Imported by Date"
if not (exists project (item counter of isoUniqueDateList)) then
make new project with properties {name:(item counter of isoUniqueDateList)}
end if
-- File the photos into the corresponding project
move (every image version of project id projSel whose value of EXIF tag "CaptureYear" is year of item counter of uniqueDateList and value of EXIF tag "CaptureMonthOfYear" is month of item counter of uniqueDateList as integer and value of EXIF tag "CaptureDayOfMonth" is day of item counter of uniqueDateList) to project (item counter of isoUniqueDateList)
end tell
end repeat
if (count of image versions of project id projSel) is 0 then
delete project id projSel
end if
end tell
end if
end tell