Script to reorder in "unsorted" view

Is there any way to reorder items in the unsorted view? I want to reverse the order of lots of items (about 10,000) in unsorted view. Any quick way I can do this?



Sorting via AppleScript is not supported but one workaround could be to move the items to a temporary group in the desired order. Then you could either move the items back to the original group or use the temporary group.

Euan, you’ve got me scratching my head. If the items are unsorted (unordered by DT Pro’s Sort routines) why reverse the order in which the items appear?

Makes me think of some of the old bubble sort routines where one might move one item at a time until some end result had been achieved, e.g. move the last item to the top, the next-to-last to the next-to-top, and so on. It’s easy to do this manually with a handful of items. But not 10,000! :slight_smile:

The algorithm might be tricky. I remember one occasion when a consultant wrote a little program to sort a list of a few hundred items. His algorithm took hours of run-time on a mainframe, at considerable expense.

Anyone know of a simple approach to “flip” a large list? Any repetitive automatic way of moving items from one group to another (as Christian suggested) so that the order is reversed? (Include a similar routine in the Finder for exported items as another possibility.)

Bill, all the items I have are photos of documents, and reverse sorted (import order was like that). I need them to be reversed so I can read through them more easily. I find the fact that DT won’t allow me to set sorting on a per-folder basis rather annoying!

Christian, would this kind of pseudo-code do what I want/be possible in applescript? I just want to reverse the items (best would be to have them sorted by name though just in case). If it will I’ll hack away at getting it to work.

set the_group to selected group
create temp_group in the_group
repeat with theRecord in the_group
  get last record
  move record theRecord to temp_group
end repeat

repeat with theRecord in temp_group
  get first record
  move record theRecord to the_group
end repeat

delete group temp_group

No. A simple script to move the selected items to a temporary group would look like this:

tell application "DEVONthink Pro"
	set theSelection to the selection
	set tempGroup to create location "/tmp"
	repeat with theRecord in theSelection
		move record theRecord to tempGroup
	end repeat
end tell

Why don’t you just use sorting by name? E.g. double-click on the group and select sorting by name. DT remembers the sorting for each group (but every window uses the sorting of its top group and therefore you have to double-click or open the group).