Smart Group for a Group

Can I make a “Smart Group: All Words.scpt” not for all items in the database but for within a certain group?

:unamused:

Yes.

Could you teach me how I can do that?

:blush:

Did I write a stupid question?

I tried re-touch the script like this.

tell application "DEVONthink Pro Office"
			repeat
				display dialog "Enter the Group to use:" default answer "" buttons {"Cancel", "OK"} default button 2
				set theGroup to the text returned of the result
				if theGroup is not "" then exit repeat
			end repeat
			repeat
				display dialog "Enter the Word to use:" default answer "" buttons {"Cancel", "OK"} default button 2
				set theWords to the text returned of the result
				if theWords is not "" then exit repeat
			end repeat
			set theRecord to create record with {name:theWords, comment:theGroup, type:group, attached script:scriptPath}
			my triggered(theRecord)

I was able to make a smart group named as theWord and put comment as theGroup which I want to search in.
But I could’nt fix these lines how to serch theWord in theGroup.

on triggered(theRecord)
	try
		tell application "DEVONthink Pro Office"
			if type of theRecord is group then
				set theString to {name of theRecord} as string
				search theString comparison no case within all operator all words replicate to theRecord with removing replicants
			end if
		end tell

Please someone teaches me…

You have to convert the comment (containing the group’s name) to a record reference before passing it to the search command, e.g. by using…


on triggered(theRecord)
	try
		tell application "DEVONthink Pro"
			if type of theRecord is group then
				set theString to (name of theRecord) as string
				set theName to (comment of theRecord) as string
				set theGroup to parent named theName of current database
				search theString comparison no case within all operator all words replicate to theRecord with removing replicants in theGroup
			end if
		end tell
	...

It works!!

Thank you fro your support.!!

:smiley: