How to create a script for Snippets App

Hi

I’ve just started using Hooks - and would like to have a go at creating an integration applescript for the app Snippets Lab.

Hooks does not ‘find’ an obvious method to link to a note within Snippets Lab app - however the app does actually have a method to link to a specific note.

The format of the link URL is this:
snippetslab://snippet/F5C63DFC-57AD-4447-97BB-39F994DEA2EE/

Sorry if I’ve missed a guide to writing applescripts - but if someone could point me in the right direction that would be great.

Thanks
James

The trick is to simulate from a Hook script (or something like Keyboard Maestro):

  • either the SnippetsLab > Editor > Copy Snippet menu choice
  • or the corresponding ⇧⌘C keystroke.

And then probably allow a slight pause, for the clipboard to digest the results.

( You will see similar routes in some of the Hook > Preferences > Scripts entries for other apps. For example, the Quiver entry is:

set the clipboard to ""
tell application "System Events" to tell process "Quiver"
    click menu item "Copy Note Link" of menu "Note" of menu bar 1
end tell
delay 0.1
get the clipboard as «class utf8»
1 Like

https://hookproductivity.com/help/integration/creating-integration-scripts/

1 Like

Ah … but I spoke too soon - forgive me

It looks as if that just copies the code in SnippetsLab and doesn’t get a UUID …

Copy Snippet Link in SnippetsLab is hidden in a contextual menu (Right-click on the snippet)

(Quiver lends itself more easily to scripting, I find)

@RobTrew Thanks for your input and sample Quiver script. Looks straight forward.
Yeah - I noticed the Copy Snippet Link is only accessible with a right click… bit annoying.
I’ll contact the author and see if I can get them to make it a menu item.
I use Quiver too, but I’ve got too many snippets in Snippets Lab to deal with.

When contacting them, please consider asking them to add the necessary scraping support — even very basic scripting makes an app a lot more powerful when used with other apps.

https://hookproductivity.com/help/integration/other-app-developers/