Use Prompt for User Input To Enter Text Into The Front Finder Window Search Field?

I'm wanting a prompt that I enter text into and that text is immediately entered into the search in an open Finder window.

Any help much appreciated.

Here's one method:

Finder Search.kmmacros (24 KB)

Macro screenshot

2 Likes

This task can be done directly using AppleScript UI-Scripting, but @noisneil's method is much simpler.

This is brilliant, do you know how to customise this so i can specify the search range, ie a particular folder or hd etc? thinking of this as a way to search huge music and sound effects files!

Sure. There are multiple approaches, so can you describe exactly how you'd like to interact with the macro when you want to do this?

Thanks Neil! yes, so i want to set the location of the wildcard search prompt in the macro..

ie types 'fart' searches only sound effects hard drive, folder whatever...

displays results in finder...pls let me know if that makes any sense...

If I understand correctly, you'd like the macro to intelligently discern the type of files you're looking for based on arbitrary user-input.

Until KM is updated with an AI assistance engine, I don't think this will be practically possible.

1 Like

No, sorry if i've explained poorly....i want a macro that will ask for a text input prompt as you have BUT ONLY search within a specific set location in the macro (ie my sound effects folder, rather than the entire system) The equivalent of doing a finder search but within only one location

i hope that makes more sense...i dont care about the file type, just the wildcard i put into the prompt

Do you mean like this?

Search Directory.kmmacros (45 KB)

Macro screenshot

possibly! is there a field i can enter a specific path for searching? i just want to make different ones for dif places to search...

"Local__SearchDir"

ill try replacing that and undoing if derp, thankyou so much for your kind and expert help Neil!

EDIT DERP, obvious Directory To Search LOL

Yes, you replace the example path with that of the directory you'd like to search in the green action.

You could also use a Prompt With List action to select from various directories rather than multiple macros, if you like.

This works brilliantly Neil, although a small hitch, when the finder window opens, instead of defaulting to the set search path (which is in some kind of tab?) it still defaults to 'this mac'..which looks like its still showing results not related to the set path

This picture should make sense of what i mean, and apologies if this is a finder or search preference im unaware of ->>

LOL See i thought so! THANKYOU Neil, ive made so many useful macros for myself and how to do this has always eluded me, ill study and learn. Fantastic, so kind!

1 Like