MACRO: Choose File From Folder List With Incremental-Search and AutoComplete

Use Case

  • Provide an easy way to search/filter the list of files in a folder
    • Allows user to use incremental search with autocomplete to search/filter a list of files in a selected folder
  • Target Folder may come from current Finder or PathFinder Window,
    OR, from a preset Folder you have set in the Macro.

Example Output


MACRO:   Choose File From All Files in Target Folder using KM Prompt With List [Example]

-~~~ VER: 2.0    2020-07-18 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Choose File From All Files in Target Folder using KM Prompt With List [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Provide an easy way to search/filter the list of files in a folder
  • File List may come from current Finder or PathFinder Window,
    OR, from a preset Folder you have set in the Macro.

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Optionally Open the Target Folder in Either Finder or PathFinder
    • The list of files will be for that folder IF you have set the KM Variable DND_CF__TargetFolderPath to "FRONTMOST"
    • OR, the list will be from the Path you set in this Variable
    • OR, If the Variable is blank, you will be prompted to select the Target Folder.
  3. Trigger this macro.
    • IF you have NOT provided the location of the Target Folder, then you will be prompted to select one.
    • A list of ALL files in the Target Folder will be displayed
    • You can easily filter this list just by typing a few characters in the file name.
    • To choose the selected file, press RETURN or Double-Click it.
    • You can change the Target Folder by choosing the command "[CF -- Change Folder ]".
    • The list will be refreshed with files from that folder.
    • Press ESC to cancal the Macro.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • CHANGE to PATH of Target Folder; OR "FRONTMOST" to use Finder or PF
      • Must be either full POSIX Path of the folder, OR "FRONTMOST".
      • If "FRONTMOST", then the folder open in the frontmost window of either Finder or PathFinder will be used.
    • ADD Your Actions Here to Process Local__FilePath
      • Add your Actions at the END of the Macro.

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+

TAGS: @Files @Finder @PathFinder @PF @PromptList

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

2 Likes

Thanks very much !

  • I changed the Prompt action config (gear) to allow for multiple selections (which is what I want most of the time) but it does not work. One selection is fine. More than one and nothing happens when I press Enter. I know, based on some of your previous macros with prompts, that it should work.

  • to end up opening the selected file in default app, I added pause → keytroke Enter at the end. Is there a more elegant way of doing this ? I am NOT asking you to rewrite the macro yet again ! Just curious

thanks !

Multiple selection works just fine.
It returns a list of file paths, one per line.

But to use this list, you will need a For Each action with a Lines Collection to open each file separately.

Should not be needed. Just use this:

image

1 Like

Works fine now with you suggestion. SPECTACULAR !!
thank you so much !