Here’s an extension snippet that searches (new) Evernote for a string.
It’s useful, since Evernote doesn’t integrate with Spotlight. Took me a while to work it out, so I’m sharing it here.
-- #popclip
-- name: Evernote search
-- icon: search filled E
-- language: applescript
-- script:
tell application "Evernote"
activate -- Launch or bring Evernote to the front
end tell
delay 1 -- Allow time for Evernote to become active
tell application "System Events"
-- Bring Evernote's search field into focus
keystroke "f" using {command down, option down}
delay 0.2 -- Small delay to ensure the search field is ready
-- Clear the search field
keystroke "a" using {command down} -- Select all text in the search field
delay 0.5
key code 51 -- Simulates pressing the Delete key
-- Enter the new search term
keystroke "{popclip text}" -- Replace with your desired search term
key code 36 -- Simulates pressing the Return key
end tell