Hi,
I just created an short AppleScript which is meant to be used via LaunchBar. It allows searching for groups in all open DEVONthink databases whose name contains the searchtext. When only one group is found, it is opened; when multiple groups the results are displayed directly in LaunchBar by passing a script generated XML.
Sven.
# Search DEVONthink Group.scpt
#
#
# Script Action for LaunchBar
#
# searches open DEVONthink databases for groups whose name contains searchtext
# when only one group is found, it is opened; when multiple groups are found
# it displays the results directly in LaunchBar by passing a script generated XML
# to LaunchBar.
#
# 2013-10-17: first version
#
# includes code from the "SafariTabsActions" Scripts provided by objective delevopment
#
# http://blog.obdev.at/post/launchbar-action-to-list-safari-tabs/
# http://www.obdev.at/ftp/blog/SafariTabsActions.zip
on encodeTitle(theTitle)
set theTitle to my replaceChars(theTitle, "&", "&")
set theTitle to my replaceChars(theTitle, "<", "<")
set theTitle to my replaceChars(theTitle, ">", ">")
return theTitle
end encodeTitle
on replaceChars(theText, searchString, replacementString)
set AppleScript's text item delimiters to the searchString
set the item_list to every text item of theText
set AppleScript's text item delimiters to the replacementString
set theText to the item_list as string
set AppleScript's text item delimiters to ""
return theText
end replaceChars
on search_devonthink_for_group(my_search_text)
tell application id "com.devon-technologies.thinkpro2"
set my_group_list to {}
set list_of_databases to get every database
repeat with my_database in list_of_databases
set my_list to (search "*" & my_search_text & "*" in root of my_database within titles)
repeat with my_item in my_list
if type of my_item = group then
set end of my_group_list to my_item
end if
end repeat
end repeat
if (count of my_group_list) > 1 then
set the_XML to "<?xml version='1.0'?><items>"
repeat with my_group in my_group_list
set my_url to reference URL of my_group
set my_title to my encodeTitle(name of my_group)
set my_subtitle to name of database of my_group & location of my_group
set the_XML to the_XML & ("<item>" & "<title>" & my_title & "</title><subtitle>" & my_subtitle & "</subtitle><url>" & my_url & "</url></item>")
end repeat
set the_XML to the_XML & "</items>"
tell application "LaunchBar" to set selection as list to the_XML
else
activate
open window for record item 1 of my_group_list
end if
end tell
end search_devonthink_for_group
on handle_string(my_search_text)
search_devonthink_for_group(my_search_text)
end handle_string
on run
activate me
set my_search_text to text returned of (display dialog "Search text?" default answer "")
search_devonthink_for_group(my_search_text)
end run