Page 1 of 1

Search by tags

Posted: Thu Jan 09, 2014 1:52 pm
by Chandana
How do I find an item from Launchbar by using OS X 10.9 tags?

Re: Search by tags

Posted: Sun Mar 16, 2014 11:54 am
by iRounak
For the record:
Save the code below in an applescript file.
1. Bring up the script in launchbar
2. Press space
3. Type the tag name that you want to search for
4. Press return

(Note: You can type "*" i.e. asterisk in search to see all files with tags)

Code: Select all

on handle_string(thequery)
      tell application "LaunchBar" to hide
      set thecmd to "mdfind  'kMDItemUserTags == " & thequery & "'"
      set theresult to do shell script thecmd
      if theresult is "" then
         tell application "LaunchBar"
            set selection as text to "No files with this tag found"
         end tell
      end if
      set allparas to every paragraph of theresult
      set thelist to {}
      repeat with apara in allparas
         set apara to apara as text
         set end of thelist to apara
      end repeat
      tell application "LaunchBar"
         set selection to thelist
      end tell
   on error e
      tell me to activate
      display dialog e
   end try
end handle_string

Re: Search by tags

Posted: Sun Mar 16, 2014 12:57 pm
by Chandana
Awesome, thanks!

Re: Search by tags

Posted: Mon Apr 07, 2014 9:14 am
by Kicweed
Just to let you know, the latest LB 6 beta can now play nicely with tags. You can search by tags and also assign tags to items, right inside LB.

Overall it's a great implementation, if you're interested you can request an invite to test LB 6 beta here