Selecting moved files to parent dir automatically

Greetings,

Please have a look at the following code:

@set a= {O!} Copy MOVE TO .. Go BACK Select Pattern={$a}

If just one file is selected before applying this code on it, Select Pattern={$a} will work without any problem. But if more than one file are selected, no one of them will be selected after moving to parent dir. Is there any solution way to solve this problem without using a VBScript code?

Regards

Not really - but you could do this another way, using the clipboard, as long as the Preferences / File Operations / Copy Options / Automatically select newly copied files option is turned on.

Clipboard COPY Go BACK Clipboard PASTE

Thanks Jon. I thought it will be very better if I put laziness away and wrote a VBScript :smiley:

Well, this is my code (if others need it too):

[code]Option Explicit

Dim args
set args = WScript.Arguments

Dim Shell
Set Shell = CreateObject("WScript.Shell")

'Set strDOpusrt to the path of DOpusrt.exe on system
Dim strDOpusrt
strDOpusrt = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"

Dim command
Dim nArgsNumbers

' count the number of arguments (i.e. the selected files in DOpus) and select them again
for nArgsNumbers = 0 to (args.Count)-1
command = """" & strDOpusrt & """" & " " & "/cmd" & " " & "Select " & """" & args.Item(nArgsNumbers) & """"
Shell.Run(command)
next
[/code]

I saved it in a file named "Reselect.vbs" and call it with the following button:

Copy MOVE TO .. Go Back {A|dopusdata}\scripts\Reselect.vbs {O!|escwild}

Everything is working good, but a problem:

Why the speed of calling this VBScript by DOpus is so slow? (I mean the time between pressing the button and sending {O!} to my VBScript, not the speed of applying Reselect.vbs on the moved files)

The slow part is probably calling dopusrt.exe once per file.

You could turn it into a single dopusrt.exe call by making the script join all the names together into a wildcard, like (file1.txt|file2.txt|file3.txt)

By the way, do you really want "Go Back" here? The previous folder might not be the parent so you probably want either "Go Up" or "Go Back Up"

[quote="leo"]The slow part is probably calling dopusrt.exe once per file.

You could turn it into a single dopusrt.exe call by making the script join all the names together into a wildcard, like (file1.txt|file2.txt|file3.txt)[/quote]

Thank you so much. Yes, now it is so faster. This is my new code for future needers:

[code]Option Explicit

Dim args
set args = WScript.Arguments

Dim Shell
Set Shell = CreateObject("WScript.Shell")

'Set strDOpusrt to the path of DOpusrt.exe on system
Dim strDOpusrt
strDOpusrt = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"

Dim command
Dim nArgsNumbers

' count the number of arguments (i.e. the selected files in DOpus) and select them again
for nArgsNumbers = 0 to (args.Count)-1
command = command & args.Item(nArgsNumbers) & "|"
next

Shell.Run("""" & strDOpusrt & """" & " " & "/cmd" & " " & "Select " & """(" & command & ")""")
[/code]

It is very strange! When I'm using "Go Up" or "Go Back Up" in my button, I should use dopusrt too, otherwise nothing will work. But with Go Back alone, no need to dopusrt at all. :exclamation: