Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > quickie help on Applescript?

quickie help on Applescript?
Thread Tools
tycheung
Dedicated MacNNer
Join Date: Feb 1999
Status: Offline
Reply With Quote
May 28, 2006, 07:00 AM
 
Hi all,


Looking for a way to make Applescript look at a list of folders in a directory, and for each folder make a smart album in photo with the name of the folder. i.e.

foreach (folder name){

create smartalbum searching for all files containing name of the folder

}


is this dooable?

Thanks,

Tyler
     
BLAZE_MkIV
Professional Poster
Join Date: Feb 2000
Location: Nashua NH, USA
Status: Offline
Reply With Quote
May 28, 2006, 11:46 AM
 
repeat for every theFolder in ( every folder of theDirectory )

set theItems to every file of theFolder
set theAlbumFiles to {}

repeat with theItem in theItems

if name of theItem contains name of theFolder

copy theItem to end of theAlbumFiles

end

end

end

Should get you started. Not at home now So i can't test it.
     
Sal
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status: Offline
Reply With Quote
May 28, 2006, 08:16 PM
 
Originally Posted by tycheung
Hi all,


Looking for a way to make Applescript look at a list of folders in a directory, and for each folder make a smart album in photo with the name of the folder. i.e.

foreach (folder name){

create smartalbum searching for all files containing name of the folder

}


is this dooable?

Thanks,

Tyler
I don't believe you can use AppleScript to generate Smart Albums in iPhoto. The term "Smart" does not appear anywhere in its scripting dictionary.

But, here's how you would make new albums from a list of folder names:

Code:
set this_folder to choose folder without invisibles tell application "Finder" set the folder_names to the name of every folder in this_folder end tell tell application "iPhoto" repeat with i from 1 to the count of the folder_names set this_name to item i of the folder_names if not (exists album this_name) then new album name this_name end if end repeat end tell
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:55 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,