I have all my files on a has which I use DT to index, i.e. I’m not moving files to DT storage.
As I understand it, DT when working with files that simply indexed and no imported will allow you to move a file between groups folders; however it does not update the actual location of the file. It simply moves the reference to another location.
I would like to be able to move a particular file from its index source to another real folder and have DT update the index to reflect the move.
[size=85]This version is deprecated – see the following post(s) for updates[/size]
If this breaks, it breaks. No fixes guaranteed.
Do not use on your beloved data without testing it.
(*
Move a record from one indexed folder to another
by: korm 20150615
version 0: operates only on the selected document
contains no error checking
For demonstration purposes only -- do not use on data you love and cherish
*)
tell application id "DNtp"
set theRecord to the content record
consolidate record theRecord
set theDestination to display group selector "Choose destination" buttons {"Move document to", "Cancel"}
set theResult to move record theRecord to theDestination
deconsolidate record theResult
end tell
[size=85]This version is deprecated – see the following post(s) for updates[/size]
check if destination is indexed – controlled via a property
log a completion message to the DEVONthink log
The property “onlyIndexedDestination” controls whether moving to a non-indexed destination is permitted. By default, moves are only permitted to indexed destinations (groups). Change the property to “false” to cause the script to allow moves to both internal and indexed destinations. Your settings matter: if an indexed item is moved to a non-indexed destination by this script then that item is no longer indexed. So, fiddle carefully. I am trying to avoid complexity with the properties and dialogs.
Be aware that selections in DEVONthink do not necessarily need to be within the same group. The thing selected to be moved can be either a group or a record, or a combination of groups and records, or a group with children. You can select a combination of indexed and non-indexed source documents and move them all to the same indexed group, and then move them all externally. This is powerful but also needs to be used thoughtfully. There is no undo.
I will consider enhancement requests – but not with speed or urgency.
(*
Move a record from one indexed folder to another
by: korm 20150615
version 0:
operates only on the selected document
contains no error checking
version 0.1:
added error checking;
multiple selection;
check if destination is indexed -- controlled via a property
log a completion message to the DEVONthink log
For demonstration purposes only -- do not use on data you love and cherish
*)
property onlyIndexedDestination : true
property pVersion : "0.1"
tell application id "DNtp"
try
if the selection is {} then error "Please select something to move"
set theSelection to the selection
set theDestination to display group selector "Choose destination" buttons {"Cancel", "Move document to"}
if onlyIndexedDestination then
if indexed of theDestination is false then error "The destination is not indexed - please repeat, and choose another destination"
end if
set pCount to 1
repeat with theRecord in theSelection
consolidate record theRecord
set theResult to move record theRecord to theDestination
deconsolidate record theResult
set pCount to pCount + 1
end repeat
set lMessage to "Mover " & pVersion & ": moved " & (pCount as string) & " records to " & (path of theDestination as string)
set lResult to log message lMessage
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink received an error" message error_message as warning
end try
end tell
My advice given this news is to ignore the script posted above. It serves no purpose since DEVONthink in the future will support the requested feature. I’ll wait a few days then remove the script from circulation.