#21818 - 2002-05-21 12:09 AM
creating shares... The hard way...
|
MeneM
Lurker
Registered: 2002-05-20
Posts: 4
Loc: Amsterdam
|
Hi all,
I'm new to kixtart. But I can already say it is one of the more handy things to know. I'm also proud that it was a dutchman who invented it. Ofcourse with the input of many others.
I would like some help on the following piece of code wich i cannot get to work properly:
code:
$server = server $shares = Mark,www,hdd,Public $drives = e:,f:,g:,h: $I = 0
FOR EACH $mapping IN $shares use $drives[$I] \\$server\$mapping $I = $I + 1 NEXT
I think it obvious what I want it to do, but it wont work right. So... What am I doing wrong?
Mark
|
|
Top
|
|
|
|
#21819 - 2002-05-21 12:20 AM
Re: creating shares... The hard way...
|
Darren_W
Hey THIS is FUN
   
Registered: 2001-10-10
Posts: 208
Loc: Bristol, England
|
Hi,
I think your values should be in speech marks. EG:
code:
$server = "server" $shares = "Mark","www","hdd","Public" $drives = "e:","f:","g:","h:" $I = 0 FOR EACH $mapping IN $shares use $drives[$I] \\$server\$mapping $I = $I + 1 NEXT
Darren
_________________________
I want to share something with you - the three sentences that will get you through life. Number 1, 'cover for me.' Number 2, 'oh, good idea, boss.' Number 3, 'it was like that when I got here'.
|
|
Top
|
|
|
|
#21820 - 2002-05-21 12:25 AM
Re: creating shares... The hard way...
|
MeneM
Lurker
Registered: 2002-05-20
Posts: 4
Loc: Amsterdam
|
What a mistaike to maike...
Well changed that bit, although Those shares are not created yet. Bummer.
Any other idea's?
Mark
|
|
Top
|
|
|
|
#21821 - 2002-05-21 12:34 AM
Re: creating shares... The hard way...
|
MeneM
Lurker
Registered: 2002-05-20
Posts: 4
Loc: Amsterdam
|
In this try I made sure $I is an integer and not a string. So it now looks like this:
code:
$server = "server" $shares = "Mark","www","hdd","Public" $drives = "e:","f:","g:","h:" $I = "0" $I = val("$I")
FOR EACH $mapping IN $shares use $drives[$I] \\$server\$mapping $I = $I + 1 NEXT
And guess what? It still won't work...
Mark
|
|
Top
|
|
|
|
#21823 - 2002-05-20 03:05 PM
Re: creating shares... The hard way...
|
MeneM
Lurker
Registered: 2002-05-20
Posts: 4
Loc: Amsterdam
|
Hell yeah! That worked!
I'm so glad. Thank you.
Maybe you would care to explain to me what I did wrong/Why it did not work?
Mark
|
|
Top
|
|
|
|
#21824 - 2002-05-20 03:26 PM
Re: creating shares... The hard way...
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
Try this, I formatted the code properly. The backslashes have been put in quotes. code:
$server = "server" $shares = "Mark","www","hdd","Public" $drives = "e:","f:","g:","h:" $I = 0 FOR EACH $mapping IN $shares USE $drives[$I] '\\'+$server+'\'+$mapping $I = $I + 1 NEXT
As an alternative, you might want to put your mappings configuration into a .INI file. This way you can update drive mappings without changing the script code. An example for printer mappings is provided here: http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=1;t=004838 It would be very easy to translate it for drive mappings.
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 584 anonymous users online.
|
|
|