KM macro to prompt for renaming files?

Scenario is we use printed forms in the field at work and they get completed with handwritten notes. These forms all have a consistent phrase that when scanned in as a PDF will identify the form as a particular type.

KM can monitor the folder for new files, but is it possible to:

  1. Bring up a preview of the PDF
    While also:
  2. Bring up a user input window that has a predetermined portion of the new filename-to-be and a box for me to type the client name ( I need to see my messy handwriting on the scanned preview to see the client )
  3. Then rename the file, move it to a specific folder, and close the preview?
  4. Repeat for each scanned pdf added to the watched folder

Lots to do as I re-read that but figure someone on here must scan in field notes and have to rename them later....



I'm afraid it's difficult to provide a more complete example macro without knowing what sort of file name you want the renamed files to have or the folder you want them moved to, so you'll have to change those aspects yourself, but this should get you started:

Prompt for Renaming Files.kmmacros (4.0 KB)

Hey Thanks for the quick response!

Started out exactly promising, but probably fell down with my lack of details I supplied sorry.

Add new file = immediately shows Preview and Rename prompt window ✓
I enter the client name and the preview and prompt disappear ✓
KM moves the file to the required folder (i changed the path in the bottom step) ✓

it kept the same filename as ScanSnap reference anywhere to the client name I typed in the prompt.....

my new renamed file will be format:

at the start of the macro i added a folder trigger watching for a new item
I will have to add a second condition that contents / or file (?) contains the OCR words FORMNAME


No problem! It's hard to say for sure what's going wrong without a screenshot of the macro and/or the macro itself, but it sounds like you unintentionally deleted the file's new name when you changed the path in the last step, so the original file is being moved to the folder without the name being applied. Make sure that this string of text comes after the folder path in the last step and it should work:


Incidentally, did you know KM can also automate the date part of the file name? All you have to do is change the file name above to include the ICU Date/Time token:

ALWAYS FORM NAME - %Variable%Local__ClientName% - CREATIONDATE%ICUDateTime%ddMMyyyy%.pdf

That works great ! will save lots of time.

Except, .... when I scan several forms in, the prompts and previews all come up at once :thinking:

This will still be very helpful if no further changes, but is there something equivalent to "repeat for each new file until done" ?

Really appreciate the instructions on this forum.

rename prompt.kmactions (528 Bytes)

Glad to hear it! To solve the prompts and previews all coming up at once issue, all you need to do is add a Semaphore Lock action to the top of your macro, like this:


Give that a try and see if it doesn't do the trick.

:100: % solved

Thank you again!


1 Like