jaster Posted May 22, 2014 Posted May 22, 2014 I have a basic script filter that displays a number of results. Initially when you type the first letter of the result you want it starts to narrow it down but after that the results stay the same. Any ideas?
vitor Posted May 22, 2014 Posted May 22, 2014 That’s likely something to do with the logic in the code; a Script Filter won’t narrow down results unless you set it up to, you have to tell it how to narrow down. Could you please post the workflow in question (or at least the Script Filter’s code), so we can take a look at it and try to figure out what’s wrong?
jaster Posted May 22, 2014 Author Posted May 22, 2014 That’s likely something to do with the logic in the code; a Script Filter won’t narrow down results unless you set it up to, you have to tell it how to narrow down. Could you please post the workflow in question (or at least the Script Filter’s code), so we can take a look at it and try to figure out what’s wrong? Sure. This the script filter: cat << EOB <?xml version="1.0"?> <items> <item uid="fixjdownloader" arg="jdownloader" valid="YES" autocomplete="pictures" type="file"> <title>JDownloader</title> <icon type="fileicon">/Applications/JDownloader.app</icon> </item> <item uid="fixtransmission" arg="transmission" valid="YES" autocomplete="transmission" type="file"> <title>Transmission</title> <icon type="fileicon">/Applications/Transmission.app</icon> </item> <item uid="fixalfred" arg="alfred" valid="YES" autocomplete="alfred" type="file"> <title>Alfred</title> <icon type="fileicon">/Applications/Alfred 2.app</icon> </item> <item uid="fixcandybar" arg="candybar" valid="YES" autocomplete="candybar" type="file"> <title>CandyBar</title> <icon type="fileicon">/Applications/CandyBar.app</icon> </item> <item uid="fix4chan" arg="4chan" valid="YES" autocomplete="4chan" type="file"> <title>4chan</title> <icon>4chan.png</icon> </item> <item uid="fixdropbox" arg="dropbox" valid="YES" autocomplete="dropbox" type="file"> <title>Dropbox</title> <icon type="fileicon">/Applications/Dropbox.app</icon> </item> <item uid="fixfinder" arg="finder" valid="YES" autocomplete="finder" type="file"> <title>Finder</title> <icon type="fileicon">/System/Library/CoreServices/Finder.app</icon> </item> <item uid="fixtrackpad" arg="trackpad" valid="YES" autocomplete="trackpad" type="file"> <title>Trackpad</title> <icon>trackpad.png</icon> </item> <item uid="fix hyperdock" arg="hyperdock" valid="YES" autocomplete="hyperdock" type="file"> <title>HyperDock</title> <icon type="fileicon">/Users/Daniel/Library/PreferencePanes/HyperDock.prefpane/Contents/Resources/HyperDock Helper.app</icon> </item> <item uid="fixmplayerx" arg="mplayerx" valid="YES" autocomplete="mplayerx" type="file"> <title>MPlayerX</title> <icon type="fileicon">/Applications/MPlayerX.app</icon> </item> <item uid="fixxtrafinder" arg="xtrafinder" valid="YES" autocomplete="xtrafinder" type="file"> <title>XtraFinder</title> <icon type="fileicon">/Applications/XtraFinder.app</icon> </item> <item uid="fixitunes" arg="itunes" valid="YES" autocomplete="itunes" type="file"> <title>iTunes</title> <icon type="fileicon">/Applications/iTunes.app</icon> </item> <item uid="fixremotedesktop" arg="remotedesktop" valid="YES" autocomplete="remote desktop" type="file"> <title>Remote Desktop</title> <icon type="fileicon">/System/Library/CoreServices/Screen Sharing.app</icon> </item> </items> EOB
vitor Posted May 22, 2014 Posted May 22, 2014 Yep, the problem is indeed that you’re not telling it to narrow down the results. A Script Filter is easier to build the more uniform it is, so here’s a starting point to help you with narrowing down. It expects every icon to be set as a png, for this very reason. To add more options, just set them at the top, in the options variable (one per line). options="jdownloader transmission alfred candybar" echo "<?xml version='1.0'?><items>" for item in $(echo "${options}" | grep -i ".*{query}.*"); do echo "<item uid='fix${item}' arg='${item}' valid='yes' autocomplete='${item}' type='file'>" echo "<title>${item}</title>" echo "<icon>${item}.png</icon>" echo "</item>" done echo "</items>" jaster 1
jaster Posted May 22, 2014 Author Posted May 22, 2014 Yep, the problem is indeed that you’re not telling it to narrow down the results. A Script Filter is easier to build the more uniform it is, so here’s a starting point to help you with narrowing down. It expects every icon to be set as a png, for this very reason. To add more options, just set them at the top, in the options variable (one per line). options="jdownloader transmission alfred candybar" echo "<?xml version='1.0'?><items>" for item in $(echo "${options}" | grep -i ".*{query}.*"); do echo "<item uid='fix${item}' arg='${item}' valid='yes' autocomplete='${item}' type='file'>" echo "<title>${item}</title>" echo "<icon>${item}.png</icon>" echo "</item>" done echo "</items>" Thanks mate. That looks a lot nicer than what I've been using. I'll be sure to clean up my other workflows too.
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