Page 1 of 1 1
Topic Options
#27652 - 2002-08-23 12:07 AM GOSUB probs....
Jayb Offline
Fresh Scripter

Registered: 2002-08-23
Posts: 5
Loc: Indiana
Kix 4.11 RC 1
In the code below, I cannot get it to jump to the middle (testie6) label.
Any help appreciated.

$ServPk = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
IF $ServPk = "Service Pack 2"
? "Service Pack 2 installed."
GOSUB testie6
Else
shell '%COMSPEC% /c \\serv4\it$$\Install\ServicePacks\Win2kSP2\i386\update\update.exe /u /f /n
endif

:testie6
IF EXIST ("c:\program files\Internet explorer\custom\inetset.inf")
? "IE6 Already installed"
GOSUB end
ELSE
shell '%COMSPEC% /c \\serv4\distro\IE6\FLAT\WIN32\EN\ie6setup.exe
endif

:end
? "test end"
EXIT

Top
#27653 - 2002-08-23 12:24 AM Re: GOSUB probs....
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how you know it's not getting there?

you should also read about gosub syntax as it requires also return.

[ 23. August 2002, 00:26: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#27654 - 2002-08-23 12:28 AM Re: GOSUB probs....
Jayb Offline
Fresh Scripter

Registered: 2002-08-23
Posts: 5
Loc: Indiana
I knew it wasn't getting there because i got a label error, plus when I added in a text display, it wasn't coming up.
Fixed it, I didn't have the ' at the end of my shell calls.
Thanks.

Top
#27655 - 2002-08-23 12:32 AM Re: GOSUB probs....
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should also read about the If syntax. Your GOSUBs are not necessary and they are actually wrong. You would rather use GOTO to GO TO a label, not GOSUB to GO to a SUBroutine.
Proper code would be
code:
$ServPk = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
IF $ServPk = "Service Pack 2"
? "Service Pack 2 installed."
Else
shell '%COMSPEC% /c \\serv4\it$$\Install\ServicePacks\Win2kSP2\i386\update\update.exe /u /f /n'
endif

IF EXIST ("c:\program files\Internet explorer\custom\inetset.inf")
? "IE6 Already installed"
ELSE
shell '%COMSPEC% /c \\serv4\distro\IE6\FLAT\WIN32\EN\ie6setup.exe'
endif

? "test end"
EXIT

However, you should realize that those installs require administrative privileges and the computer needs to reboot in order to finish the install correctly.

For IE6 installation, please use the Internet Explorer Administration Kit.

[ 23. August 2002, 00:34: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#27656 - 2002-08-23 12:33 AM Re: GOSUB probs....
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jayb, isn't those syntax errors fantastic?

anyway, good that you found it yourself.
it surely says that you have potential to be a real kix-freak [Big Grin]
_________________________
!

download KiXnet

Top
#27657 - 2002-08-23 04:27 AM Re: GOSUB probs....
Jayb Offline
Fresh Scripter

Registered: 2002-08-23
Posts: 5
Loc: Indiana
yea, glad I found it, of course it had to happen after I made a post about it. [Smile]

Yea, I'm aware that they require admin priveleges, also aware of the ie6 admin kit, you can tell it's pointing to an area holding a custom build.
You are right, of course, I used the GOSUB because the GOTO wasn't working. Now I know why.
Your example obviously looks much cleaner, I will try not using the goto, and simply use the IF.
I assumed that I needed it to skip the install line if it found it was already done, that's why I was using the label jumps.
Thanks.

Top
#27658 - 2002-12-03 06:01 AM Re: GOSUB probs....
MCA Offline
KiX Supporter
*****

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

With our tool kixstrip which you can find on our site it
is very easily to find f.e. missing quotations.
Documentation is also available.

After our call: kixstrip input.kix output.kix /block_check
code:
 $servpk = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
IF $servpk = "Service Pack 2"
? "Service Pack 2 installed."
GOSUB testie6
ELSE
SHELL '%COMSPEC% /c \\serv4\it$$\Install\ServicePacks\Win2kSP2\i386\update\update.exe /u /f /n
ENDIF

:testie6
IF EXIST ("c:\program files\Internet explorer\custom\inetset.inf")
? "IE6 Already installed"
GOSUB end
ELSE
SHELL '%COMSPEC% /c \\serv4\distro\IE6\FLAT\WIN32\EN\ie6setup.exe
ENDIF

:end
? "test end"
EXIT

;($begin)
;
; tue 03-dec-2002 06:02:25 (kix 4.10 vs 3.20e)
;
;Warning KIXSTRIP: 2 lines are incompleted.
; rerun program with option "/block_check /show_errors".
;Warning KIXSTRIP: some lines contains errors or possible errors.
; 2 line incomplete "single quotation".
; 2 line incompleted.
;Informative KIXSTRIP: 2 block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: 2 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: 1 EXIT
;Informative KIXSTRIP: 2 GOSUB
;Informative KIXSTRIP: 2 SHELL
;
;($end)
;($begin)
;
;Warning KIXSTRIP: 6, 14 line incomplete "single quotation".
;Warning KIXSTRIP: 6, 14 line incompleted.
;
;($end)

it shows two error situations in your script. In both cases it was related to your SHELL
calls.
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:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.066 seconds in which 0.031 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