Shell Script Arguments

Hi Folks,

I would like to use mdfind to find PDF files with a search text. The search for the text works without problems, but if I then add further arguments (only pdf files) and put them in ' ... ' Keyboard Maerstro does not accept this.

The following instruction is executed successfully in the terminal, not in KeyboardMaerstro:
mdfind 'kMDItemTextContent == $KMVAR_searchTXT" && kMDItemFSName == "*.pdf"'

this on execution successfully in Keyboard Maestro:
mdfind kMDItemTextContent == $KMVAR_searchTXT"

I am very grateful for any suggestions.

As both @ccstone and @peternlewis have noted, using quotes in a complex shell script is tricky. Take a look at this macro and see if it will help solve your problem. Sorry I don't have time right now to debug your specific use case.

If that does not do it, the look at other posts from this search:
https://forum.keyboardmaestro.com/search?q=mdfind

Hi michael,

thank you for the quick feedback. Unfortunately I can't get it to work with the template. I now take a detour and let the commands be inserted and executed in a terminal. Not elegant but it works.

Regards.