Napkin v0.9k Text, Drawing & Photo Macro

It is possible, that's the good news. Here's how:

Look for this at the end of the "Custom Floating HTML Prompt: Text Mode Form" action:

	<button class="button" name="Save" type="button" onclick="if ( document.getElementById('form').checkValidity() ) { window.KeyboardMaestro.Submit('Save') } else { document.getElementById('form').reportValidity() }">Save</button>

and change it to:

	<button class="button" name="Save" type="button" accesskey="s" onclick="if ( document.getElementById('form').checkValidity() ) { window.KeyboardMaestro.Submit('Save') } else { document.getElementById('form').reportValidity() }">Save</button>

Note the addition of accesskey="s" after type="button" to set Control+Option+s as the hotkey for the Save button. You'd make the same modification for the other buttons.

The bad news is that you may encounter shortcut conflicts implementing the obvious shortcuts ("s" for Save, "v" for View, etc.).

Webkit (on which the Custom HTML form relies) uses Control+Option to fire any accesskey. So if you use Control+Option+s to trigger some other macro (as I do), that trigger takes precedence over the accesskey setting.

You just have to make sure your accesskey doesn't conflict with an existing macro trigger or system shortcut. In my case, that isn't possible so I didn't implement it.

Thanks for explaining! It is good news and I think that would work for my use case, i.e. I don't think there will be any serious conflicts. However, adding accesskey="s" according to your instructions does not work for me, nothing happens when I hit Control+Option+S (I've also tried other access keys with the same result). I'm using macOS 10.14.6 and KM 9.0.3. Any ideas?

Two ideas.

  1. I tested this on High Sierra with Keyboard Maestro v9. I used the View button to open the file in BBEdit and then assembled a note before using the hotkey I set up (Control-Option-Hyphen). It took a heartbeat or two before it appeared but it did appear. I'd test again that way because support for accesskey is not something that would disappear in Webkit once it's in, it seems to me. If you still don't get the save, try a different hotkey (you may have an unrecognized conflict; there's more than one source).

  2. Fight fire with fire. Use the Submit Front Browser Form action to set up a hot key for Napkin's Save button in a completely separate macro.

Thanks for the ideas. Regarding idea 1 I have tried several different hotkeys and it does not work regardless. Idea 2 sounds very interesting, especially if it would allow to set any kind of standard macro trigger. However, I do not know how to implement this, could you give some guidance what to put in the Submit Front Browser Form function?

I've tried several variations on that second idea but none of them have worked. It seems Keyboard Maestro doesn't treat its Custom HTML prompt as a browser.

There's at least one more variation I haven't tested yet, though.

To implement this for yourself (if you want to confirm it doesn't work, that is), create a new macro, name it "Submit" or something like that, add your hotkey trigger, enable it and add the one action (Submit Front Browser Form, say). That's it.

With Napkin running, hit your hotkey and you'll see Napkin does not save your text. It just ignores you.

So Keyboard Maestro doesn't think its Custom HTML Prompt is a browser, I guess.

I'm not clear why the first solution is eluding you. So I've created a small macro that has just a Custom HTML Prompt in it with some text and an OK button with a hotkey.

If you wouldn't mind trying it and letting me know if it works or not, I'd appreciate it. The hotkey is Control + Option + Hyphen so if that conflicts with anything in your environment, you can change it in the code. Command + Up activates it.

Custom Floating HTML Prompt: Hotkey Test.kmmacros (4.3 KB)

Thanks for your efforts. The hotkey does work in the test macro you created, so there seems to be some difference when trying to use Napkin on my system.

Thanks. To show my appreciation, here's a version of Napkin using the same Control + Option + Hyphen hotkey to Save a note. I've tested it here to confirm it works. Let me know if it works for you.

Napkin v0.9k hotkey.kmmacros (180.3 KB)

Yes, now it works! Thank you very much for fixing it, this makes it much more convenient for me (and hopefully more users).

Great! Happy to help.

Someone asked off the forum about moving the Napkin window to another part of the screen. Here are the details:

Look in the Custom Floating HTML action for both text and draw modes and scoot down to the body tag, which is the same in both although much further down in the draw mode code:

<body data-kmwindow="SCREEN(Main,Left,84%),SCREEN(Main,Top,2%),328,520">

This document (https://wiki.keyboardmaestro.com/function/SCREEN) explains how to set the position using the SCREEN function.

1 Like

Hi Mike! Thank you so much for sharing this macro!
I am looking for something super simple to take quick notes.
Your macro has a lot of stuff that I don't really need and I would like to make some changes, but I'm not sure how to achieve them. Would you be able to help me with that?

So all I need is really a window like the one from the original "Quick Note Taking System" by @BKammer
The only thing I'm not a fan of on his macro is the one-line field for the body and I would like to have a text area for multi lines.

Then I would also like to customize the appearance as well, but I believe with my basic knowledge of HTML and CSS I will be able to do that, as long as the functionality of the app does what I need.

So here's what I would like to do:
1 - By default, embed in the code, it would always save the files to, for example, my Desktop. I don't need to set a location every time I create a new note, because that's time that I spend and also distracting
2 - The file name could be an extra filed, like his macro has. So one for the title and one for the body and the title would also be included in the body, so when I copy/paste to my Notes app, it would be ready to go.
3 - If possible, hitting the ESCAPE key would behave as a QUIT, so I wouldn't need to click QUIT at all (the button would also be gone).
4 - At the moment, I see this as the default. Not sure if it's intended or a bug. If it's a bug, how would that be removed?
Screen Shot 2022-06-23 at 2.55.37 PM
5 - I would like the window to always be centered on the screen
6 - To customize it, would it be as simple as using basic HTML and CSS, right? I'm all about dark themes, so I would like to customize it that way

Thank you and hope you can help me with this :slight_smile:

I'm scrambling to be Somewhere Else Shortly so I'll have to come back to this to address your individual points. But No. 4 is a puzzle. You shouldn't be seeing that. Here's what I see (with an unreleased version that changed the colors):

ss-412

You're right about No. 6, mostly. There's a lot of JavaScript bundled (and minimized) with this, too. Some of which enables tabs in the textarea.

As for eliminating things, I'd just point out that they don't get in your way once you've set them, so you might just think of them as visible preferences. I'm not inclined to remove them because they would force your particular preferences on others (like me). Less flexibility isn't a design goal :grinning: but you're certainly free to pursue it if the shoe fits.

More later...

Thanks for the quick reply!

I have someone helping me with another solution, which is exactly what I needed: create a note directly inside the Notes app, because using your macro I would still need to then convert them to notes inside the app. I thought the Notes app solution wasn't possible and that's why I checked alternatives.

Regarding the version with less options, I wasn't obviously asking you to change your macro, but just to help me with my version. To me having too many options just because "I might need them" (when I clearly know I won't) isn't always a good thing. To me, visual distractions are worse and of course, I could always go back and download your macro again, should I needed it :slight_smile:

If you're interested in checking the macro I'm having help with:

Well, just to follow up on one item that may be of general interest (since iamdannywyatt's issue was with an export to Notes resolved elsewhere), you can activate the Escape key to close Napkin by simply adding that condition to the Main action:

Here is a simple solution I gleaned from another user whom I can't recall.

This macro is uploaded in a disabled state:

Multi-Line Dialog using AppleScript.kmmacros (28.8 KB)

image
Excuse me, how to set the picture path? I want to save the drawings to a special directory.

Click the Help button and then the File, Folder link for the details. In short:

"You can open an image file for editing using the Reload button on top or by dragging an image file (including JPEG, PNG, TIFF, GIF and video files) onto the canvas. Both will update the File Status."

Hmm, I'll have to look into that. Save and Reload should prompt you for a destination if there's no active file.

[pause]

Ah, I see the problem. Napkin is only looking for v9 or v8 of Keyboard Maestro so v10 confuses it. Worse, the AppleScript to return the version is returning nothing.

I'll post a fix shortly.

Napkin Updated for Keyboard Maestro v10

OK, new and improved v0.9o (with version number display between the Help and Quit buttons). This version detects v8's limitations and should work with versions about that, including v10. Includes the new color scheme, too.

ss-414

Napkin: The App Macro

Napkin- The App.kmmacros (189 KB)

1 Like

Thank you for your help.

Thanks for reporting the problem.