PDA

View Full Version : AppleScript help? auto import to iPhoto.



susancbk
October 31st, 2007, 04:45 PM
What im attempting to do is put an AppleScript on a folder so that whenever I drop an image into that folder it loads up iPhoto and imports it.

I used this similar example as my starting ground : http://henrik.nyh.se/2006/12/automatically-import-and-tag-photo-booth-photos-into-iphoto

and came up with this


on adding folder items to this_folder after receiving added_items
tell application "iPhoto"
import from added_items
delay 5 -- wait for import to finish
tell (the first album whose name is "Last roll") to select photos
assign keyword string "Eye-fi"
select (the first album whose name is "Eye-fi")
end tell
end adding folder items to


Its working fine on my powerbook g4 , with iphoto 5.0.4

However, when tried on a mac book, with the latest version of iphoto it starts to import then fails with an Unreadable Files error...however there's no files listed.

Here's a link to a screenshot of the error message (the screenshot also shows my script)
http://www.screencast.com/users/susanBuck/folders/Jing/media/f34a1d3a-aa65-4c63-92f6-8d98e22da285

Any Ideas?

markbarner
March 25th, 2008, 02:43 PM
Hi have you found a solution?

i tried this and it seems to work great on macbook pro on leopard. Theres only 2 problems with my script: 1. it doesnt add the "autoimport" that i assigned in the script, 2. it doesnt close iphoto after import??? hope you can tell me why?

hope to hear from others.

it would also be great to add the feature that when you copy a file to the pictures folder on your mac then it will look at the date the photo was taken and then create a folder ex. "2008_03_14" and then moves the newly added photos to the folder corresponding to the date of the photo... but how? im a newbee at this coding!

kind regards from denmark!
Mark Barner




(*
add - new item alert

This Folder Action handler is triggered whenever items are added to the attached folder.
The script will display an alert containing the number of items added and offering the user
the option to reveal the added items in Finder.

Copyright © 2002–2007 Apple Inc.

You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)

property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.

on adding folder items to this_folder after receiving added_items
try
tell application "iPhoto"
import from added_items
delay 5 -- wait for import to finish
tell (the first album whose name is "Last roll") to select photos
assign keyword string "autoimport"
select (the first album whose name is "autoimport")
close application "iPhoto"
end tell
end try
end adding folder items to

Templarian
March 25th, 2008, 05:33 PM
oops wrong thread. multiple tabs messed me up.

But you may want to post over at the apple developer forums... we don't have many apple script users here to my knowledge.