#120733 - 2004-06-07 04:17 PM
script exits unexpectedly
|
Udaloy
Fresh Scripter
Registered: 2003-09-08
Posts: 31
Loc: Ohio
|
I was redirected to this forum, so here goes.
Quote:
Hello all,
Last Thursday or Friday, I started getting calls about some people's network drives not getting mapped. I ran the script in debug mode, and I found that the script is exiting before it's completed. Right in the middle of the script, for no good reason. The whole script is to map an S: drive depending on which department you are in. This script has worked for about a year or so without a hitch, and now it's exiting at this code:
Code:
$X = "\\kdata02\" $name = @USERID Use s: /Del /persistent
:PROGRAMMERS
If InGroup("Programmers") Use q: /Del Use q: $X+"development" ?"Q: drive mapped to Development share" EndIf
:YEARENDTAX
If InGroup("YearEndTax") Use y: /Del Use y: $X+"yearendtax" ?'Y: drive mapped to YearEndTax share' EndIf
:ACCOUNTING
If InGroup("accounting") OR InGroup("Finan Actg Intern") OR InGroup("Accounts Receivable") If $name = "skutlen" GoTo BILLING EndIf Use s: $x+"accounting" ?'S: drive mapped to accounting share' EndIf
:BILLING
If InGroup("billing") OR InGroup("commercial billing") OR InGroup("utility billing") OR InGroup("residential billing") If $name = "claassek" GoTo Surgery Payroll EndIf Use s: $x+"billing" ?'S: drive mapped to Billing share' EndIf
:SURGERYPAYROLL
If InGroup("SurgeryPayroll") If $name = "mazurd" GoTo INFOSPAN Else If $name = "nealv" Use q: $x+"Surgery Payr" GoTo INFOSPAN EndIf Use s: /Del Use s: $x+"Surgery Payr" ?'S: drive mapped to Surgery Payroll share' EndIf
:INFOSPAN ;This drive letter has to be x in order for infospan to run properly If InGroup("infospan users") Use x: "\\Infospan\Shared" ?'X: drive mapped to Infospan share' EndIf
:PERSONNEL
If InGroup("personnel") OR InGroup("employee records") OR InGroup("office services") Use s: $x+"personnel" ?'S: drive mapped to Personnel share' EndIf
:MARKETING
If InGroup("MARKETING") Use s: $x+"marketing" ?'S: drive mapped to Marketing share' If InGroup("Residential Services") Use r: /Del Use r: $x+"Residential" ?'R: drive mapped to Residential share' GoTo TREASURY EndIf EndIf
:RESIDENTIAL
If InGroup("residential services") Use s: $x+"Residential" ?'S: drive mapped to Residential share' EndIf
:UTILITY
If InGroup("utility") OR InGroup("utility services") Use s: $x+"utility" ?'S: drive mapped to Utility share' EndIf
:SAFETY
If InGroup("safety") Use s: $x+"safety" ?'S: drive mapped to Safety share' EndIf
:PURCHASING
If InGroup("purchasing") Use s: $x+"purchasing" ?'S: drive mapped to Purchasing share' EndIf
:EQUIPMENT
If InGroup("equipment") Use s: $x+"equipment" ?'S: drive mapped to Equipment share' EndIf
:ACQUISITION
If InGroup("acquistion integrat") Use L: /Del Use L: $x+"Acquisition" ?'L: drive mapped to Acquisition share' EndIf
:NEWVENTURES
If InGroup("New Ventures") Use h: /Del Use h: "\\kdata02\new ventures" ?"H: drive mapped to New Ventures share" EndIf
:END
Exit
The script exits just after the Marketing section. The reason for the goto is to skip the very next If InGroup line, as there is a person in Marketing that is also in Residential Services, and mapping two S: drives isn't productive.
This particular code happens to be on line 125, not the problem in my opinion. Any ideas?
$X is pointing to the correct server.
|
|
Top
|
|
|
|
#120735 - 2004-06-07 04:55 PM
Re: script exits unexpectedly
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Well, this is wrong for a start: Code:
If $name = "mazurd" GoTo INFOSPAN Else If $name = "nealv" Use q: $x+"Surgery Payr" GoTo INFOSPAN EndIf
Every "IF" must have a corresponding "ENDIF".
|
|
Top
|
|
|
|
#120737 - 2004-06-07 05:06 PM
Re: script exits unexpectedly
|
Udaloy
Fresh Scripter
Registered: 2003-09-08
Posts: 31
Loc: Ohio
|
My inital results show that you are correct. I'm having the users log off and back on now. Isn't there a statement that forces the code syntax to be correct before it will save? I thought I saw that in someone's script before. Sort of like the implicit statement in VB.
Lonkero, thank you! I owe you one.
Udaloy
|
|
Top
|
|
|
|
#120739 - 2004-06-07 05:53 PM
Re: script exits unexpectedly
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
You can use MCA's "kixstrip" checking tool available from his site http://home.wanadoo.nl/scripting/
It can be a bit wordy and daunting though.
|
|
Top
|
|
|
|
#120740 - 2004-06-07 07:24 PM
Re: script exits unexpectedly
|
Udaloy
Fresh Scripter
Registered: 2003-09-08
Posts: 31
Loc: Ohio
|
Richard,
I'll check out that link, thanks. I found what I was thinking about though, it was Code:
;Dim $SO ;$SO=SetOption('Explicit','On')
Does anyone know what the Explicit option does for Kix? Thanx.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
|