MACRO: Float Specified Notes, v3.3

Users of Apple Notes might find this macro also useful: New Apple Note

I've updated the OP with Version 2.3 of Float Specified Apple Notes.

Modified to accommodate macOS Ventura (v13.x). In this version the Notes app menu item Window>Float Selected Note was changed to Window>Open Note in New Window.

1 Like

Hey Jim, glad to see you're continuously updating and posting your macro. I've modified my personal copy so much now that I'm afraid to download your updated ones because I would have to tinker with it to get back to how mine currently works. :sweat_smile:

But one of these days when I am able to again spend more time with my macros like before I'm going to download the latest version and check out all the cool updates!

1 Like

I've updated the OP with Version 3.0 of Float Specified Apple Notes.

Added two settings to optimize macro behavior when using multiple Mission Control Desktop Spaces:

  • local_MultipleDesktopSpaces, and
  • local_AlwaysPreventSpaceChanges.
1 Like

I've updated the OP with Version 3.2 of Float Specified Apple Notes:

  • Centers the Notes is running dialog and added information for those that do not use multiple Desktop Spaces.

  • When positioning floated windows, existing Apple Notes windows are counted. For example, if two Notes windows are already open when the macro is triggered, the first window opened by this macro will be in positioned as if it is the third window (per the SETTING : local_MultipleDesktopSpaces).

  • If the windows exceed the positions defined, the positions will be reused.

  • updated TESTED WITH section.

I've updated the OP with Version 3.2 of Float Specified Notes:

  • Changed the name from Float Specified Apple Notes to Float Specified Notes.

  • Improved the Notes is running dialog.


1 Like

Hi Jim, I'm having trouble understanding the syntax info and wondering if you could possibly give me some guidance on specifying a note I'd like to float. All my notes are iCloud notes with my iCloud account listed at the top of the left column. So the left column reads:

"All @mac.com"
"Notes"

When I select "Notes," pinned at the top of the notes column is "TO DO LIST" which is what I'd like to float. Where/how do I fill in that info in the appropriate fields?

Hi, @AppleTooPlus; welcome to the Keyboard Maestro forum.

When I see someone new to the forum, I like to share a few links that are helpful:

Looks like you haven't created any folders in the Notes app (File > New Folder). That's not a problem, but something you might find helpful if/when you accumulate a lot of notes.

The note folder specification is actually optional. If you had hundreds of notes, retrieval might be slightly faster if you specified the folder.

For your case, if you want the note to always float when the macro is triggered, then specify the following:

Keyboard Maestro Export

The $> is an indication that the note should be always floated. (It's actually optional if local_Favorite_Folders_Titles includes only one entry.)

Note also, that the specified text should be the entire first line, or a substring of the first line, of the desired note. The match is case insensitive.


The macro is designed to provide additional options. For example, with:

Keyboard Maestro Export

When the macro is triggered, Scratch Note would be immediately floated, and the other two notes would appear in a Prompt With List (PWL) menu. If one of them was subsequently selected, that note would also be floated.


There are a few other features. For example, with:

Keyboard Maestro Export

  • If the hot key trigger did not include 1 or 2, Scratch Note would be floated, and the three other notes would appear in a PWL menu.

  • If the hot key trigger did include a 1, Scratch Note would be floated. The other three notes would not appear in a PWL menu.

  • If the hot key trigger did include a 2, TO DO LIST would be floated. The other three notes would not appear in a PWL menu.

1 Like

Appreciate the info, Jim! I actually have an extensive list of note folders and subfolders but didn't include examples which may have been a little confusing.

I tried entering "$>TO DO LIST" string in the SETTINGS (Notes) box:

--but upon running the macro, 2 things happen: 1) the Notes app appears invisible when opened by the macro (see below - I assume this is as is should be as part of the 'floating' function)...

...and 2) the "TO DO LIST" note is not selected when I make Notes visible, nor is that note floated. I tried other titles from other notes, but none of them select or float a note. Any suggestions?

Very odd, I've never seen anything like that.

The second screenshot is actually the Mission Control. Might you have a conflict between that macOS keyboard shortcut and the macro trigger?

I'd try the following:

  1. Restart your Mac.

  2. Initiate the macro from the Keyboard Maestro editor, not using a keyboard trigger.

  3. Initiate the macro with and without the Notes app already running.

  4. Maybe delete your copy of the macro, and download and install it again.

It certainly seems that there is some conflict occurring. Please try these things and report back.

The Mission Control window I was just showing to demonstrate the presence of the Notes app being open (but invisible). I've only been initiating the macro in KM (without the use of keyboard triggers).

I deleted and reinstalled 3.3 of the macro, then tried restarting and initiating again from KM (with no other applications running). After I did this, nothing happened. When I go into the app switcher, the notes app is faded. When I click on the Notes app, it shows up with whatever note I had last selected (not the TO DO LIST).

If it helps, I'm running Sonoma 14.2.1 on a MBP 16" M1 Max. Very mysterious! Any other ideas? I assume that in running the macro with the string entered, the note "TO DO LIST" should simply pop up somewhere on the screen?

Thanks for that information. Coincidentally, I have the same hardware and macOS. I'm using Keyboard Maestro v11.0.2.

Yes, this is indeed odd. I suspect that you are encountering some sort of privilege issue with Keyboard Maestro controlling the Notes app via AppleScript.

I've got three test macros for you to try.

Before triggering Notes Test 1, quit the Notes app. When you run the macro, the Notes app should open.


Download: Notes Test 1.kmmacros (1.7 KB)

Macro-Image


Before running the next two macros:

  1. Open the Notes app and select any note except TO DO LIST.
  2. Quit the Notes app.

When running Notes Test 2 and Notes Test 3, the Notes app should open and TO DO LIST should be selected. Notes Test 3 more closely represents the AppleScript within Float Specified Notes.


Download: Notes Test 2.kmmacros (1.9 KB)

Macro-Image


Download: Notes Test 3.kmmacros (5.0 KB)

Macro-Image


Correct. With the Float Specified Notes you should see this...

TO DO LIST

I tested out each of the macros as specified.

Notes Test 1 worked as described -- it opened Notes.

Notes Test 2 opened Notes but then failed to choose a note with "TO DO LIST". I selected a different note and double-checked to make sure there were no extraneous spaces or characters in the "TO DO LIST" title. I also tried subbing titles of other notes but alas nothing. No matter what I put in, when Notes opens, the note that was last selected before closing the app remains selected.

Notes Test 3 -- same result as 2 except that the Notes app icon remains faded and the app window invisible until actively selected.

"TO DO LIST" is pinned. I tried un-pinning it to see if it would make a difference (it did not.)

Here's a screen capture of the top of my folder column if helpful:

Screenshot 2024-01-01 at 3.16.49 PM

Note that I am also using KM 11.0.2.

Hum, Notes Test 2 is a very simple:

tell application "Notes"
	activate
	tell (get every note whose name contains "TO DO LIST")
		set theNote to its first item
		show theNote -- also selects the note
	end tell
end tell

I suggest inserting that script is the macOS Script Editor and run the script.

If that doesn't select TO DO LIST, then I'm stumped. Please try it and report back.

Inserting that script into Script Editor worked! When I ran the script, it opened Notes and then selected TO DO LIST.

You inspired me to try a bit of troubleshooting. I created a fresh new user on my MBP, synced my iCloud Notes with that user, and tried the full macro with the "TO DO LIST" string. Worked perfectly.

I went back to my regular MBP user account and tried the following:

  1. booted in safe mode - No luck.
  2. uninstalled KMMaestro and all supporting files in Library/Application Support, then reinstalled and installed just the Float Apple Notes macro. - No luck.
  3. reset Mac keyboard shortcuts to the default settings in case of conflicts. - No luck.

So incredibly odd! Any thought what sort of application that Safe mode wouldn't disable that could be causing a conflict?

Nice troubleshooting steps. Good to hear!

Again, good troubleshooting. That eliminates many possible culprits.

It is, but now I'm more confident it's a Keyboard Maestro /AppleScript/Notes privilege issue. The Keyboard Maestro Developer, @peternlewis, might be able to help.

Peter, why would this AppleScript work in the Script Editor, but not in a Execute an AppleScript action?

tell application "Notes"
	activate
	tell (get every note whose name contains "TO DO LIST")
		set theNote to its first item
		show theNote -- also selects the note
	end tell
end tell

Beats me, it worked fine for me in Ventura when I just tried it - it asked for permission to control Notes, and then selected the specified note (I changed it to a title I had).

So you'll need Automation permission for Notes, but other than that it worked fine in my test.

It could depend on the kind of note, or the macOS version or some other issue, but I would need more information about when the failure happens and if it happens for other people before being able to suggest anything further.

Obviously, as with any Execute AppleScript failure, turn on include errors and display the results in a window so you can see what is being reported.

1 Like

Thanks, @peternlewis!

Ah, I bet that's the problem. @AppleTooPlus, use System Settings > Privacy & Security > Automation > Keyboard Maestro and check that the Notes switch is on.

If it's currently off, turn it on. If it's on, turn it off and then back on.

Thanks! I assumed that Engine.log wouldn't have anything since @AppleTooPlus didn't mention that, but maybe notifications were also suppressed (e.g., with Do Not Disturb or some other Focus Mode).

@AppleTooPlus, if Engine.log errors do exist, you'd see something like this:

Aside: With respect to the Engine.log, you might find this macro useful: Engine.log Tool

@_jims That was it! The Notes switch was 'off' under those settings. Turned it on and voila. Incredible. Thank you so much for persevering on this and for your fabulous macro! And shout out to @peternlewis for your brilliant app and for helping solve the mystery. Best tech support forum ever.

3 Likes

Great to hear. Thanks for the update.

Yes, thank you @peternlewis!


@AppleTooPlus, I've shared another Notes app macro; you might find it useful: Note Picker