what am i doing wrong?

I am fairly new to applescript and since I am used to C and PHP scripting, the syntax and structure is slighly odd to me espcially loops and file attributes and things. anyway I want make a drop app that opens all the image files in a dropped folder into Fireworks MX (this is all OS X by the way). The drop app accepts the folder, thinks for a sec, then quits with no results. PLease help.

on open (sourceFolder)
tell application “Fireworks MX”
repeat with x in every file of sourceFolder
if name of x ends with “.tif” or “.jpg” or “.tiff” or “.png” or “.gif” then
open x
end if
end repeat
end tell
end open

You’re giving AppleScript far too much credit. You have to explicitly tell it to list files and coerce to strings and aliases. First off, when you drag and drop files or folders on an applet, the result is always a list even if you drop only one item. Next, list the folder’s contents and then loop through them. Your comparison to extensions must be more explicit to keep referring to the item to compare (this is the same in other languages). Finally, you need to concatenate the file names and the source folder path into an alias for an app to know how to open it. This script should work:


awsome, thanks. I had a slight feeling that it maybe have been a little more complicated than what I was doing.