Map network drive - using vbscript and dialog resourse


I have long struggled to find the 'front door' so to speak with regard to how I can use the scripting features of DO. I see now that they're even more robust in that you have a built in dialog editor. I can think of MANY uses for that in my environment. However, I a very unfamiliar with how to do any of this.

I wonder if I could trouble you for a simple vbscript that asks a user for a UNC path (the user should type it) and them maps that to h:. The prompt should be one of the dialogs that are created using the built-in dialog editor rather than one of the long standing DO message box dialogs.

So basically this in vbscript form with a custom dialog to collect the user input

net use h: {dlgstringS|Which user share?}

This would, I think, be an enormous help in my effort to get something useful built in DO's scripting environment.



They haven't all been tagged but you can find several example scripts which create dialogs using the user-interface tag:

(The manual also has some example code, of course.)

Edit: Better link which restricts to just the Buttons/Scripts area:

Only two tagged at the moment, but there are others if you need more.

Leo, thanks for the quick reply.

So far, it seems like this one, while far more complicated than the simple example I was seeking, must contain the information I'm looking for, plus much more no doubt.


Here's the requested script. I adapted it from the example in the manual.

Function OnClick(ByRef clickData)

    Set Dlg = DOpus.Dlg
    Dlg.window = clickData.func.sourcetab
    Dlg.template = "sharedlg"
    if Dlg.Show Then
		Set cmd = DOpus.Create.Command
		cmd.SetType "msdos"
		cmd.SetModifier "leavedoswindowopen"
		cmd.RunCommand "net use h: """ & Dlg.Control("path").value & """"
	end if
End Function

The resources:

	<resource name="sharedlg" type="dialog">
		<dialog fontsize="8" height="58" lang="english" standard_buttons="ok,cancel" title="Test!" width="180">
			<control halign="left" height="8" name="static1" title="Which user share?" type="static" width="159" x="9" y="6" />
			<control halign="left" height="12" name="path" tip="Enter UNC path" type="edit" width="163" x="9" y="20" />