Querying database via AppleScript // Getting the full path of group?

I am using AppleScript to query group names like so:

tell application id "DNtp"
	set resultList to search "name:vagrant* kind:group"  -- Searching for groups named "vagrant" 
	set results to {}
	repeat with result in resultList
		set rName to get name of result
		set rUUID to uuid of result
		set rPath to path of result
		set rParent to name of parent of result
		set rDBName to name of database of result
		set results to results & [{title:rName, mydb:rDBName, myparent:rParent, myuuid:rUUID}]
	end repeat
	return results
end tell

Now is there a way to get the full path of the group name within the database?

Something like Database1 / DevOps / Deployment / Vagrant ?

Look at the AppleScript dictionary.

path is the file path in the filesystem.
location is the path in a database. However it does not include the database name.

Here’s a simple example…

tell application id "DNtp"
	set sel to item 1 of (selected records)
	set db to (name of database of sel) as string
	set loc to (location of sel)
	set recName to name of sel
	
	return (db & ": " & loc & recName)
end tell

---> "Temp: /Screencaps/Misc"
2 Likes

Excellent! Thank you very much.

No problem :slight_smile: