This isn’t specifically an applescript problem, but it’s one I’ve encountered while scripting, so I still think it’s relevant.
For whatever reason, I prefer to use the X11 versions of some programs (such as emacs) to edit the relevant files. So I wrote a droplet that constructs a command line from the files dropped onto it, then passes that command line to Terminal to invoke emacs on the files. Now, when I drag files onto the droplet, it works fine, but when I try to associate this script with, say, .tex files (using the “Change All” button in the file info dialog), OS X chooses some script other than the one I told it to use and associates that script instead. Has anybody encountered this before?
Here’s the script, for reference:
on open these_items
	set myfiles to ""
	repeat with i from 1 to count of these_items
		set this_item to item i of these_items
		set item_info to info for this_item
		set myfiles to myfiles & (quoted form of POSIX path of this_item as string) & " "
	end repeat
	tell application "Terminal"
		if ((count windows) is 0) or (front window is busy) then
			do script ("emacs " & myfiles & " &")
			activate
			return
		end if
		
		do script ("emacs " & myfiles & " &") in front window
		activate
	end tell
end open
Thanks for any suggestions,
-chris