Working with Variable Strings and Substrings

Hello Everyone I'm new to the forum. I love Dopus though!

I'd like to know what instructions to put onto a button to make it do something for me. I am a very competent Flash Actionscripter who is completely lost on how to do the following.

I have a Y: drive that is on a webserver. When I place files there, they are also accessible online at web.company.com/TestFolder.

So in conclusion. How do I convert Y:\TestFolder to web.company.com/TestFolder?

Here is my diluted attempt:
@set myPath={F}
MagicallyConvert {$myPath}
C:\Program Files\Internet Explorer\iexplore.exe {$myPath}

It's not very clear but maybe :question:

Clipboard COPYNAMES=nopaths
C:\Program Files\Internet Explorer\iexplore.exe web.company.com/{clip}.

Seems like a good job for a little VBScript.

The following VBScript (also attached) will take its argument and:
[ul][li]Remove [b]Y:[/b] from the front[/li]
[li]replace it with http://web.company.com/[/li]
[li]replace any [b][/b] with /[/li]
[li]launch the URL with the default web browser[/li][/ul]
It will work with subdirectories, not just those directly below Y:, and it'll leave your clipboard alone. It won't cope well with spaces and other characters that need encoding when used in URLs, but that would be easy enough to add if it was needed.

If you need to change the drive letter or URL they're both near the top of the script.

To run it from Opus you could use this, to launch the current directory:

Launch_Y-Drive.vbs {sourcepath$}

Or you could use this to launch the selected file or directory:

Launch_Y-Drive.vbs {filepath$}

If the path given to the script doesn't start with Y:\ it will show an error message.

[code]option explicit

Dim Args
Dim Shell
Dim PrefixToRemove
Dim BaseUrl
Dim InPath
Dim SuffixPath
Dim UrlToLaunch

' Configuration:
PrefixToRemove = "Y:"
BaseUrl = "http://web.company.com/"

Set Args = WScript.Arguments
Set Shell = CreateObject("WScript.Shell")

If Args.Count = 0 Then
MsgBox WScript.ScriptName & ": No argument given. Give a path as the argument."
WScript.Quit 1
End If

If Args.Count > 1 Then
MsgBox WScript.ScriptName & ": Too many arguments given."
WScript.Quit 1
End If

InPath = Args.Item(0)

If LCase(Left(InPath,Len(PrefixToRemove))) <> LCase(PrefixToRemove) Then
MsgBox WScript.ScriptName & ": Path does not start with " & PrefixToRemove & "."
WScript.Quit 1
End If

SuffixPath = Right(InPath,Len(InPath)-Len(PrefixToRemove))

SuffixPath = Replace(SuffixPath,"","/")

UrlToLaunch = BaseUrl & SuffixPath

Shell.Run UrlToLaunch[/code]
Launch_Y-Drive.zip (532 Bytes)

That is a beautiful thing. Makes me cry a little.

Thanks so much guys!!!