#206238 - 2012-11-21 09:18 AM
Kix Script stops on some computers
|
JimmyMortensen
Just in Town
Registered: 2006-09-26
Posts: 2
Loc: Aarhus, Denmark
|
Hi gurus.
I have a weird problem - On approx 5 computers the login-script stops with a CMD-window and nothing happens until you turn the power off. You can then restart numerous times until it succeeds in logging in.
The funny thing is, if i put a: 'Press any key...' Get $ ? on the very first line it works (after the user has pressed any key).
I've tried deleting the KIX-file, and making a new file with another name and copy pasting the below mentioned code into it - but the same story applies. If I insert the Get-command it works, and If I remove it nothing but a black screen appears. And the computer doesn't recover in time - I've waited for a whole night without nothing happening.
The entire script:
Break on
$LogonServer = SubStr(@LSERVER,3,LEN(@LSERVER))
CLS
;Defining constants !
; Default - 640x480
$ScreenCols=80 $ScreenLines=36
$ScreenEnd=80
Shell '%COMSPEC% /C MODE CON COLS=$ScreenCols'
Shell '%COMSPEC% /C MODE CON Lines=$ScreenLines'
$IPAddress1 = LTRIM(SubStr(@IPAddress0,1,3))
$IPAddress2 = LTRIM(SubStr(@IPAddress0,5,3))
$IPAddress3 = LTRIM(SubStr(@IPAddress0,9,3))
$IPAddress4 = LTRIM(SubStr(@IPAddress0,13,3))
COLOR b+/w
Box(1,1,7,78,single)
$Fullname = UCASE(@Fullname)
At (3,5) 'Hello @Fullname'
At (5,5) 'You are logging onto domain @Domain (Logonserver: @lserver)'
COLOR w+/n
At (7,1)
$ServerPath = '@LSERVER\NETLOGON'
Call '@LSERVER\NETLOGON\Functions.kix'
$FunctionsDeclared = 'yes'
; Calling basic information script
Call '@LSERVER\NETLOGON\BasicInfo.kix'
; Giving resources (shares)
IF Exist ('$ServerPath\Resource\SharesV2.KIX')
Call '$ServerPath\Resource\SharesV2.KIX'
Endif
; Giving resources (shares)
IF Exist ('$ServerPath\Resource\SharesExtraV2.KIX')
; Call '$ServerPath\Resource\SharesExtraV2.KIX'
Endif
; Checking applications
IF Exist ('$ServerPath\Manager\Manager.KIX')
Call '$ServerPath\Manager\Manager.KIX'
Endif
;; Giving resources (printers)
;IF Exist ('$ServerPath\Resource\PrintersV22.kix')
; Call '$ServerPath\Resource\PrintersV22.KIX'
;Endif
; Calling Outlook script, if available
IF Exist ('$ServerPath\Files\Outlook\Outlook_config.kix')
Call '$ServerPath\Files\Outlook\Outlook_config.kix'
Endif
; Resetting Outlook foldernames to Danish
;IF Exist ('@LSERVER\NETLOGON\Files\Outlook\ResetFolderNames.kix')
; Call '@LSERVER\NETLOGON\Files\Outlook\ResetFolderNames.kix'
;Endif
:EndJob
I really hope that someone know what is going on, because I certainly don't.
Regards Jimmy Dan Mortensen
|
|
Top
|
|
|
|
#206239 - 2012-11-21 09:33 AM
Re: Kix Script stops on some computers
[Re: JimmyMortensen]
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
Hi Jimmy and welcome to the board.
First thing that stand out is that you have variables and macros inside strings. This is not best practice and could lead to issues when the variables and/or macros are not resolved to their actual value. The script below has that fixed (but not tested). I would suggest to put in some debugging code at the start and end of each action so you get an idea of what part is messing things up.. Something like:
?"calling script 1"
call .....
?"Script 1 finished"
Break on
$LogonServer = SubStr(@LSERVER,3,Len(@LSERVER))
CLS
;Defining constants !
; Default - 640x480
$ScreenCols=80
$ScreenLines=36
$ScreenEnd=80
Shell '%COMSPEC% /C MODE CON COLS=' + $ScreenCols
Shell '%COMSPEC% /C MODE CON Lines=' + $ScreenLines
$IPAddress1 = LTrim(SubStr(@IPAddress0,1,3))
$IPAddress2 = LTrim(SubStr(@IPAddress0,5,3))
$IPAddress3 = LTrim(SubStr(@IPAddress0,9,3))
$IPAddress4 = LTrim(SubStr(@IPAddress0,13,3))
Color b+/w
Box(1,1,7,78,single)
$Fullname = UCase(@Fullname)
At (3,5) 'Hello ' + @Fullname
At (5,5) 'You are logging onto domain ' + @Domain + ' (Logonserver: ' + @lserver + ')'
Color w+/n
At (7,1)
$ServerPath = @LSERVER + '\NETLOGON'
Call @LSERVER + '\NETLOGON\Functions.kix'
$FunctionsDeclared = 'yes'
; Calling basic information script
Call @LSERVER + '\NETLOGON\BasicInfo.kix'
; Giving resources (shares)
If Exist ($ServerPath + '\Resource\SharesV2.KIX')
Call $ServerPath + '\Resource\SharesV2.KIX'
EndIf
; Giving resources (shares)
If Exist ($ServerPath + '\Resource\SharesExtraV2.KIX')
; Call $ServerPath + '\Resource\SharesExtraV2.KIX'
EndIf
; Checking applications
If Exist ($ServerPath + '\Manager\Manager.KIX')
Call $ServerPath + '\Manager\Manager.KIX'
EndIf
;; Giving resources (printers)
;IF Exist ($ServerPath + '\Resource\PrintersV22.kix')
; Call $ServerPath + '\Resource\PrintersV22.KIX'
;Endif
; Calling Outlook script, if available
If Exist ($ServerPath + '\Files\Outlook\Outlook_config.kix')
Call $ServerPath + '\Files\Outlook\Outlook_config.kix'
EndIf
; Resetting Outlook foldernames to Danish
;IF Exist (@LSERVER + '\NETLOGON\Files\Outlook\ResetFolderNames.kix')
; Call @LSERVER + '\NETLOGON\Files\Outlook\ResetFolderNames.kix'
;Endif
:EndJob
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
|
Top
|
|
|
|
#206240 - 2012-11-21 09:57 AM
Re: Kix Script stops on some computers
[Re: JimmyMortensen]
|
JimmyMortensen
Just in Town
Registered: 2006-09-26
Posts: 2
Loc: Aarhus, Denmark
|
More info :-)
If i put remarks on these lines:
$IPAddress1 = LTRIM(SubStr(@IPAddress0,1,3)) $IPAddress2 = LTRIM(SubStr(@IPAddress0,5,3)) $IPAddress3 = LTRIM(SubStr(@IPAddress0,9,3)) $IPAddress4 = LTRIM(SubStr(@IPAddress0,13,3))
It works ???
Any thoughts? Jimmy Dan Mortensen
|
|
Top
|
|
|
|
#206244 - 2012-11-21 02:28 PM
Re: Kix Script stops on some computers
[Re: BillBarnard]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
|
Bill,
Replace is a relativly new function, so many of us use Join(Split()) instead for wider source compatability. Mart's example will just remove spaces, returning a dotted-decimal format.
Since the OP doesn't show how the individual IP elements are used, the resulting dotted-decimal format is now easy to break into a 4-element array: $IPAddress = Join(Split(@IPADDRESS0, ''), '')
$aIpAddr = Split($IPAddress, '.')
Still, it's odd that eliminating that code resolves the problem.
Jimmy: The line "$LogonServer = SubStr(@LSERVER,3,Len(@LSERVER))" is not 100% correct.. If the len of @LSERVER is 9, the statement says "Return 9 characters from the @LSERVER string, starting with the third character." Kix is forgiving and returns 7 characters, but a more accurate statement is also simpler to construct:$LogonServer = SubStr(@LSERVER,3) This says "Return all remaining chars from the string, starting with the third character". Both return the same value, so not entirely "wrong", but could throw an error if used in this manner in another (less forgiving) language.
As for "variables and macros in strings" change At (3,5) 'Hello @Fullname' to At (3,5) 'Hello ' @Fullname which keeps macros out of strings. The reason for this is to avoid ambiguity in evaluating string contents.. combined with the SetOption function you can disable kix from processing macros and variables inside of strings so it will print "$" or "@" when you expect it to.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|