Page 1 of 1 1
Topic Options
#63555 - 2002-03-06 12:22 AM Does KIX32 read code between GOTO "LABEL" and :LABEL??
Michael Hovej Offline
Lurker

Registered: 2002-03-05
Posts: 2
Loc: Denmark
In our organization we have a script that contains almost 2000 lines of kix.code!! After introducing 5 lines it failed and Iīve just found out what failed, but I donīt understand....

Example

$SERVER=LOCALSERVER

IF INGROUP ("101") GOTO "101"
IF INGROUP ("202") GOTO "202"

:101
USE E: "\\SERVER\ESHARE"
USE F: "\\SERVER\FSHARE"
GOTO "GENERAL"

:202
USE E: "\\SERVER\ESHARE"
USE F: "\\SERVER\FSHARE"

;CHANGE UNINSTALL PATH FOR MCAFEE
$mcafee = Readvalue
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{87AEFD84-BC0D-11D4-B885-00508B022A51}","InstallSource")
If $mcafee="\\\\SERVER1\\mcafee\\Win32\\"
Else
SHELL "$SERVER\REPOSITORY\MCAFEE\BATCH.BAT" $SERVER"

ENDIF

GOTO "GENERAL"


:GENERAL

Here is the explanation and question.
When running this I want the users from different loactions to only run their part of the script, but if a user from "101" logs on, it runs the script and fails. It says tha it canīt find :LABEL, it means that it canīt jump to :GENERAL, which it doesnīt do.
Iīve found out that it fails because there is a (") too much in the line
SHELL "$SERVER\REPOSITORY\MCAFEE\BATCH.BAT" $SERVER"

This is true there shouldnīt have been one after BATCH.BAT. So the functioning line looks like this
SHELL "$SERVER\REPOSITORY\MCAFEE\BATCH.BAT $SERVER"

But why do the 101 users encounter this error since they never run the 202 section, where the line is???

Does kix read code that it is supposed to ignore???

Iīve tried for fun to introduce an error that fails.

GOTO "HI"
shell "c:\winnt\test.bat" localserver"
:HI

It never gets to :HI but fails and says that it canīt find :LABEL!!!!


Regards
Michael Hovej
Systemsconsultant

Top
#63556 - 2002-03-06 12:36 AM Re: Does KIX32 read code between GOTO "LABEL" and :LABEL??
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
There are two things here.

First, KiXtart needs to read through the entire script to parse it - until it does it won't know where to find the label that you want to jump to

Note, it is not executing the script at this stage, just reading it in and parsing it into a form that it can run it in later.

The second thing is the extra quote (") character. The problem with this tricky devil is that KiXtart does not treat an end of line as anything special. For instance:

code:
$sString="This is a multi-line
string that has carriage returns
embedded in it"


This is perfectly valid, and creates a string with carriage returns in. This is also valid:
code:
Function udfDemoFunction(
$iParameter1,
$iParameter2,
Optional $sParameter3)
...

What happens in your case is that after the extra " character eveything you think is enclosed in quotes isn't, and everything that you think isn't, is. Got that?

Ok, in the following simple example the text in italics is considered to be within quotes. The text in bold is considered to be script code.

Break on CLS
"Display Some Text"" ?
$sVariable=
"Assign Text"
if @USERID="rhowarth"
"Hi Rich" ?
EndIf

As you can see, KiXtart will try to execute "Assign Text", "rhowarth" and "Hi Rich" as script commands and will error.

[ 05 March 2002: Message edited by: Richard Howarth ]

Top
#63557 - 2002-03-06 12:55 AM Re: Does KIX32 read code between GOTO "LABEL" and :LABEL??
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Michael,

Welcome to the board. I'll help if I can... you appear to be missing two Endif's. I would suggest that rather than avoid getting too bogged down in GOTO's you do something like this at the beginning of the script:

code:
$Server = LOCALSERVER

If Ingroup("101")
Use e: "\\server\eshare"
Use f: "\\server\fshare"
Endif

If Ingroup("202")
Use e: "\\server\eshare"
Use f: "\\server\fshare"
Endif

;Change McAfee uninstall path
...

;Rest of script continues, no real need for a label
...


To answer your question, the 101 group users will run everything between the IF condition checking their membership of this group and the Endif statement just before your :GENERAL label.

The example I've given you shows how to structure the code so that the bits you want to run are caught inside your IF statement, which has to be closed properly with an ENDIF.

HTH

_________________________
================================================
Breaker


Top
#63558 - 2002-03-05 06:40 PM Re: Does KIX32 read code between GOTO "LABEL" and :LABEL??
Anonymous
Unregistered


I ran into a similar problem where, script1 called script2 which called script3. I had a syntax error in script3 which caused script1 to fail... before script2 or 3 was even called. I read somewhere that the script you launch and all related scripts get pulled into memory. Though, you can change a related script that is not yet called and the changed script will launch, not the parsed one in memory.
Top
#63559 - 2002-03-11 07:14 AM Re: Does KIX32 read code between GOTO "LABEL" and :LABEL??
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

A lot of remarks about your example. Some have been made already.
  • missing ENDIFs
  • missing "right parenthesis" in ReadValue
  • incomplete "double quotation"
To get those problems easily use our tool kixstrip400.exe, which you
can find on our site.
Our call kixstrip400 input.kix output.kix /block_check /show_errors /show_structure
results in
code:
 $server=LOCALSERVER

IF INGROUP ("101")
GOTO "101"
IF INGROUP ("202")
GOTO "202"

:101
USE E: "\\SERVER\ESHARE"
USE F: "\\SERVER\FSHARE"
GOTO "GENERAL"

:202
USE E: "\\SERVER\ESHARE"
USE F: "\\SERVER\FSHARE"

;CHANGE UNINSTALL PATH FOR MCAFEE
$mcafee = Readvalue
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{87AEFD84-BC0D-11D4-B885-00508B022A51}","InstallSource")
; -------> Warning KIXSTRIP: 17 line incomplete "right parenthesis".
; -------> Warning KIXSTRIP: 17 line incompleted.
IF $mcafee="\\\\SERVER1\\mcafee\\Win32\\"
ELSE
SHELL "$SERVER\REPOSITORY\MCAFEE\BATCH.BAT" $server"
; -------> Warning KIXSTRIP: 20 line incomplete "double quotation".
; -------> Warning KIXSTRIP: 20 line incompleted.

ENDIF

GOTO "GENERAL"


:general


;($begin)
;
; mon 11-mar-2002 04:11:52 (kix 4.00 vs 3.01e)
;
;Informative KIXSTRIP: input=28 output=28 skip=0
;
;Warning KIXSTRIP: 2 errors in block structure(s). missing statement(s).
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; -ERROR- - if:else:endif [3:1:1]
; - select:case:endselect [0:0:0]
; - while:loop [0:0]
;Warning KIXSTRIP: 2 lines are incompleted.
;Warning KIXSTRIP: some lines contains errors or possible errors.
; 1 line incomplete "double quotation".
; 1 line incomplete "right parenthesis".
; 2 line incompleted.
;Informative KIXSTRIP: 3 block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: 3 labels found.
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
;Informative KIXSTRIP: 4 GOTO
;Informative KIXSTRIP: 1 SHELL
;Informative KIXSTRIP: 4 USE
;
;($end)
;($begin)
;
;Warning KIXSTRIP: 20 line incomplete "double quotation".
;Warning KIXSTRIP: 17 line incomplete "right parenthesis".
;Warning KIXSTRIP: 17, 20 line incompleted.
;
;($end)

A fast way can be something like
code:
 GOTO end_of_script
;
; - your script-
;
:end_of_script
? "Informative KIX: end of script reached"

for verifying also possible problems with your script.
greetings.

btw: symbol on our homepage has been linked to related http://kixtart.org topic.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


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

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.052 seconds in which 0.023 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