Page 1 of 1 1
Topic Options
#136010 - 2005-03-21 10:48 PM Map drives dynamically
ScriptIt Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 7
Is there a way to map drives dynamically using the IF INGROUP. In other words, can I use the if ingroup without designating a drive letter?
Top
#136011 - 2005-03-21 11:51 PM Re: Map drives dynamically
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You can use one of the MAPDRIVE() UDFs to do this..

MapDrive() - Maps a UNC name to a specific driveletter

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#136012 - 2005-03-22 12:05 AM Re: Map drives dynamically
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4452
Loc: USA
I believe starting with version 4.22, USE supports *. So your code would look something like this:

Code:
  

use * "\\server\share"
? @result
? @serror


Top
#136013 - 2005-03-22 12:07 AM Re: Map drives dynamically
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here is a bit of code that I robbed from my 2433A Course and converted over that should cover this:
Code:

CLS
BREAK ON
$oFSO=CreateObject('Scripting.FileSystemObject')
; Loop through all used drives
;For each $oDrive in $Onetwork.EnumNetworkDrives
For each $drive in $oFSO.Drives
$sFinalDrive=Left($drive,1)
Next
; Convert final used Drive to ASC and add 1 and return to character
$sNextDrive=CHR(ASC($sFinalDrive)+1)+':'
;Map New Drive
USE $sNextDrive '\\<SOMESERVER>\APPS'
IF @ERROR<>0
?'COULD NOT MAP DRIVE DUE TO '+@SERROR
ENDIF



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#136014 - 2005-03-22 12:09 AM Re: Map drives dynamically
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Allen,

You are correct (from page 4 of the guide):
Quote:


USE USE now supports automatic drive selection ("USE * \\server\share").





However, it maps the next available drive as drive Z:, where when I used WSCRIPT version from the 2433A Course, it put my next drive as drive U:.. Hmmmm.

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#136015 - 2005-03-22 12:13 AM Re: Map drives dynamically
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4452
Loc: USA
Yeah... it kinda makes your code above and my MapDriveX() UDF kind of useless.
Top
#136016 - 2005-03-22 12:29 AM Re: Map drives dynamically
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
Quote:

I believe starting with version 4.22, USE supports *. So your code would look something like this:

Code:
  
use * "\\server\share"
? @result
? @serror






I'm not sure do I read correctly.
for far as I know, "use *" has been there since 1990's
_________________________
!

download KiXnet

Top
#136017 - 2005-03-22 12:32 AM Re: Map drives dynamically
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
weird...
what the heck is that automatic redirection ruud talks about?
_________________________
!

download KiXnet

Top
#136018 - 2005-03-22 12:34 AM Re: Map drives dynamically
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4452
Loc: USA
* may not have been new, but using it to map drives evidently was... see the pages 3-5, "What's New", of the manual.
Top
#136019 - 2005-03-22 12:36 AM Re: Map drives dynamically
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
trust me, it was there already in 3.47 which dates back to 1998!
and trust me, I know my kixtart and it's "use"
_________________________
!

download KiXnet

Top
#136020 - 2005-03-22 12:40 AM Re: Map drives dynamically
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
New or old... it's still a really bad idea.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#136021 - 2005-03-24 03:16 AM Re: Map drives dynamically
ScriptWhat Offline
Lurker

Registered: 2005-03-15
Posts: 2
Why is it a bad idea.
Top
#136022 - 2005-03-24 03:23 AM Re: Map drives dynamically
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It not only causes confusion for users when the drive letter varies for different individuals but it also results in broken hard links in files.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#136023 - 2005-03-24 03:35 AM Re: Map drives dynamically
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I have to agree with Les on this one. Drives should be consistent among group members.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#136024 - 2005-03-24 06:51 AM Re: Map drives dynamically
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
well.
it would force your clients to learn and soon it would be just fine.
hardlinking is a pain anyways.

but, ideal dream is not what I get.
I do also have properly named drives for different groups.


Edited by Lonkero (2005-03-24 06:52 AM)
_________________________
!

download KiXnet

Top
#136025 - 2005-03-24 03:01 PM Re: Map drives dynamically
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I abstract the true path by consolidating my shares using DFS. I use just three drive letters that are the same for everybody except of course their home drive which is the same letter but different path but still hosted through the DFS.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 167 anonymous users online.
Newest Members
gkustra, emnipetro, Hirze, thequeen, ameliaryan
17642 Registered Users

Generated in 0.037 seconds in which 0.011 seconds were spent on a total of 12 queries. Zlib compression enabled.

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