DO 11 Script - vector sorting

Here's my code snippet..

[code] Dim vecSrc

Set vecSrc = fd.func.sourcetab.selected
For i = 0 To vecSrc.count - 1
DOpus.output "vecSrc(" & i & ") " & vecSrc(i)
Next
vecSrc.sort
For i = 0 To vecSrc.count - 1
DOpus.output "vecSrc(" & i & ") " & vecSrc(i)
Next[/code]
..and the resultant error.


No doubt some kind soul can point me in the right direction.

Regards, AB

selected doesn't return a Vector, it returns a collection of File objects.

Thanks. I have re-jigged the code as follows:

Dim vecSrc Set vecSrc = DOpus.newvector DOpus.output "Load vecSrc vector with selected files/folders" For i = 0 To fd.func.sourcetab.selected.count - 1 vecSrc.push_back fd.func.sourcetab.selected(i) Next For i = 0 To vecSrc.count - 1 DOpus.output "vecSrc(" & i & ") " & vecSrc(i) Next DOpus.output "Sort vecSrc vector and display (sorted) contents" vecSrc.sort For i = 0 To vecSrc.count - 1 DOpus.output "vecSrc(" & i & ") " & vecSrc(i) Next
However, the sort operation does not appear to do anything.

Load vecSrc vector with selected files/folders vecSrc(0) C:\Relay\Target\F4 vecSrc(1) C:\Relay\Target\F1 Sort vecSrc vector and display (sorted) contents vecSrc(0) C:\Relay\Target\F4 vecSrc(1) C:\Relay\Target\F1
Regards, AB

Currently Vector.sort doesn't support anything other than strings or integers, but we'll expand this in the next beta to work with objects that have a string as their default value (and so the above code would then work).

Ah, OK. In the interim I can use CStr(fd.func.sourcetab.selected(i)) to force the data type to string. While on the subject, any plans to offer a REVERSE option on the sort method?

Regards, AB