Page 1 of 2 12>
Topic Options
#166652 - 2006-08-31 12:11 PM Dynamic label mapped drives ?
Pookie62 Offline
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
#166653 - 2006-08-31 12:33 PM Re: Dynamic label mapped drives ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Search the UDF forum for a handy drive label UDF.
Top
#166654 - 2006-08-31 12:38 PM Re: Dynamic label mapped drives ?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
there are at least 2 of them.

I have a MapDrive() UDF and I think Lonk did a standalone label()

Top
#166655 - 2006-08-31 12:38 PM Re: Dynamic label mapped drives ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Or do the mapping and labelling in one go...
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=82133

Top
#166656 - 2006-08-31 01:02 PM Re: Dynamic label mapped drives ?
Pookie62 Offline
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 Offline
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 Administrator Offline
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
#166659 - 2006-09-02 08:36 PM Re: Dynamic label mapped drives ?
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I get the impression that if a user gets a drive mapped, it is not per default the same for other users.
If that is true, I think that is not a good idea.

Top
#166660 - 2006-09-02 08:53 PM Re: Dynamic label mapped drives ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
witto, could you specify better what you mean?
not sure I understand...

Top
#166661 - 2006-09-02 09:02 PM Re: Dynamic label mapped drives ?
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
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.
I get the impression this will produce "musical drive letters" as Les would call them.

Top
#166662 - 2006-09-03 10:53 AM Re: Dynamic label mapped drives ?
Pookie62 Offline
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 Offline
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 Offline
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
#166665 - 2006-09-04 12:05 AM Re: Dynamic label mapped drives ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
witto, I'm still missing your point.
the third array in his original code says what drive letter should be attached.
no music there dude.

Top
#166666 - 2006-09-04 12:38 AM Re: Dynamic label mapped drives ?
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Sorry for the misunderstanding.
I presume that:
if I would be in "_Prod" and "_HR" my "Prod$" would be "U:" and my "HR$" would be "V:".
If you would be in "_HR", your "HR$" would be "U:"
If you told me you stored something on "U:" for me, I would have to search for it. You could send me p.e. an incorrect link via e-mail.
Maybe one day, you would also need to be in "_Prod". At once, after the change, al your mappings shift one down.
Anyway, all of this is quite confusing to users and should IMHO be avoided. That's all.
Maybe I am wrong about the definition of "musical drive letters".

Top
#166667 - 2006-09-04 12:49 AM Re: Dynamic label mapped drives ?
Lonkero Administrator Offline
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 Offline
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
#166669 - 2006-09-04 01:03 AM Re: Dynamic label mapped drives ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, Z: for wintendos and I always move the CD to Z: on all my servers.
Top
#166670 - 2006-09-04 01:05 AM Re: Dynamic label mapped drives ?
Witto Offline
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 Offline
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
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2009 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.076 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org