Extracting scripts from forum posts

Cool! WAY COOL! Way, way cool!

UPDATE: Some problems surfaced over the weekend with code blocks containing " characters. These issues should now be resolved.

I’ve noticed that sometimes when I post appleScripts the script is formatted in it’s own box, but the “Open in Script Debugger” link is missing.

Is there some trick to get the formatting and the link?

Hey Ed,

The best way is to use a named-code-block like this:

```applescript
tell application "Finder"
   set finderSelectionList to selection as alias list
end tell
```

I believe Mark has set the default for the 3-backtick fence to AppleScript, but it’s better to be explicit in my opinion.

Discourse displays tabs pretty wide, so I have a script that takes an AppleScript on the clipboard and changes each leading tab into 3 spaces for a more comfortably compact display. The formatting script then brackets the object-script with the AppleScript-code-fence and pastes it into Safari.

I have the script bound to a keyboard shortcut using Keyboard Maestro, and have variants for Mail and BBEdit.

It saves me a lot of time and effort.

-Chris

Thanks, Chris, that did the trick!