Jump to content

Add and remove alfred:ignore from comments


Recommended Posts

Hi, 

 

I've created a simple workflow to manage my 'alfred ignore list'. It reuses some PHP code from jdwarrior. I hope that's not a problem :-)

 

The workflow contains a file action to add the alfred:ignore comment to a file. This will make Alfredapp ignore the file and not show it as a search result anymore. Type 'ignorelist' to display a list of all currently ignored files. Selecting a file will remove all spotlight comments (beware!) and will make Alfred list it in the search results again. 

 

I hope it's of use to anyone else. It helps me to get rid off all the annoying and useless apps showing up in my results. Again, it blatantly removes all spotlight comments right now and I've not tested it thoroughly yet, but I'll try to fix any issues asap.

 

You probably need to reload Alfred's cache after using this workflow: just type 'reload' and select 'Reload Alfred Cache'.

PS: Any way to do that programmatically?

 

Download: http://cl.ly/3P092T38282j

 

regards, J.

Link to comment

I think you could detect whether a comment already contains "alfred:ignore" with something like this:

 

set string1 to "coucou"
set string2 to "cou"
if string2 is in string1 then display dialog "yay"

 

and then using the comment already existing in a file to add "alfred:ignore" (only if it isn't already in it), to the previous comment without erasing it, something like this:

 

set existing_comment to comment of theFile
set comment of theFile to existing_comment & " " & "alfred:ignore"

 

 

Also, I'm not sure you need to write your "ignorelist" to a file since the command mdfind (command line for a spotlight search, quite fast) allows you to search for a file by kMDItemFinderComment, which is the file's comment. 

 

Finally, I know there is a simple way to remove a string from a string with php or bash. So i would assume that also exists in applescript (if you decide to stick with it and not use bash for mdfind). 

 

 

Anyway, I really like your workflow ;) I never use the comments so I don't care if it erases it  :P

Link to comment
  • 5 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...