Page 1 of 1 1
Topic Options
#206238 - 2012-11-21 09:18 AM Kix Script stops on some computers
JimmyMortensen Offline
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:
 Code:
'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:
 Code:
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 Moderator Offline
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:

 Code:
?"calling script 1"
call .....
?"Script 1 finished"


 Code:
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 Offline
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
#206241 - 2012-11-21 10:30 AM Re: Kix Script stops on some computers [Re: JimmyMortensen]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You can replace that section with the code below. It splits the IP address on the space and joins it with nothing so it basically removes the spaces from the IP address. I see nothing strange with the code so I'm not sure why it stops there. Can you display the @IPADDRESS0 marco just before trying to use it so you know if it actually contains any data?

 Code:
$IPAddress = Split(@IPADDRESS0, " ")
$IPAddress = Join($IPAddress, "")
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#206242 - 2012-11-21 01:12 PM Re: Kix Script stops on some computers [Re: Mart]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
Don't you mean Split(@ipaddress0, ".")
i.e. split it on the full stop, there may not be spaces in some addresses
e.g. 192.168.123.123
_________________________
Bill

Top
#206243 - 2012-11-21 01:27 PM Re: Kix Script stops on some computers [Re: BillBarnard]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
You can just use Replace to remove spaces.
I think Jimmy wants the individual parts of the IP address to be used in other called routines. He doesn't say.
So they should also be defined as Global variables.
_________________________
Bill

Top
#206244 - 2012-11-21 02:28 PM Re: Kix Script stops on some computers [Re: BillBarnard]
Glenn Barnas Administrator Offline
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:
 Code:
$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:
 Code:
$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! \:D

Top
#206251 - 2012-11-22 05:48 AM Re: Kix Script stops on some computers [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
And none of this code is going to work when you go native IPv6
Hopefully an update for that is in the works soon too.

Top
#206252 - 2012-11-22 06:23 AM Re: Kix Script stops on some computers [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
which kixtart version you are using?
_________________________
!

download KiXnet

Top
#206253 - 2012-11-22 09:49 AM Re: Kix Script stops on some computers [Re: BillBarnard]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
 Originally Posted By: BillBarnard
Don't you mean Split(@ipaddress0, ".")
i.e. split it on the full stop, there may not be spaces in some addresses
e.g. 192.168.123.123


No. He is removing the spaces from any octet that has less than three digits. For example: Kix returns three digits for every octet like 192.160. 1. 1 which is correct but a bit ugly. Using my code 192.168. 1. 1 will become 192.168.1.1 with no spaces and that is what he is doing at the top of the script with all the LTrim lines. If there are no spaces then nothing will change and the code still works.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#206292 - 2012-11-27 05:51 PM Re: Kix Script stops on some computers [Re: Mart]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
I was assuming the individual parts of the IP address were what was wanted.
$IPAddress1, $IPAddress2 etc.
Perhaps these 5 computers have a common network problem that delays the @ipaddress0 macro from returning a value.
Cheers.
_________________________
Bill

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1336 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.061 seconds in which 0.025 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