thanks again. If I want to move some files instead of replicate, do I simply replace replicate with move ?
I could not find the answer in the forum.
thank you
thanks again. If I want to move some files instead of replicate, do I simply replace replicate with move ?
I could not find the answer in the forum.
thank you
It’s a very simple affair, actually. And it can be extended with next to no effort.
To add more groups, you only need to duplicate the macro, modify the name and change the destinationUUID variable to the appropriate item link.
Would you happen to know what the script is for move instead of replicate? Do I just change replicate for move ? I searched the forum and could not find the answer.
thanks very much for taking the time to make a video and the Keyboard Maestro solution.
and thanks very much for the macro group and 2 macros. It’s great because all I have to do is duplicate.
Yes, the command for moving a record is move.
You can find all the terminology in DEVONthink’s scripting dictionary. Quoting from the manual (Automation > AppleScript > Basic AppleScript Terminology):
AppleScript-capable applications have their commands, elements, and properties listed in an AppleScript dictionary. DEVONthink includes a large dictionary as a great reference for you. To view the dictionary, open the Script Editor application, select File > Open Dictionary and choose DEVONthink in the appearing window.
If you’ve never opened a scripting dictionary before, this link may be useful: Mac Automation Scripting Guide: Navigating a Scripting Dictionary
I wrote the script above for replicating and included some stuff that deals with the situation where someone tries to replicate to a different database. Those lines are not necessary for moving – and if the only thing you change is that word, the script won’t move items between databases. Use this instead:
tell application id "DNtp"
set theDestination to get record with uuid "x-devonthink-item://..." -- item link of destination group
repeat with theRecord in (selected records)
move record theRecord to theDestination
end repeat
end tell
The authority for scripting command is the script editors dictionary for an app. You should look there first.
OK thanks very much. Although you are 100% right in your comments, please consider that many DEVONthink users (me included) are not IT people. DEVONthink is a tool which I use for my research.
You’re welcome ![]()
I’m not sure how to respond to the rest. I answered your question, and I also shared the main resource for looking up answers to similar questions directly.
I don’t have any education or professional background in IT myself. I only began learning AppleScript 1.5–2 years ago—slowly, bit by bit.
I understand. I am extremely grateful for all the time you spent addressing my problem and your scripts which offer me a fantastic solution.
Interesting that you write such sophisticated scripts after only 2 years.
Actually…
move record (selected records) to…
also works in this case.
Thanks! Good to know. Always nice to avoid unnecessary repeat blocks.
(See, @rufus123, I still have much to learn
)
do I understand correctly that I replace 2 lines in the script above with the following
thank you very much
tell application id "DNtp"
set theDestination to get record with uuid "x-devonthink-item://..." -- item link of destination group
move (selected records) to theDestination
end repeat
end tell
Almost. You also remove the end repeat line.
And it’s probably best to include this line, like BLUEFROG did:
if (selected records) is {} then return
– what that does is quietly abort the script if you by mistake trigger it when no items are selected.
So:
tell application id "DNtp"
if (selected records) is {} then return
set theDestination to get record with uuid "x-devonthink-item://..." -- item link of destination group
move record (selected records) to theDestination
end tell
thank you very much !
Do I understand that this version (took your initial version and replaced replicate with move) is also correct and has the advantage of posting an error message if there is a problem with the destination. ? thank you
tell application id "DNtp"
set theDestination to get record with uuid "x-devonthink-item://..." -- item link of destination group
repeat with theRecord in (selected records)
if (database of theRecord) = (database of theDestination) then
move record theRecord to theDestination
else
display alert "Error" message "Item and destination are in different databases."
log message "Can't replicate to database \"" & name of (database of theDestination) & "\"" record theRecord
end if
end repeat
end tell
That does not make sense. You can move records between databases just fine. You can just not replicate between databases.
It is technically correct. But if you try using it to move something from one database to another, it gives you an error message instead. I assume that is not what you want. Did you read what the message actually says?
The point is that replicants must exist in the same database. So if you try to replicate something to a different database, the script displays an alert and adds a log entry with some details.
All that is unnecessary for moving items… Unless you want to avoid moving them between databases. In that case you should adjust the alert text so it makes sense.
I understand. Thank you very much for the clarification.