This is probably another useless script.
I am doing a lot of document searches either in a specific group (my pool of literature) or in the current database these days, I find it much easier for me to type the search string in a popup window right in front of me (middle of the screen) than having to look at the upper right corner of the main window that is located at upper right corner of my screen (I have a 32" monitor running at full 4K resolution).
The script has a toggle “scopeIsCurrentDB”. If the option is set at “true” then the search will be conducted on the current database. If “false”, the search will be conducted in a group that is specified in the script. I make two copies of the same script and put them under the script menu. I assign one copy with the shortcut of “ctrl-opt-F” (search in the current database) and another with “ctrl-opt-P” (search in a specific group).
I hope the script will be useful to those with poorer eyesight…
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- ngan 2020.02.06
-- uuid of the search scope
property scopeIsCurrentDB : true -- 1. true: search in the active window 2. false: search in uuidScope
property uuidScope : "82DB1186-XXXX-XXXX-XXXX-XXXXXXXX" -- the uuid of the specific group
global theTitle, theScope, thePredicates
tell application id "DNtp"
if scopeIsCurrentDB is false then
set theRecord to get record with uuid uuidScope
set root of viewer window 1 to theRecord
set theScope to " scope:selection "
set theTitle to "Search In: " & "\"" & name of theRecord & "\" "
else
set theScope to ""
set theScope to " scope:database "
set theTitle to "Search In: " & "\"" & name of current database & "\" "
end if
repeat
set thePredicates to display name editor info theTitle default answer " "
if thePredicates is not "" then exit repeat
end repeat
set thePredicates to thePredicates & theScope
set search query of viewer window 1 to thePredicates
end tell