Hi there!
Very quick question. I’ve completed my first extremely simple AppleScript (well, actually the script is run in an automator app because I didn’t know how to implements drag&drop with the script, but that’s not the point).
Here’s the script
property image_extension_list : {"tif", "tiff", "gif", "png", "pict", "pct", "jpg", "jpeg", "bmp"}
property video_extension_list : {"avi", "mov", "mpg", "mpeg", "wmv", "mkv", "m4v", "srt"}
property audio_extension_list : {"mp3", "wav", "mp4", "aac", "m4a", "m4b"}
property application_extension_list : {"dmg", "hqx", "toast", "app"}
on run {input, parameters}
repeat with a from 1 to length of input
set theCurrentFile to item a of input
set theExtension to name extension of (info for theCurrentFile)
if theExtension is in application_extension_list then
tell application "Finder"
move theCurrentFile to path to applications folder as string
end tell
else if theExtension is in image_extension_list then
tell application "iPhoto"
import from theCurrentFile
end tell
delay 1
tell application "Finder"
delete theCurrentFile
end tell
else if theExtension is in audio_extension_list then
tell application "iTunes"
add theCurrentFile to playlist "Library" of source "Library"
end tell
delay 1
tell application "Finder"
delete theCurrentFile
end tell
else if theExtension is in video_extension_list then
tell application "Finder"
move theCurrentFile to path to movies folder as string
end tell
else
tell application "Finder"
move theCurrentFile to path to documents folder as string
end tell
end if
end repeat
end run
It just put the files that are dropped into it in the correct place.
The problem is that, whenever I use the app (whether is by dropping a file or just clicking on the icon) iPhoto is launched. It doesn’t matter the file’s extension, iPhoto will be opened always.
Why is this? iPhoto should only be opened if the file’s a picture.
Thanks!!