Can't get filename/path from alias list
First off, let me say, I'm a complete AppleScript newbie, but not new to programming.
I'm trying to automate the creation of an album in iPhoto after Image Capture triggers my AppleScript via the "Automatic Task" feature. It appears that Image Capture passes an alias list to the script, but I'm having trouble accessing the individual filenames/paths in the list.
My current script looks like this:
-- Image Capture to iPhoto Handoff
-- adding folder name extractions
on open filesfromcamera
set pathstring to "Paths are:" & return
tell application "Finder"
repeat with thisalias in filesfromcamera
set myfile to the original item of alias thisalias
set pathstring to (pathstring & the name of myfile & return)
end repeat
display dialog pathstring
end tell
tell application "iPhoto"
import from filesfromcamera to album "test" without force copy
end tell
end open
When I use the script as shown above, I get the error "Can't make some data into the expected type" If I remove the "alias" coercion from the line "set myfile to the original item of alias thisalias" I get the error "Can't make <<class orig>> of alias "MacHD:Test:Pictures:pic1.jpg". If I try to just get the name of "thisalias" directly, I get the same error.
Perhaps it's not really an alias list I'm getting from Image Capture? However, if I don't to do any processing on "filesfromcamera" and pass that on to iPhoto, the import works just fine, so I know it's some sort of valid list.
My ultimate goal is to parse the pathname so I can use the name of the folder containing the images as the name of a new album in iPhoto.
Tried to find solution in past posts, but people using similar syntax all seem to get results they expect.
iMac 24" Mac OS X (10.4.9) 1 GB RAM
I'm trying to automate the creation of an album in iPhoto after Image Capture triggers my AppleScript via the "Automatic Task" feature. It appears that Image Capture passes an alias list to the script, but I'm having trouble accessing the individual filenames/paths in the list.
My current script looks like this:
-- Image Capture to iPhoto Handoff
-- adding folder name extractions
on open filesfromcamera
set pathstring to "Paths are:" & return
tell application "Finder"
repeat with thisalias in filesfromcamera
set myfile to the original item of alias thisalias
set pathstring to (pathstring & the name of myfile & return)
end repeat
display dialog pathstring
end tell
tell application "iPhoto"
import from filesfromcamera to album "test" without force copy
end tell
end open
When I use the script as shown above, I get the error "Can't make some data into the expected type" If I remove the "alias" coercion from the line "set myfile to the original item of alias thisalias" I get the error "Can't make <<class orig>> of alias "MacHD:Test:Pictures:pic1.jpg". If I try to just get the name of "thisalias" directly, I get the same error.
Perhaps it's not really an alias list I'm getting from Image Capture? However, if I don't to do any processing on "filesfromcamera" and pass that on to iPhoto, the import works just fine, so I know it's some sort of valid list.
My ultimate goal is to parse the pathname so I can use the name of the folder containing the images as the name of a new album in iPhoto.
Tried to find solution in past posts, but people using similar syntax all seem to get results they expect.
iMac 24" Mac OS X (10.4.9) 1 GB RAM
iMac 24", Mac OS X (10.4.9), 1 GB RAM