Monday, November 08, 2010 at 12:02 AM.

system.verbs.apps.winShell.mapNetworkDrive

on mapNetworkDrive (drive, share) {
	local (s = string (winShell.data.scripts.mapNetworkDrive));
	
	bundle { //error checking
		on driveError () {
			scriptError ("Can't map " + share + " to " + drive + " because " + drive + " is not of the form Z:.")};
		
		if sizeOf (drive) != 2 {
			driveError ()};
		if drive [2] != ":" {
			driveError ()};
		if drive [1] < 'A' or drive [1] > 'z' {
			driveError ()};
		if drive [1] > 'z' and drive [1] < 'a' {
			driveError ()}};
	
	if share endsWith "\\" {
		share = string.delete (share, sizeOf (share), 1)};
	
	return (boolean (com.callScript (s, "VBScript", "Main", {drive, share})))};
bundle { //test code
	winShell.mapNetworkDrive ("F:", "\\\\Madrid\\D Drive");
		<<true
	winShell.mapNetworkDrive ("G:", "\\\\Madrid\\C Drive");
		<<true
	winShell.mapNetworkDrive ("G:", "\\\\Cobra\\Apache")}
		<<false



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.