Why doesn't this compile/work?

Hi,

I have a convoluted script that will do what I want, but I am curious why an alternate form of the script will not work. This is the one that DOES work:

on adding folder items to this_folder after receiving these_items
	set item_string to ""
	repeat with i from 1 to number of items in these_items
		set this_item to item i of these_items
		set the item_info to info for this_item
		set the item_string to item_string & the quoted form of the POSIX path of this_item & " "
	end repeat
	do shell script ("open -a GraphicConverter " & item_string)
end adding folder items to

This is the one that doesn’t work, although I don’t understand why…

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		open these_items using "GraphicConverter"
	end tell
end adding folder items to

I get a compile error that highlights the word “using” and says it expected the end of the line but found an identifier instead.

While I’m asking, is it possible to prevent dropped items from actually being moved or is there a way to return them to their previous location(s)? Perhaps I want something other than a folder action, but I like the fact that it’s a folder action because of the contextual menu showing the contents…

Thanks,
Hepcat

Hello

Instead of telling Finder to open the files, why not do:


tell app "GraphicConverter
open these_items
end tell

As for making the file return to it’s location, you could make the folder action find out the path to the item at the start of the script, and move it back to there at the end of the script, but to me it sounds like you want a droplet.

these_items is a list, so you have to get the first one or deal with the many.

Why use the Finder, by the way? Just this works

tell application "GraphicConverter" to open the first item of these_items

It compiles fine for me. However, why not use this instead?

tell application "GraphicConverter"
	activate
	open these_files
end tell

Edit: Seems Adam beat me to it.

Regarding the original question, I think your script doesn’t work because you “invented” the syntax. It should be something as:

open these_items using application file id "GKON"

Or:

open these_items using application file id "com.lemkesoft.graphicconverter"

Or:

open these_items using application file "path:to:GraphicConverter:"

But I would use as well the legendary GC’s scripting abilities :wink: