I'm trying to work out if KBM can do this via a macro, or whether I'd have to go into apple script (yet another learning curve) LOL.
Typically I'd like to assign a hot key (say cmd S) which would work with Apple Notes to:
Activate the Notes app if it is closed
Open a specific note with the heading of '~Scratchpad~'
If the '~Scratchpad~' note was opened then send it to the background.
Basically it'd operate to flip / flop the visibility of that singe note on the desktop.
This is with KBM v9.1 and Big Sur 11.0.1.
Hopefully this should be my last question for a while.
I've gotten as far as opening the Notes app and placing it on the right note with:
tell application "Notes"
show note "~Scratchpad~"
end tell
And using Select Menu in Front Application then Menu Title 'Window' Menu Item 'Float Selected Note'
More progress Apple script added to size / position the note:
tell application "Notes" to set the bounds of the front window to {2900, 80, 3300, 800}
So the bits left to work out are:
Close the main notes app itself leaving the desired note open
Close the note if it is already open when the hotkey is hit.
DMB Execute Notes, Scratchpad 3.kmmacros (3.9 KB)
I've now got as the macro working after a lot of DuckDuckGo'ing and playing around. I've a feeling though that this is not that elegant and likely not the best way of doing things. It still only achieves the opening of the single note.
A question on the macro. How on earth do you enter a comment box at the top of the macro? I can't see that option in the Editor?
Also looking to work out how to abort the macro if the note is already open. (I've given up on sending the note to the background)
A working macro is leagues better than a non-existent or non-working elegant macro.
But – for the exercise – let's try for more efficient anyway.
The AppleScript below does everything your macro does in one fell swoop.
I'll let you decide if it's elegant or not.
-Chris
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2020/12/04 13:07
# dMod: 2020/12/04 13:07
# Appl: Notes, System Events
# Task: Open and Float a Specific Note
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Notes, @System_Events, @Open, @Float
# Reqs: Requires Mojave or later.
# Vers: 1.00
--------------------------------------------------------
property noteName : "Blood Pressure Log"
--------------------------------------------------------
tell application "Notes"
set theNote to first note whose name is noteName
show theNote
my floatNote()
close (windows whose name is not noteName)
set bounds of window noteName to {720, 23, 1440, 900}
end tell
--------------------------------------------------------
--» HANDLERS
--------------------------------------------------------
on floatNote()
tell application "System Events"
tell application process "Notes"
tell menu bar 1
tell menu bar item "Window"
tell menu 1
tell menu item "Float Selected Note"
perform action "AXPress"
end tell
end tell
end tell
end tell
end tell
end tell
end floatNote
--------------------------------------------------------
Although the 'linking to note' is already handled, I'll add a great tip I just picked up for future readers doing similar things. You can generate a unique URL for a note by sharing it. You don't have to actually send the sharing link to anyone, but you can then open it anywhere that takes a URL.
I use it to create links between notes - which makes notes.app way more powerful for me. (You can right-click on any link in notes to change its displayed name & hide the long URL.)
(as an aside, does anyone know a quicker way to get a sharing URL? the sharing dialog makes you send it somewhere, so i just send to myself)
here's a macro to open a note I just made, via its sharing URL.
I wasn’t accurate there. I put together a script that simply allows me to hot key into a specific note. Unsure if that would be helpful or not. If so, I’ll add to the thread.
Here is what I use. The move and clicks use the "float this note in separate window" functionality. Works Great. You can download the macro below, and put in your own Note name. Also note for some reason I could note get the Float Window to function using a shortcut key and resorted to using move and click. Depending on your resolution, this may need tweaking on your side. Good luck! let me know if you can improve this.
Thanks Avi. I'm really interested in this idea, but I can't get it to. work. My Notes don't share via email, that option is not in the list, and the options that are available just sent the text content of the note, not link to the dynamic note content.
Was there some other setup that you did to make this work? Which OS version? I'm on Mojave and I suspect that's the issue.
AH HA! It's not the Share menu. (Here's from the Notes Help:)
It's the Add People option.
I can click that button and, instead of sending email, there's an option to "Copy Link". I click that and I can paste the link directly into another note.