AppleScript to get link to current tab

Mitchell L Model MLMLists at Comcast.net
Fri Mar 3 22:53:31 PST 2006


Here's a simple script for getting an HTML "<a>" 
link to the active tab of the current browser 
(i.e., front window).  This is something II seem 
to end up writing  for each of the (many) 
browsers I use, with each providing access to the 
current tab of the current window, its address, 
and its title in a slightly different way.  This 
is the how it looks for OmniWeb.

tell application "OmniWeb"
	-- Puts an HTML link to the active tab of 
the front browser onto the clipboard
	-- Mitchell L Model, mlm,acm,org, 2006-03-04
	set the clipboard to my getLinkToActiveTab()
end tell

to getLinkToActiveTab()
	-- could use this handler in other ways 
too, so it's separate from the tell above
	tell application "OmniWeb" to ¬
		("<a href=\"" & ¬
			((the address of the front browser) as string) & ¬
			"\">" & ¬
			((the name of the front browser) as string) & ¬
			"</a>")
end getLinkToActiveTab


More information about the OmniWeb-l mailing list