0
votes

I store photo files in folders on my computer before i add them into iphoto.

I want to add the contents of a selected to folder to iphoto and name the new album as the folder name

I have created an automator flow where I do the following

(Select folder initially to work)

  1. Get selected finder items -- This is grabbing the folder
  2. Set Value of Variable -- this is grabbing the full path name and setting a variable with the name
  3. Get Folder contents -- this gets all the photos contained.
  4. Import Files into iphoto -- This adds the photos into iphoto and creates a new album using the variable name.

The issue i have is the variable name sets the full path of the files, /Users/Johnny/Photos/Dayout

Is the a script that can take just the name of the initial folder "Dayout"

Thanks in advance to anyone who can help

Cheers

John

1
care to share the script with me, please ? I'm trying to do the same thing.Artur Bodera

1 Answers

1
votes
activate application "SystemUIServer" -- http://www.openradar.me/9406282
tell application "Finder"
    activate
    repeat with f in (get selection as alias list)
        set n to name of f
        tell application "iPhoto"
            if not (exists album n) then new album name n
            import from f to album n
        end tell
    end repeat
end tell

There is a bug in 10.7 and 10.8 where Finder ignores new windows when getting the selection property. If you open a new Finder window, select some items, and run tell app "Finder" to selection in AppleScript Editor, the result is items selected in some window behind the frontmost window (or an empty list). One workaround is to move focus to another application and back.