persistent dropped get_menu_item_value?

Hi, i'm trying to get Floating Menu Items to do something when files are dropped in them but when no file dropped, perform an alternate action. (ex: dropped files would create a new outgoing mail with them as attach, but if no files are being dropped then triggering the item would just launch mail app).

But once a file has been dropped to the item, it seems to get stuck in the variable (like the previous file is being dropped again). How can I make it so the next time it would be triggered (no file dropped) it would just trigger the alternate action?

Thanks!

tell application "BetterTouchTool" to set droppedFile to get_menu_item_value menu_name "FloatQuickFolders" item_name "Drop2Mail"
set charsToRemove to "[\\]\""
set droppedFile to removeCharacters(droppedFile, charsToRemove)

do shell script "open -a Mail " & quoted form of droppedFile

on removeCharacters(inputString, charactersToRemove)
	set outputString to ""
	repeat with i from 1 to length of inputString
		set currentChar to character i of inputString
		if charactersToRemove does not contain currentChar then
			set outputString to outputString & currentChar
		end if
	end repeat
	return outputString
end removeCharacters

Kike.

Basically the menu item's value gets updated whenever you drop a file onto it. It will stay on that value unless you drop another file or change the value manually.

However with v4.731 I have added a new action category: "actions executed on drop"

This would allow you to execute your script only in the "on drop" case and have another action to just open mail in the standard trigger case.

1 Like