Find me and open a window (group or document)

Deleted. Staff published their own version.

Nice, korm!

A small adjustment, as it was erroring for me when no results were found.

	
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

-- Script "find and open me" will open a new window for the first record found
-- Install this in the toolbar for best results
-- Documents: open in document window
-- Groups: open in viewer window
-- Option to open in a tab instead of a window
-- /c/ Korm 201803
-- Attribution-NonCommercial-ShareAlike 4.0 International
-- http://creativecommons.org/licenses/by-nc-sa/4.0/

property openTab : false

tell application id "DNtp"
	activate
	set searchFor to display name editor info "Enter name of group / document to search for"
	set searchResults to search searchFor within titles -- This searches only the current database
	if searchResults ≠ {} then
		if openTab then
			set theTab to open tab for record (first item of searchResults) in viewer window 1
		else
			set theWindow to open window for record (first item of searchResults)
		end if
	else
		display alert "No documents found."
	end if
end tell

Also, the searchScope is the current database, so I added a comment on that line.

AppleScript neophyte over here!

Dropping the above into the script editor, and attempting a compile(?), sees me get this error: “Syntax error – A property cant’ go after this identifier”.
The identifier in question appears to be “display name” in the first line, at least - that appears to be what is highlighted?

I’m probably missing something obvious - like the first part of the script? :blush:

Any suggestions?

Apologies. I was excerpting korm’s script. I edited my post to include the original code (including attribution) with my minor edits.

Much obliged to you and @korm!


(My apology: I don’t know how to paste a block of code in the forum)

For 3.0 I have done a patchy work that is based on the script in this thread but using the std group selector. With this script I can search for a group and open a new window with the selected group as focus. However, I am just wondering if there is a newer reference for the group selector used in 3.0 (the opt-cmd-g dialogue)? The reason is that I can type the group’s name right away in the new selector while I need to click the search field in the default group selector before start typing.

Thank you in advance

Just found out that there is a much easier way to code the script. I still hope someone can advise whether the newer group selector is available for us to use.

This script, as a button in tool bar, is handy for any one who want to stay focused within a specific group while needing to jump to another group to check for additional info/ref.