| name | notes_pin |
| description | Pin or unpin a Notes note (by exact title match). Uses UI menu
navigation because macOS 14+ removed the AppleScript `pinned`
property — direct `set pinned of note to true` errors with
"Can't make pinned of note ... into type specifier".
This skill activates Notes, selects the target note, then clicks
the appropriate File-menu item ("Pin Note" or "Unpin Note"). The
menu item label automatically toggles based on current state, so
the skill checks which one exists and clicks the right one for
the requested target state.
|
| command | ["sh","-c","NOTE=\"$1\"; STATE=\"$2\"\n[ -z \"$NOTE\" ] && { echo \"note title required\" >&2; exit 1; }\n[ -z \"$STATE\" ] && STATE=\"true\"\ncase \"$STATE\" in\n true|pin|pinned|1) WANT=\"pin\" ;;\n false|unpin|unpinned|0) WANT=\"unpin\" ;;\n *) echo \"state must be true|false\" >&2; exit 1 ;;\nesac\n\nosascript 2>&1 <<APPLE\ntell application \"Notes\"\n activate\n try\n show (first note whose name = \"$NOTE\")\n on error\n return \"ERR: note not found\"\n end try\nend tell\ndelay 0.8\n\nset didAct to false\nset targetState to \"$WANT\"\ntell application \"System Events\"\n tell process \"Notes\"\n try\n set fileMenu to menu \"File\" of menu bar 1\n if targetState is \"pin\" then\n if exists (menu item \"Pin Note\" of fileMenu) and ¬\n (enabled of menu item \"Pin Note\" of fileMenu) then\n click menu item \"Pin Note\" of fileMenu\n set didAct to true\n else if exists (menu item \"Unpin Note\" of fileMenu) then\n -- already pinned: idempotent success\n set didAct to true\n end if\n else\n if exists (menu item \"Unpin Note\" of fileMenu) and ¬\n (enabled of menu item \"Unpin Note\" of fileMenu) then\n click menu item \"Unpin Note\" of fileMenu\n set didAct to true\n else if exists (menu item \"Pin Note\" of fileMenu) then\n -- already unpinned: idempotent success\n set didAct to true\n end if\n end if\n on error e\n return \"ERR_MENU: \" & e\n end try\n end tell\nend tell\ndelay 0.3\nif didAct then\n return \"ok: \" & targetState\nend if\nreturn \"ERR: menu item not found\"\nAPPLE\n","_"] |
| args | ["{{note}}","{{state}}"] |
| schema | {"note":{"type":"string","description":"Exact note title","required":true},"state":{"type":"string","description":"true (pin) or false (unpin). Defaults to true.","required":false,"default":"true"}} |
| timeout | 20 |
notes_pin — pin / unpin a Notes note via File menu
macOS 14+ removed AppleScript's pinned property. The only reliable
way to set pin state is the File menu's "Pin Note" / "Unpin Note"
item, which Notes shows toggled based on current state.
This skill:
- Activates Notes + selects the note (by exact name match)
- Looks for "Pin Note" or "Unpin Note" in the File menu
- Clicks the right one for the requested target state
- Idempotent — if already in the desired state, returns success without re-clicking
Examples
notes_pin note="KinBench Pinned 164" state=true
→ ok: pin
notes_pin note="KinBench Unpin 165" state=false
→ ok: unpin
Note: pin state remains unverifiable via AppleScript on macOS 14+, so
this skill cannot self-verify. The skill returns ok based on
"correct menu item was clicked" — the caller's eval should confirm
via UI inspection or trust the action.