PopClip Snippet Extension for Devonthink Annotation / Add Quote

Those who use Devonthink may find this to be of interest - simple but very useful if you use Annotations in Devonthink:

1 Like

Hello @nick

I am trying to modify this to execute two key sequences so that I can highlight the text before creating a quote. Why do I get an Invalid YAML error here?

# popclip
name: Devonthink Quotes
icon: square DQ
 javascript: |
    popclip.pressKey('L', util.constant.MODIFIER_SHIFT|util.constant.MODIFIER_CTRL)
    popclip.pressKey('Q',  util.constant.MODIFIER_CTRL|util.constant.MODIFIER_COMMAND|util.constant.MODIFIER_SHIFT)
required apps: [com.devon-technologies.think3]
#end

It’s most likely the two spaces indent before the word javascript. Is should be on the same indentation as it sibling keys.

YAML is very sensitive to leading white space.

Many thanks

That was it- plus CONTROL needs to be spelled fully

This works:

# popclip
name: Devonthink Quotes
icon: square DQ
javascript: |
    popclip.pressKey('L', util.constant.MODIFIER_SHIFT|util.constant.MODIFIER_COMMAND)
    popclip.pressKey('Q',  util.constant.MODIFIER_CONTROL|util.constant.MODIFIER_COMMAND|util.constant.MODIFIER_SHIFT)
required apps: [com.devon-technologies.think3]
#end
2 Likes

@rkaplan, you may be interested to know that in PopClip 2022.5 the above snippet can now be rewritten as:

# popclip
name: Devonthink Quotes
icon: square DQ
key combos: [command shift L, control command shift Q]
required apps: [com.devon-technologies.think3]

or staying in JS, the same syntax can now be used:

# popclip
name: Devonthink Quotes
icon: square DQ
javascript: |
    popclip.pressKey('command shift L')
    popclip.pressKey('control command shift Q')
required apps: [com.devon-technologies.think3]
2 Likes

Very nice - thank you for the follow-up @nick