leahcim Posted March 6, 2020 Posted March 6, 2020 (edited) Hello all as I understand the default in keyword allows to search contents of a file, but cannot be limited to a certain extension (all parts of the search expression will be used to match against the contents) the File Filter node in custom workflows allows to filter by extension, but requires to provide the UTI and does not allow to simply search for ".txt" as an extension. Determining the list of available UTIs and their respective extensions is not trivial Is my understanding of above behaviour correct? Edited March 6, 2020 by leahcim
Vero Posted March 6, 2020 Posted March 6, 2020 @leahcim For a File Filter, you can drag in an example file of what you'd like to search. For example, if you want to narrow your file filter to txt files only, you can drag in a text file to the File Types box. Adding UTIs manually is completely optional, but might give some users more flexibility. Cheers, Vero
leahcim Posted March 6, 2020 Author Posted March 6, 2020 Thanks @Vero! Yes, UTIs can be dragged & dropped which is very convenient - however, in my case I want to make it dynamic so that I can specify the extension from Alfred's input box. Therefore, I cannot pre-set any extension filter in the File Filter node, but need to dynamically retrieve it from the input and then set it in the node via a JSON update. And the only solution I've found is to parse the available UTIs from MacOS.
leahcim Posted March 6, 2020 Author Posted March 6, 2020 (edited) To update, I've got it working now by parsing the available MacOS UTIs and mapping the extensions to UTIs. Little bit of extra work, but it works flawlessly and allows me to search in files of a specific file type. Edited March 6, 2020 by leahcim
cands Posted April 2, 2020 Posted April 2, 2020 On 3/6/2020 at 5:46 PM, leahcim said: To update, I've got it working now by parsing the available MacOS UTIs and mapping the extensions to UTIs. Little bit of extra work, but it works flawlessly and allows me to search in files of a specific file type. This sounds very useful, but I do not understand how to implement it. Could you share the workflow or give further instructions? Any tips are appreciated.
deanishe Posted April 2, 2020 Posted April 2, 2020 5 hours ago, cands said: This sounds very useful, but I do not understand how to implement it To get a list of the UTIs known to the system, run the following in a shell: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep '[[:space:]]uti:' | awk '{ print $2 }' | sort | uniq cands 1
TomBenz Posted May 19, 2022 Posted May 19, 2022 On 4/2/2020 at 12:53 PM, cands said: This sounds very useful, but I do not understand how to implement it. Could you share the workflow or give further instructions? Any tips are appreciated. Pls post the updated workflow. More explanation on UTI would help. I run the command suggested below but couldn't locate the output!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now