Copy Item Link of Parent Group?

@BLUEFROG already provided the script, didn’t he? It writes the parent group’s URL in a new record. If you want to do something else with the URL, well - what?
You can assign a shortcut to the script, too, which should make using it simpler.

:thinking:
As @chrillek noted, I already posted a functional script to do as requested.

1 Like

Thanks - I see that now

One minor tweak to address the original request to “Copy Item Link” - I changed the “create record” line near the end to:

set the clipboard to parentURL as text

Thanks for the help

As per the discussion above, a record can have multiple parents
(if there are replicants)
Is this a concern for your use case?

As parents includes tags, checking number of replicants would be actually more reliable.

There’s no such thing like the parent group in case of replicated items. A property returning the group of the location could be added (but after adding & deleting replicants this group & location might still change).

The longer we’re talking about this, the more I think that some kind of class diagram (UML? ER?) might be helpful to understand the different relationships between objects in DT.
Perhaps that could find its way into the documentation one day.

2 Likes

To be honest, for DEVONthink’s AppleScript suite it is a list but please don’t ask me why AppleScript requires a cast in some cases :laughing: To make things more confusing, selected records is a one-to-many relationship (not a list!) but doesn’t require these casts.

In addition, queries based on this relationship (e.g. UUID of selected records) are much faster than using the selection and therefore selected records is usually recommended for new scripts.

3 Likes

Added location group to the next release.

6 Likes

Thanks for the heads up. I can see where that could be an issue for some, but it is not an issue in my case.

For those who may be interested… I solved this in a somewhat simpler fashion which works at least for my use case.

Thanks for all the input from all who offered suggestions.

tell application id "DNtp"
	set the clipboard to ("x-devonthink-item://" & the uuid of the current group) as text
end tell
1 Like

I would suggest to use the reference URL property:

set the clipboard to (reference URL of the current group) as string
1 Like

Thank you - even simpler than mine

Thanks for that addition. If possible, it would be helpful to add more info to the DEVONthink documentation (or at least to the AppleScript dictionary) about location group’s behavior with respect to replicants. Currently, the text simply says

image

which (IMHO) does not really capture the nuances discussed in this thread, nor really does it even distinguish it clearly from parent.

1 Like

The next release will slightly revise the description.

1 Like

Glad I found this!

Was having trouble using from parent of theRecord to work and switching it to from location group of theRecord solved my problem.