Paste preset html code via Applescript into text edit

Solution 1:

Create a 'service' in Automator.

Give it the following settings: Service receives 'no input' in 'any application' Check 'Output replaces selected text'

Add the following 'Actions' Get Specified Text - insert your clip here Copy to Clipboard Run AppleScript - replace the (* your script *) with 'the clipboard'

Click the 'Run' button to test the workflow. If there are no issues here, save the service.

To test whether the service works, put the cursor in a text doc of some sort (any place that you can paste multi-line text) and right-click… you should see the service's name in the menu. Click it and see what happens. Hopefully, it will paste your clipping into the text area which the cursor is in.

If it works well, go to the System Preferences > Keyboard > Shortcuts and click Services. Scroll through the resulting list on the right to find the name of your newly created service (should be in the Text section). Give it a keyboard shortcut (hopefully one that doesn't conflict with any other), and you're done.

So what does the service do? You specify the text for the clipping, it copies that to the clipboard. The applescript pastes the clipboard wherever you trigger the service.

As an aside, you don't mention what text editor you're using which might make it easier to devise a solution. BBedit was mentioned in the comments but the are other apps such as Coda that also offer some variation of a clippings feature. And as a further aside, I am unable to include a screenshot with my post.