Prompt for filename to paste contents of

I use KM primarily for templated or boilerplate text … couple of keystrokes, and I have it open a file, read the file, and then paste the contents of the file into the current window.

Is there a way to get it to prompt with a file->open dialog rather than hard coding my filename? I haven’t seen anything that makes it straightforward … but perhaps there’s an advanced usage I’m missing.


You can use this to get the standard Choose dialog:

[Example] Choose Dialog.kmmacros (2.4 KB)

Note: Change the parameters of the prompt (default location etc.) to your liking. As shown in the screenshot it is set to not show invisible files, not package contents and multiple selections are not allowed.

Or the built-in user prompt:

…which will produce this:

(You can enter the path or drop a file to the field.)

I’ve been looking for that prompt for user input action, since it’s exactly what I need, but I haven’t found it in my copy of KM. (7.0.3). What am I missing?

If you mean the second one, in my copy of KM 7.0.3 it’s in the categories Notifications and Variables. It’s called “Prompt for User Input”.

Oh, sorry, complete brainf*rt on my part. Yeah, I have that. To pop the open selection dialog I apparently need to use the AppleScript example you provided - it’s not working out of the box, but I’ll have to do my research to make it so. (Not done much AppleScript stuff in the past.) Thanks for the assist.

The script is not out of the box, but fairly standard. The script actions are out of the box, and you can execute a script by just pasting it into the appropriate action:

You can also use them to call an external script, anywhere on your Mac: