launchbar:A script that returns the path a folder that's dropped on it

SOLVED:


on open (thisItem)
    display dialog (thisItem as text) -- alias
    display dialog quoted form of POSIX path of thisItem -- POSIX path
end open

http://apple.stackexchange.com/a/41890/19358

I want to make a launchbar script that displays in a dialog the path of a file or folder that’s chosen in the first pane. (This is obviously not too useful in and of itself, I’m just trying to make the feature work so I can use it in more complicated scripts.)

Link to launchbar documentation on applescript: http://www.obdev.at/resources/launchbar/help/RunningAppleScripts.html

I’ve got a couple of working scripts that almost do what I want:

Return contents of first pane (used with a shortcut):

tell application "LaunchBar"
	set x to selection as text
	return x
end tell

Display text written in the first pane and “dropped” on the script:

on handle_string(textFromLaunchbar)
	tell application "LaunchBar"
		display in large type textFromLaunchbar
	end tell
end handle_string

The latter uses the handle_string() handler but I can’t quite make the open() handler work for files and folders:

(http://www.obdev.at/resources/launchbar/help/SendingItems.html)

on open (fileFromLaunchbar)
	tell application "LaunchBar"
		set thePath to path of fileFromLaunchbar
		display dialog thePath
	end tell
end open

How can I make this work?

I hope it’s not a huge faux pas to bump your questions, does anyone have any idea how this could be done?