Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Open Safari's WhereFrom URLs in the Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Open Safari's WhereFrom URLs in the Finder
Authored by: jonn8n on Jun 21, '05 12:29:10PM
Here's a version that can be saved as an application and will allow you to drag and drop files onto it or continue to use it as before (get the file to target from the current Finder selection):
on run
	try
		tell application "Finder" to set the_selection to item 1 of (get selection)
		open {the_selection}
	on error
		display dialog "Sorry, nothing is selected in the Finder. Please try again." ¬
			buttons {"OK"} default button 1 with icon 2 giving up after 5
	end try
end run

on open the_selection
	try
		set the_file to POSIX path of ((item 1 of the_selection) as alias)
		set the_info to (do shell script "mdls -name kMDItemWhereFroms " & quoted form of the_file)
		tell (a reference to my text item delimiters)
			set {old_tid, contents} to {contents, "\""}
			set {the_URLs, contents} to {{the_info's text item 2, the_info's text item 4}, old_tid}
		end tell
		set this_URL to (choose from list the_URLs ¬
			with prompt "The selected file is linked to the following URLs. Select a URL to open:") as Unicode text
		if this_URL = "false" then return
		open location this_URL
	on error
		display dialog "Sorry, no \"Where From\" URLs were found." ¬
			buttons {"OK"} default button 1 with icon 2 giving up after 5
	end try
end open
Jon

PS Rob, don't save this as Run Only, that only means you can never edit it again. Disabling the Startup Screen option is all you need to do to get it to run unobtrusively.

[ Reply to This | # ]
10.4: Open Safari's WhereFrom URLs in the Finder
Authored by: Twist on Jun 21, '05 02:13:31PM

Great job.

I suggest sticking this script into an Automator Workflow so that it can be used with the Automator Contextual Menu item.



[ Reply to This | # ]
10.4: Open Safari's WhereFrom URLs in the Finder
Authored by: mark hunte on Jun 21, '05 02:24:49PM

if you want to save it as an run only app do it as a run only - application bundle -

you can always open the package and edit the script from there.

whereFrom.app/Contents/Resources/Scripts/main.scpt



---
mh



[ Reply to This | # ]
10.4: Open Safari's WhereFrom URLs in the Finder
Authored by: sjk on Jun 22, '05 07:59:44PM

Thanks, Jon! How hard would it be to modify for handing multiple selections of files?



[ Reply to This | # ]
10.4: Open Safari's WhereFrom URLs in the Finder
Authored by: ever on Jun 24, '05 10:12:08PM

Wow, what an elegant rewrite! Thank you.



[ Reply to This | # ]