![]() ![]() ![]() When the snippet expands the clipboard content is automatically placed wherever "%clipboard" appears. that you can use "%clipboard" as a variable in your snippets. Today on the SmileOnMyMac Blog, I ran across a great tip I hadn't previously known about TextExpander (RTFM), viz. "sig" becomes a several line email signature). For instance, I have "bc" set to expand to "because." However, the pasted text can be much longer (e.g. TextExpander is a "snippet" utility that will automatically paste in content based on user defined abbreviations. (But you’ll have more fun if you do.Along with Quicksilver, TextExpander is one of my must-have Mac utilities. There is so much repetition in business writing, especially correspondence, you’ll get your money’s worth from TextExpander even if you never exercise the AppleScript parts. I should mention that despite my love of script-driven snippets, David and Katie are exactly right when they say that TextExpander’s greatest value comes from simple, text-only snippets. What would be really nice is if these could be put into a popup menu, but TextExpander doesn’t allow that much magic yet. Those could be nested just like furl: (%snippet: 1url%) I have snippets that will get the URLs of the first through the sixth tabs (counting left to right) of the frontmost Safari or Chrome window. Similar snippets can use the URLs of other tabs. Maybe you don’t want to link to the current tab. All you need to type is the abbreviation and the link text. No context shifting, no fiddling with the clipboard, and a clean fill-in interface. When this is invoked, you see a much cleaner interface with the desired URL already in place: Where the thing in the parentheses is a call to my furl snippet. The content of this snippet is (%snippet: furl%) The best way to use a fill-in for the link text is this way: If you look through the popup menu that shows the TextExpander variables you can embed in a snippet, you’ll notice that all of your previously defined snippets are available, which means you can nest one snippet inside another. Unfortunately, TextExpander shows you the whole script while you’re doing the fill-in: Which would use a single-line TextExpander fill-in to get the link text. In fact, that last line could be written this way, applescript:ġ8: get "(" & fURL & ")" Not only can you use it to run scripts, but the output of those scripts will then be interpreted as TextExpander variables. This, by the way, is why TextExpander is such a great tool. No context shifting, no fiddling with the clipboard. So this snippet gets the URL, creates the Markdown inline link and positions the cursor right where you want it to type the link text. This is the TextExpander code for “put the cursor here after the expansion,” which is exactly what happens when this snippet is run. The cool part, though, is the %| inside the brackets. Where what’s inside the parentheses is the URL of the current page. It returns a string that looks something like this () These lines were stolen directly from my trusty furl snippet, whose history can be traced back to this old AppleScript I used to invoke through Quicksilver. Lines 1-16 get the URL of the current page in either Safari or Chrome. With a little AppleScript, all he’d need is Step 5.Īnd here’s the AppleScript it uses: applescript:Ģ: set numSafari to count (every process whose name is "Safari")ģ: set numChrome to count (every process whose name is "Google Chrome")ħ: tell application "Safari" to set fURL to URL of front documentġ1: set frontIndex to active tab index of front windowġ2: set fURL to URL of tab frontIndex of front window He saves a little time by keeping the ⌘ key pressed through some of the steps, but there’s still too much context shifting and too many repeated keystrokes. Invokes his snippet by typing its abbreviation.Switches to his text editor with ⌘-Tab again.Selects the URL of the current page with ⌘L.Switches to Safari, presumably through ⌘-Tab.The snippet uses the Mac clipboard to paste a URL into the proper spot in a Markdown link structure. Let me demonstrate by explaining why I think David’s Markdown link snippet could use some improvement. Still, as Marvin and Tammi say, ain’t nothing like the real thing, baby. Normally, I have to be present to demonstrate my dickishness, but David and Katie have dealt with me enough to limn my essence without me. This was surprising only inasmuch as I wasn’t on the show. I listened to the Mac Power Users TextExpander episode today and noticed that I come off as a bit of a dick, always correcting others. Next post Previous post Quicker Markdown linking with TextExpander ![]()
0 Comments
Leave a Reply. |