On Tue, Aug 30, 2011 at 11:33, wlampkin <[email protected]> wrote: > What used to take three keystrokes — cmd-a, then cmd-v (to paste in a > URL) and return — now requires nine steps — cmd-a, select "href", tab, > cmd-v, tab, select "target", tab, type _blank (or start to), finally > return. It's a major pain when you're adding a lot of external > anchors. >
I've never used the markup tags but use Applescripts all the time for this kind of thing. I'm no Applescript expert and others on this list may shudder, but I use the following to make links. I could set a keystroke to run this but actually just choose it from the Scripts menu. [No guarantees - check what it does for your links.] You could easily add to the script to create a title attribute, target etc. ================ -- This script simply uses an URL on the clipboard to create a smart link out of selected text. -- Copy an URL like www.google.com or http://www.google.com -- Select any text -- or an email address like [email protected] -- and then run the script. -- by Miraz Jordan, http://knowit.co.nz -- use at your own risk tell application "BBEdit" -- set variables set link_text to "" -- copy clipboard to the_url -- set the static bits of code set h_ref to "<a href=\"" set last_bracket to "\">" set close_tag to "</a>" set mail_to to "mailto:" tell front window -- make sure the user has selected some text if selection is "" then say "Oops, you need to select some text." return else -- we have those so now we build the link set selection to h_ref & (the clipboard) & last_bracket & selection & close_tag -- clean up -- lose a trailing slash on the link text replace "/</a>" using "</a>" -- delete an http:// on link text replace ">http://" using ">" -- add an http:// to the link if necessary replace "href=\"www" using "href=\"http://www" -- add a mailto: to the link if necessary replace "href=\"([[:print:]]+)@" using "href=\"mailto:\\1@" options {search mode:grep} -- if the mailto: was somehow duplicated undupe it replace "mailto:mailto:" using "mailto:" options {search mode:literal} say "Here's your link." end if -- end make sure the user has selected some text end tell end tell ================ Cheers, Miraz -- MacTip #500: How to put a message on the Lion login screen http://mactips.info/2011/08/how-to-put-a-message-on-the-lion-login-screen KnowIT: What is 'smart' technology? - http://knowit.co.nz/2011/08/what-is-smart-technology Tech Universe at NZ Herald: http://bit.ly/bGX7UY -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
