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


Click here to return to the 'Create cross-platform URL shortcut files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create cross-platform URL shortcut files
Authored by: ecco on Jan 22, '04 01:05:55PM
This script creates an URL shortcut on your desktop. Put it in your Safari scripts folder ~/Library/Scripts/Applications/Safari and launch it from the script menu.

try
	tell application "Safari"
		activate
		set theURL to URL of (document of window 1)
		set theTitle to name of window 1
	end tell
	set theTitle to first word of theTitle
	set res to "[InternetShortcut]
URL=" & theURL
	
	do shell script "echo \"" & res & "\" > ~/Desktop/" & theTitle & ".url"
on error x
	activate me
	display dialog x
end try



[ Reply to This | # ]
Create cross-platform URL shortcut files
Authored by: jrybolt on Jan 22, '04 05:39:21PM
Just a refinement of the above script to rename the end file to the whole title of the page. It seems to work fine, however I am testing it to make it a little more error proof. Here is the start.

try
	tell application "Safari"
		activate
		set theURL to URL of (document of window 1)
		set theTitle to name of window 1
	end tell
	set theTitleLong to theTitle & ".url" as string
	set theTitleShort to first word of theTitle & ".url"
	set res to "[InternetShortcut] URL=" & theURL
	do shell script "echo \"" & res & "\" > ~/Desktop/" & theTitleShort
	set theTitleShort to theTitleShort as string
	set the source_folder to path to desktop folder as string
	set this_item to (source_folder & theTitleShort) as alias
	tell application "Finder"
		set the name of this_item to theTitleLong
	end tell
on error x
	activate me
	display dialog x
end try
Hope this helps someone
btw great idea.

[ Reply to This | # ]