Hi Brett,
I've been using TextExpander for some years, but only recently began to use it for more than vanilla snippets. Since I've recently began to use Markdown seriously, your scripts are highly welcome. Thanks!
Still, I've got a question on the "Markdown Link" script. Perhaps, it even useful to someone else.
I've spent some time trying to combine it with a family of simple AppleScripts to get Safari's URL, title, selected text with some formating into the clipboard. (what fun I had two weeks ago to find out how to get selected text from Safari...)
Before I mangle up the chars, I play safe and present it stripped-down without quotes:
set w to front window
set theTitle to name of w
set theURL to URL of document of w
set the clipboard to theURL & Quote & theTitle & Quote
end tell
The best I got to is to run the AppleScript with Apptivate (or some other minimalistic Launcher), then type the abbreviation for your script. Well, I'm down to 4 key strokes, but have to invoke the script separately.
Any hint how to get an Apple Script (using osascript, I guess) running inside the Ruby Script inside TextExpander would be highly appreciated.
I've had no luck with osascript, but this may be due to my (lack of) proper escaping talent. Just running the scripts in TextExpander as snippets didn't work either, but I can't tell what goes wrong inside TextExpander.
Since the AppleScript just fills the clipboard, there's no interaction with the outer script or TextExpander. I haven't been able to find any detailed info on Smile's site.
Thomas
Thanks for the snippets! Very creative. These TextExpander posts are great.
I ran into an issue using some of them with Ruby 1.9, but I got them working by changing the call to the Ruby interpreter to just #!/usr/bin/env ruby
and switching the syntax of the case statements so they use "then" instead of a colon and a newline. For example, from the Markdown reference list snippet:
name = case parts.length
when 1,2: parts[0]
else parts[1]
end
Becomes:
name = case parts.length
when 1,2 then parts[0]
else parts[1]
end
The hyphenation script is really useful for replacing spaces with dashes in file names on the fly. Thanks!
Sure thing! That's actually exactly why I originally wrote it :). I have one that removes punctuation at the same time, if you ever need shell-friendly filenames.
Would love that.
Today, I found another use case for the hyphenation script: fast editing permalink slugs. I have an insatiable need to fiddle with my blog post titles -- often right up until the time they go live. Sometimes I leave the slugs alone, but sometimes I have to edit them so it all makes sense (to me anyway).
Brett,
Here is one for you! Make a text expander that pulls the contacts name from address book to start an email.
Example:
I want to send an email to David.
1. I open mail
2. In To: I type David and it finds me in my address book.
3. I Type (expander short-cut) i don't know "hfn"
The result would be: Hello David,
I'm new to textexpander. Your tips really show what is possible. I decided to start off with a simple signature. I wanted to add small social media icons that would click through to my various pages (flickr, twitter, etc.). Is it possible to add a hyperlink to an image embedded in a snippet?
If I'm not mistaken, you should be able to link the images a rich text editor (like TextEdit in Rich Text mode) and copy them into a rich text snippet in TextExpander. Just insert the image into TextEdit, select it, and type ⌘K to bring up the link dialog. Set the link, select all and copy it into TextExpander. I just tested it and then used the snippet in an email to myself and the link works like a charm.