Regex in address

Hi,

I'm trying to replace some strings in order to change my sourcepath but I'm not very good with regex :confused:

Here is a simple example:

I'm in this directory:
C:\FOLDER1\AB

How can I go the this other directory using regex expression:
C:\FOLDER1\AzzzB

There's no simple/built-in way to apply a regexp to change paths, but it should be possible with a bit of VBScript glue to make it work.

A bit more info on what the regexp needs to do is needed, though.

Is the starting directory name always going to contain literally two characters? If not, what do you want the regexp to do?

How many starting paths are there? If there are only a few, and they don't change, then there is a much easier way to do this which doesn't require regexps or VBScript.

Are you still using Opus 9 as per your profile, or Opus 10 now?

Hi leo and thank you for your reply.

Unfortunately I will need to change more than one character string.

Here is a real example of one of my needs:

replace:
D:\data\movies\

by:
ftp://192.168.0.2/volume1/data/movies

I don't know if you remember, a few months ago I was searching a way to move quickly big files between shared folder of my NAS.

I think that doing it by FTP can resolve this problem but I need to be able to switch between local browsing and FTP with a shortcut.

Now you know everything :slight_smile:

I'm using DO 10, I change my profile

Try this:

Go ftp://192.168.0.2//volume/{sourcepath|noroot}

Thank you leo, it works but I need to change some character strings.

Can you tell me how can I write exactly the same line in vbscript?

After thatt, I will manage the rest of the script with cases and regex replacement.

You can use dopusrt.exe /acmd to run Opus commands from outside of Opus (e.g. from VBScripts). I'm not sure if that's exactly what you're after?

mmm yes maybe if I run a command with the {sourcepath} as argument I can manage the character strings replacement but I'm not sure this is the simpliest way. In addition I don't wan to use external code to DO.

I read that I can't pass an argument to a vbscript code in a custom button. Is that true?

You can pass arguments to a .vbs script as you would a normal program.

You can also abuse the rename scripting functionality to embed a script into a button, and do something other than renaming.

I'm trying to pass an argument but it doesn't work.

Can you please tell me where is the error? Here is mu button code:

[code]@script vbscript

Function PrintPath(MyPath As string)
MsgBox MyPath
End Function

PrintPath {sourcepath}
[/code]

You can't use @script except with the Rename command / rename scripts. (Not officially, anyway. It might work to some degree but it's by accident rather than design.)

OK

But I can still use vbscript with a button isn't it?

I'm sorry for all these questions but I'm not a developer and I'm a little lost with my problem.

You can either put the VBScript into a .vbs file and call that from the button like you'd call a program (i.e. like calling an .exe), or you can use the rename script method I linked to above. ("Abusing rename scripts")

I think that I almost have what I want except the fact that I don't know how to read the vbscript return value.

I run an external script like as you suggest but how can I get the return value from this script to "Go" to this value?

Thank you

up

You can run dopusrt.exe from the script to send commands back to Opus. See my 3rd post in this thread, above.

Thank you

To run an executable from a vbscript I have to write:

MyCmd = "MyProgram.exe"

and

Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run MyCmd

When I write

MyCmd = "notepad.exe"

It works perfectly but when I write

CMD = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe /acmd Go C:\"

or

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe /acmd Go " & chr(34) & "C:\" & chr(34)

it doesn't work. I have an error like "file not found" but in french ^^

Do you know why?
Thank you for your help, it almost done :slight_smile:

Doesn't the closing quotation mark come after the .exe?

CMD = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /acmd Go C:\

You need some more quotation marks. This should work:

Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run """C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"" /acmd Go C:\"

Thank you guys! It works! :thumbsup: