Can you help me find/write an AppleScript to increase/decrease the quote level of selected text?
January 21, 2010 2:52 PM   Subscribe

I'd like an ApplesScript that will let me increase or decrease the quote level of text that I've selected (like using ⌘' and ⌥⌘' in Mail).

Ideally it would take a block of text and wrap it to a certain width, and indent it with > characters prepended. It would be useful in Gmail and in MarsEdit when trying to make a pretty Markdown-formatted blockquote.

The idea would be if I had typed:

The quick brown fox jumped over the lazy dog.

I'd select it, invoke the script, and it would give me:

> The quick brown fox jumped
> over the lazy dog.

(Though I'd likely set the width to be wider.)

TextWrangler and BBEdit both have this feature, as well as Mail, but I'd like to be able to have it as a script so I can use it in any application.

I found a tip here that seems to be what I'm talking about, but I can't seem to get it to work.
posted by davextreme to Computers & Internet (4 answers total)
The scripts in the linked tip seemed to work just fine for me on 10.6.2. What goes wrong for you?
posted by floam at 3:22 PM on January 21, 2010

(Although they're by no means awesome. I'd prefer a Service, I think, that showed up in the context menu when text was highlighted, not some script I had to use in the scripts menu that worked on the clipboard.)
posted by floam at 3:23 PM on January 21, 2010

After a bit of fiddling, I got those scripts to work, but, you're right, they're not awesome. For one, they take over the clipboard, and you have to the text in the clipboard to start with, not just selected.

I'd still prefer an Applescript that behaves just like Mail's command does: you select the text, invoke the script, and it reformats the text (without messing up what's in your clipboard).
posted by davextreme at 4:16 PM on January 21, 2010

OK, I've put together two services for you:

Extract the zip file so that both of the .service files end up in ~/Library/Services. Then go into (assuming 10.6) the application menu, Services, and choose Services Preferences, and check the boxes for Increase Quote Level and Decrease Quote Level. You'll then probably want to assign ⌘' and ⌥⌘' to them, or maybe some other combination to avoid conflicts (not sure if Mail will like it or not).

Should work on the selected text, let me know if you run into any problems.
posted by floam at 7:23 PM on January 21, 2010 [1 favorite]

« Older Best place for Avatar in PDX   |   Help me help my dog... Newer »
This thread is closed to new comments.