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


Click here to return to the 'Slightly improved ...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Slightly improved ...
Authored by: Gnarlodious on Mar 07, '05 07:00:43PM
Thanks for a great idea! But it did not work here (10.3.7), I had to remove the part about the record and ktxt. I also added " target='_new'" to force the page to open in a new window/tab AND replaced the doublequotes with singlequotes (as they need no escaping):
 
set targetApp to (path to frontmost application as Unicode text)
tell application targetApp to activate
tell application "System Events"
	tell process targetApp
		keystroke "x" using {command down}
		keystroke "<a href='"
		keystroke (the clipboard)
		keystroke "' target='_new'>"
		keystroke "v" using {command down}
		keystroke "</a>"
	end tell
end tell
-- Gnarlie's Applescript page (Link pasted with the above script!)

[ # ]
I wish I knew!
Authored by: sinjin on Mar 08, '05 01:49:31AM
Thanks for the improvements! They didn't work for me exactly as you posted since the link text ends up overwriting the URL in the clipboard, but I was able to fix that with your example.

I wish I knew to do it your way before I submitted. That line where I coerced the clipboard's contents into a variable took forever and a day to figure out! I swear I tried the more obvious approach you used, but kept getting some stupid NS error or something. Works now, though. :)

The new target window is a nice touch, too.

Here are my new HTML and vB versions of the script (should pop open in Script Editor).

[ # ]