#166652 - 2006-08-31 12:11 PM
Dynamic label mapped drives ?
|
Pookie62
Fresh Scripter
Registered: 2003-10-09
Posts: 37
Loc: Netherlands
|
Hi all, I have this piece of code to map a drive to specific groups. How can I label this mapped drive with a friendly name ? let's say the sharename.. Code:
DIM $strShareRoot, $IntNoUnits, $arrUnit, $arrShare, $arrDrive, $intNextDrive, $intUnit
$strShareRoot = "\\Server\" $intNoUnits = 8 $arrUnit = "_Prod", "_HR", "_AP", "_APSecr", "_FA", "Helpdesk", "_PZ", "_Dir" $arrShare = "Prod$", "HR$", "AP$", "AP$", "Fin$", "IT$", "PZ$", "Dir$" $arrDrive = "U:", "V:", "W:", "X:", "Y:", "Z:" $intNextDrive = 0
For $intUnit = 0 To $intNoUnits - 1
If InGroup($arrUnit[$intUnit]) Use $arrDrive[$intNextDrive] $strShareRoot + $arrShare[$intUnit] $intNextDrive = $intNextDrive + 1 EndIf
|
|
Top
|
|
|
|
#166655 - 2006-08-31 12:38 PM
Re: Dynamic label mapped drives ?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
|
|
Top
|
|
|
|
#166656 - 2006-08-31 01:02 PM
Re: Dynamic label mapped drives ?
|
Pookie62
Fresh Scripter
Registered: 2003-10-09
Posts: 37
Loc: Netherlands
|
Thanks for your replies, I am using this UDF: Code:
Function label($_d,optional $_s) $=CreateObject("shell.application") If VarType($_s) $.namespace(Left($_d,1)+":\").self.name=$_s Exit @ERROR Else $label = $.namespace(Left($_d,1)+":\").self.name Exit @ERROR EndIf EndFunction
Just am looking for a combination of these posted code snippets..
|
|
Top
|
|
|
|
#166657 - 2006-09-02 03:00 PM
Re: Dynamic label mapped drives ?
|
Pookie62
Fresh Scripter
Registered: 2003-10-09
Posts: 37
Loc: Netherlands
|
Guess I have to define a new array: $friendlynames and use this somehow. Anyone ?
|
|
Top
|
|
|
|
#166658 - 2006-09-02 08:20 PM
Re: Dynamic label mapped drives ?
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
yep, that would suite. then you would use the udf after the use line like this: Code:
label($arrDrive[$intNextDrive],$friendlyName[$intNextDrive])
|
|
Top
|
|
|
|
#166662 - 2006-09-03 10:53 AM
Re: Dynamic label mapped drives ?
|
Pookie62
Fresh Scripter
Registered: 2003-10-09
Posts: 37
Loc: Netherlands
|
Quote:
Jooel, it is about the first post from Pookie62 Three arrays are made: Units, Shares and Drives. If a user is in a unit, he gets a share mapped to a drive.
This is the idea, Witto But why isn't it a good idea? What do you mean with "musical letters" ?
Edited by Pookie62 (2006-09-03 10:54 AM)
|
|
Top
|
|
|
|
#166663 - 2006-09-03 12:05 PM
Re: Dynamic label mapped drives ?
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Simple example. We both are computer illiterates (imagine, very hard!!!) For you, HR$ = V:. For me, HR$ = W:. I create 2 excel workbooks. In the second, Workbook2, I link to a range of cells in W:\Workbook1. Now you have to read Workbook2. I am afraid you will have a problem. Maybe you will say I could have referred to \\server\share\workbook1, but as I said, we are computer illiterates... Other example: Maybe one day, you will be in one more group and for you, the HR$ share at once becomes W:. For many users, these kinds of actions are very confusing.
|
|
Top
|
|
|
|
#166664 - 2006-09-03 12:12 PM
Re: Dynamic label mapped drives ?
|
Pookie62
Fresh Scripter
Registered: 2003-10-09
Posts: 37
Loc: Netherlands
|
You have a point here.. Still, as my enviroment is not very dynamic (or big) I am going to try this. Of course I'll test with groupmemberships etc to see what happens. Thanks for your time and support (all of you..) ;-)
|
|
Top
|
|
|
|
#166667 - 2006-09-04 12:49 AM
Re: Dynamic label mapped drives ?
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k, I see now. he uses the secondary calculator inside the for. so, to fix this musical thingie, all he needs to do is to remove that stuff. Code:
DIM $strShareRoot, $IntNoUnits, $arrUnit, $arrShare, $arrDrive, $intNextDrive, $intUnit
$strShareRoot = "\\Server\" $arrUnit = "_Prod", "_HR", "_AP", "_APSecr", "_FA", "Helpdesk", "_PZ", "_Dir" $arrShare = "Prod$", "HR$", "AP$", "AP$", "Fin$", "IT$", "PZ$", "Dir$" $arrDrive = "U:", "V:", "W:", "X:", "Y:", "Z:" $FriendlyName = "U share", "V Share", "W Share", "X Share", "Y Share", "Z Share"
For $intUnit = 0 To ubound($arrUnit) If InGroup($arrUnit[$intUnit]) Use $arrDrive[$intUnit] $strShareRoot + $arrShare[$intUnit] label($arrDrive[$intUnit],$FriendlyName[$intUnit]) EndIf next
right?
|
|
Top
|
|
|
|
#166668 - 2006-09-04 01:00 AM
Re: Dynamic label mapped drives ?
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Well, there are 8 possible groups, so I would expect 8 possible drive letters. Code:
$arrDrive = "S:", "T:", "U:", "V:", "W:", "X:", "Y:", "Z:" $FriendlyName = "S share", "T Share", "U share", "V Share", "W Share", "X Share", "Y Share", "Z Share"
Would there also be a good reason to stay away from the Z: share? Maybe in worst case there is still a W9x computer or so... I thought I read somewhere something...
|
|
Top
|
|
|
|
#166670 - 2006-09-04 01:05 AM
Re: Dynamic label mapped drives ?
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Code:
$arrDrive = "R:", "S:", "T:", "U:", "V:", "W:", "X:", "Y:" $FriendlyName ="R Share", "S share", "T Share", "U share", "V Share", "W Share", "X Share", "Y Share"
|
|
Top
|
|
|
|
#166671 - 2006-09-04 01:18 AM
Re: Dynamic label mapped drives ?
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Quote:
to fix this musical thingie
Just to get a good definition of "musical drive letters"... Can this be called musical?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2009 anonymous users online.
|
|
|