Apple Notes - Script to Open a New Window for Adding Notes

This will greatly improve work efficiency.


image

PopClip has this function,KM if supported, I think it will be better.
This is the connection of the files and Source Code

https://pilotmoon.com/popclip/extensions/page/Notes

how to do it

Hi @live,

I'm not familiar with Shell at all, but I made some attempts. I've made it to work. See if you are satisfied with it or not.

First, I downloaded the extension to my Downloads folder. All files are saved in the "Notes" folder that is in the Downloads folder.
image

We have to edit the original "notes.sh" file, from:

./MessageMaker2.app/Contents/MacOS/MessageMaker2 notes text "$POPCLIP_TEXT" > /dev/null &

to:

# First, read from the SystemClipboard. 
# The text in the SystemClipboard will be the default text to the Note content.
clipboard="$(pbpaste)"
./MessageMaker2.app/Contents/MacOS/MessageMaker2 notes text "$clipboard"

Now, in Keyboard Maestro, I made a macro with two actions. The first is "Copy", the second is a shell script.

You need to change <your user name> to your own user name. If the "Notes" extension folder is located elsewhere, then cd to that folder.

###########################################
Alternatively, you may change the "notes.shell" to give a full path:

/Users/<your user name>/Downloads/Notes/MessageMaker2.app/Contents/MacOS/MessageMaker2 notes text "$clipboard"

Then, you can use the Execute Shell Script File action.


###########################################

That's it!

Now, you can set a trigger for the macro.
Select any text, and trigger the macro.

Hope it helps!

2 Likes

amazing @martin,
and thanks @live for finding the source code


@live

  1. Here's a zip of the files, notes.sh includes Martin's code
    NotesKM.zip (61.0 KB)

  2. I placed the unzipped folder in /Applications so I remember it's important.

  3. To make the script executable, open Terminal,

  4. cd to the unzipped folder directory, and

  5. run this command once:

    chmod +x notes.sh

1 Like

Thanks, @hello, for doing the extra works.
I forgot to mention that I did have to do this.

2 Likes

I literarily googled all the steps I took to make it work, except for the "Copy" action in KM. :joy:

Thanks, @live, for asking this question. I actually bought PopClip after making this macro. KM can probably do all thing that PopClip can do, but having a menu show up upon text selection is very neat.

3 Likes

Thanks for @martin & @hello 's help very much!
but I don't know how to program. Errors are reported all the time, so it can't be realized on km. It would be great to have a km file. Click Run. Solve the problem of a computer idiot like me

I've just bought PopClip too after reading this current thread (it's on the Mac App Store) and really liking it. The Extensions make it so flexible. I love the Extension to search for the selected text in Apple Music - makes it very easy to find tracks that I have in in Spotify Playlists that I'd like to also have in Apple Music.

2 Likes

Sorry, I don't know how to make the same thing with KM only. I'm a newbie in this field.

If you follow the steps I described above, it should work.
@hello has done you a favor in zipping the script files. You can use his file, upzip to a folder, and follow the steps he shows.
The only thing you may have not known is how to cd to the folder.

You can right click on the "Notes" folder which contains the the "notes.sh" file.
Then hold down the Option key, and then click "Copy 'Notes' as Pathname".
Then you can open the Terminal, type "cd " (there is a space after 'cd') then paste the Pathname after.
Then you can run the command once:

If you still have problems, just post them to the forum. Don't forget to tell us what exactly you did.

3 Likes

In which step are you?

This is great. (I plan to purchase PopClip also.) Here's a macro that incorporates the information above.


DOWNLOAD Macro File:
Text to Notes.kmmacros (20 KB)

Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.

Image • Text to Notes
2 Likes

@_jims Thank you very much for your help, but the operation went wrong :sob:


I followed your instructions, but I didn't see the macro of km

can you try

  1. open Terminal
  2. cd to the directory where you unzipped the NotesKM folder,
    and
  3. run this command inside the NotesKM folder:
    ./notes.sh
2 Likes

When you are doing it in the Terminal, you don't need a KM macro. You just run the 'notes.sh' file.

If it works in the terminal, then you can integrate it in a KM macro, as I've shown in my first reply:
image

1 Like

Unzip the archive that @hello provided. When you do you will get a folder named NotesKM. Place the folder anywhere you like, but note the location.

Then after installing and enabling the macro that I provided (named Text to Notes), move to the bottom portion of the macro where you will see the orange-colored Set Variable to Text action (local_Folder). Change that value from ~/Documents/Automation/_Keyboard Maestro/ to the folder path where you placed the NotesKM folder. (Note that ~ represents you Home folder, e.g., ~/Documents is your personal Documents folder.)

Note: If you follow the above instructions, you will not need to run the chmod +x notes.sh command.

1 Like

Thank you very much, perfect solution!

#!/usr/bin/env bash
cd /Users/live/Documents/Other/NotesKM
./notes.sh

1 Like

@_jims @hello Thank you very much for solving the problem under your guidance
very thankful !

2 Likes

@live, glad you got this working! My thanks to you and the others that made me aware of the MessageMaker2.app. It will be very useful.

2 Likes