MACRO: New Note, v2.2

PURPOSE

This macro will create a new Apple Note and open it. The new note can be optionally floated and positioned.

Monterey includes an Apple Notes feature called Quick Note. Since this macro provides similar capability, its value is less obvious for Monterey (or later) users. However, if the Notes Preference Resume last Quick Note is checked, one could use the native Quick Note feature for an ongoing scratchpad and, in tandem, use this macro for collecting information that should be segregated from the Quick Note information.

When using multiple Mission Control Desktop Spaces, the behavior of the Notes app differs based on macOS version. With older versions of macOS (< local_macOSWithModernBehavior), if the active Notes window is open in another Desktop Space, and this macro is triggered, the new note is created in the current Desktop Space. If macOS is newer (>= local_macOSWithModernBehavior), then the new note is created in the same Desktop Space as the active window. For the modern macOS versions, see settings local_MultipleDesktopSpaces and local_AlwaysPreventSpaceChanges.


SETTINGS

local_FloatNewNote : 0|1
If set to 1, the new note will be displayed in a separate window; otherwise in the Notes main browser.

0 = no
1 = yes [default]

local_NotesFolder
The destination Notes folder for the new note. If the folder does not exist, it will be created.

:inbox_tray: 𝗜𝗻𝗯𝗼𝘅 [default]

local_FloatPositionAndSize : X Y W H
Four integers separated by spaces: top-left X position, top-left Y position, Width, Height (all in display percentages)

0 10 50 25 [default]

local_MultipleDesktopSpaces : 0|1
Three groups can change this setting to 0 and ignore the next setting, local_AlwaysPreventSpaceChanges:

  1. Those with macOS < local_macOSWithModernBehavior

  2. Those NOT using multiple Mission Control Desktop Spaces

  3. Those using multiple Desktop Spaces, but do not care if running this macro initiates a switch to another Desktop Space, i.e., the space where Notes is already running

1 [default]

Otherwise, those using macOS = local_macOSWithModernBehavior or newer, use multiple spaces, and want to avoid space changes when Notes is running in another space, can set this to 1.

1 [default]

local_AlwaysPreventSpaceChanges : 0|1
If set to 0 and a Desktop Space change could occur, a prompt will appear with two options: 1) Do Not Quit, and 2) Quit and Reopen. The latter, with the trade-off detailed in the dialog, will ensure that the new note opens is the current Desktop Space. If set to 1, a dialog will not be presented, but the Notes app will behave the same as if Quit and Reopen had been selected.

0 [default]


TESTED WITH

• Keyboard Maestro 10.2
• Ventura beta 13.2 (22D49)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445


VERSION HISTORY

Click to expand

1.0 - Initial version

1.1 - 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.2
a) Bug fix: Mistakenly had local_macOSWithFloatMenuItemRenamed in the outside If action; it has been corrected to local_macOSWithModernBehavior.
b) When floating a note on pre-Monterey, added two Forward Delete keystrokes as suggested by @August.

2.0
a) If macOS < local_macOSWithModernBehavior, when a new floated note is created, the first line is set to §Title. As the macro continues, this same string will be used in the actions. Once this window is made active and resized, the leading § will be removed. This is done to distinguish the new note from all existing notes that might have Title as the first line.
b) When local_FloatNewNote = 1, there are actions that bring the main notes browser to the foreground so that it can be minimized. This step would occasionally fail when the Manipulate a Window (Bring Application Window to Front) was used. This was changed to Select or Show a Menu Item.
c) Again when local_FloatNewNote = 1, immediately after the actions mentioned in b), added another Select or Show a Menu Item action to activate the new floated window. This was required to address the scenario when the active Notes window is open in another Mission Control Desktop Spaces, i.e., not the current Desktop Space (and macOS < local_macOSWithModernBehavior),
d) Added an action to ensure that the Notes app is View as List (macOS < local_macOSWithModernBehavior).
e) Added two settings to optimize macro behavior when macOS >= local_macOSWithModernBehavior: local_MultipleDesktopSpaces and local_AlwaysPreventSpaceChanges.

2.1 - Fixed a dialog typo.

2.2
a) Changed the name from New Apple Note to New Note.
b) Changed the name of the inbox from _INBOX to :inbox_tray: 𝗜𝗻𝗯𝗼𝘅.
c) Improved the Notes is running dialog.


Download: New Note.kmmacros (98 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.4.1 (22F82)
  • Keyboard Maestro v10.2

2 Likes

Users of Apple Notes might find this macro also useful: Float Specified Apple Notes

2 Likes

I've updated the OP with Version 1.1 of New Apple Note.

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

Thanks for this macro @_jims, it looks useful.

In initial tests, I notice that it closes the "main" Notes window and just leaves the floating notes, including the new one, whether or not the "main" Notes window was open in the first place. Over the long haul, I imagine that I might prefer to have the main Notes window remain in whatever state it had been. I presume you have to open it in order to make the new note (I haven't dug in under the hood yet).

Also, and this is by far the bigger annoyance to me, it appears to always make the new note floating in whatever Desktop the main Notes window happens to be in when I invoke the macro.

I can imagine workflows in which, while working on something, you want to save a note in your Notes INBOX to deal with later, in whatever Desktop it happens to be in (maybe even a dedicated Desktop for "inboxes" like that) and then return to what you are doing. Personally, I think (but don't yet know from experience) that I would more often rather have the new noted floating on whatever Desktop I was working on. I can do that if I close the main Notes window first. Then that window is temporarily opened in my current Desktop and then closed after the new note is floated.

Because your flow involves closing the main Notes window, whether or not it was originally open, maybe I could get what I wanted by closing the main Notes window first (via AppleScript, so it could be closed without having to change Desktops) and then opening it to create the new note. I think that could result in the new note floating in my current Desktop.

So that's going to require the AppleScript get a list of Notes widows titles and if any of them are titled "Notes", then close that window. (More steps than I have time for this afternoon because knowing what has to happen doesn't mean that I know how to get AS to do it, yet.)

Now that I'm thinking about that scenario, I imagine multiple subfolders of the INBOX, one for each Desktop, and the new notes would be created in those subfolders as well as being placed on the appropriate desktop. The Notes app is actually pretty good about maintaining previous Desktop positions through a reboot, but I don't know if it remembers through the app being closed, so saving new notes Desktop by Desktop might be useful in restoring the working arrangement if it gets lost for some reason.

And all of that is way more than your original goal for this macro, so please don't think that I am asking you to indulge my personal "Feeping Creatureism", I'm just brainstorming here with a hopefully like-minded explorer. What do you think? If I ever got around to building it, would you use it?

Hi, @August. You're welcome.

Yes, the macro minimizes that window. This was a design choice I made. But you could easily change it if you want.

That's how the Notes app works (even if the main photo window visible, minimized, or hidden). Again this was a design choice I made, but you could easily change that behavior by modifying the macro to first close the Notes app if it is open.

Easy to do; no AppleScript required.

Keyboard Maestro Export

yes, but...

You might want to check out another macro I've shared: Float Specified Apple Notes

1 Like

Um, No. That quits the entire Notes app, including any other floating windows, right? I want to only close the main Notes window and leave any other floating windows open. For that I think I need AppleScript to get a list of open Notes windows, but I could be wrong.

And I suppose Float Specified Apple Notes could be used to reopen the floating notes after the Notes app got closed and reopened, but that starts to seem complicated, as does getting all the floating notes back to their original Desktops. So simply quitting Notes does not work for my purposes.

Hi @_jims,

WRT the extra blank line before the Title in the newly created Note, I made the following addition to your macro:

image

I copied your conditional structure for versions, removed the Execute AppleScript in a couple of places while leaving the Newer and Older comments in as placeholders. That allowed my new steps to only happen in the same conditions as the AppleScript for Older than Monterey which adds the erroneous blank line.

I wait until the new note called "Title" is frontmost (this might not actually be necessary, but it makes my intent clear) and then I do two Forward Delete keystrokes to delete the zero-width space and the EOL.

In practice, I never even see the blank line.

2 Likes

Thanks for the suggestion, @August. I've included that change in v1.2.

I've updated the OP with Version 1.2 of New Apple Note.

  • Bug fix: Mistakenly had local_macOSWithFloatMenuItemRenamed in the outside If action; it has been corrected to local_macOSWithModernBehavior.

  • When floating a note on pre-Monterey, added two Forward Delete keystrokes as suggested by @August.

I've been meaning to say, thanks for the fix, Jim.

Bug Report

I have a bug that I haven't yet been able to sort out, which appears in a fresh download of your v1.2.

When I invoke your New Note macro in a some other Desktop that where the main Notes app is (or where it will open if I open it, if it's closed), then I do not get a floating Note. I just get get a new entry in _INBOX. This new Note has an extra blank line at the top of the Note.

Possible Cause

That suggests to me that at some point in the attempted creation of the floating Note, there is a Return to accept a default or something, but because of the Desktop difference at the initiation, the context isn't quite right and the Return ends up in the body of the note, above the new Title. But that's a guess, I haven't traced it out yet.

Workaround Workflow Change

If I'm in a different Desktop and I use your macro, I presume my intent would be to have the new floating Note be in that Desktop, so I'm thinking that the workflow will have to be to move to the Master Notes Desktop, create and float the Note, then move the Note back to the original Desktop.

Any suggestions?

Hi @August.

I can't duplicate the exact behavior you report, but I have updated the macro and I'm sure it will behave differently when used with multiple Mission Control Desktop Spaces.

When you get time, please download v2.0 (notes below) and let me know.

I've updated the OP with Version 2.0 of New Apple Note.

  • If macOS < local_macOSWithModernBehavior, when a new floated note is created, the first line is set to §Title. As the macro continues, this same string will be used in the actions. Once this window is made active and resized, the leading § will be removed. This is done to distinguish the new note from all existing notes that might have Title as the first line.

  • When local_FloatNewNote = 1, there are actions that bring the main notes browser to the foreground so that it can be minimized. This step would occasionally fail when the Manipulate a Window (Bring Application Window to Front) was used. This was changed to Select or Show a Menu Item.

  • Again when local_FloatNewNote = 1, immediately after the actions mentioned in b), added another Select or Show a Menu Item action to activate the new floated window. This was required to address the scenario when the active Notes window is open in another Mission Control Desktop Spaces, i.e., not the current Desktop Space (and macOS < local_macOSWithModernBehavior),

  • Added an action to ensure that the Notes app is View as List (macOS < local_macOSWithModernBehavior).

  • Added two settings to optimize macro behavior when macOS >= local_macOSWithModernBehavior: local_MultipleDesktopSpaces and local_AlwaysPreventSpaceChanges.

Thanks Jim,

It appears to be working as desired, at least in some minimal testing on Mojave (all I have available). I'll be trying more things with it and will let you know.

Typo:

WARNING: If you are working on other notes, and you want to maintain the ability to undo some of your recent modifications, then do not select 𝗤𝘂𝗶𝘁 𝗮𝗻𝗱 𝗥𝗲𝗽𝗼𝗻.

"Repon" >> "Reopen"

1 Like

Thanks for reporting back, @August. As you move forward, please let me know if you encounter any problems. Notes is a finicky app, and the idiosyncrasies have changed as the app has matured.

Thanks, also, for pointing out the typo. :face_with_monocle:

I've updated the OP with Version 1.2 of New Note:

  • Changed the name from New Apple Note to New Note.

  • Changed the name of the inbox from _INBOX to :inbox_tray: 𝗜𝗻𝗯𝗼𝘅.

  • Improved the Notes is running dialog.