Page 1 of 1 1
Topic Options
#13533 - 2001-10-25 06:24 PM Trouble with @wksta variable using Kix v. 3.47
Anonymous
Unregistered


Hello all!

I'm working on a multiple environment domain for our developers. What I need to happen is for the login script to look at the workstation computer name and then based on that name run a different script. The code that I am currently using looks like this:

if @wksta <> 'test-a' and @wksta <> 'test-b' and @wksta <> 'test-c' and @wksta <> sfu1-018

Call Test.scr

$process_login='n'
?'Dublin Login scripts are NOT run on Test Machines.'
?
BEEP
BEEP
?'Press any key to continue...'

if @wksta <> 'preprod-a' and @wksta <> 'preprod-b'

Call Preprod.scr

$process_login='n'
?'Dublin Login scripts are NOT run on Pre-Production Machines.'
?
BEEP
BEEP
?'Press any key to continue...'


else if exist ('c:\winnt\canflag.txt')=1
$process_login='n'
?'Dublin Login scripts are NOT run on Canada Machines.'
?' Please call 4500 for more info.'
?
BEEP
BEEP
?'Press any key to continue...'
get $t
else
$process_login='y'
endif ; if on nala

if $process_logon='y'
?
?'Processing NT system logon script...'


Thanks for any assistance,

Steven

Top
#13534 - 2001-10-25 06:55 PM Re: Trouble with @wksta variable using Kix v. 3.47
Anonymous
Unregistered


Steven,

To make it a bit simpler to read you could use the CASE statement.

I hope I have interpreted your code correctly!

SELECT
CASE @wksta <> 'test-a' and @wksta <> 'test-b' and @wksta <> 'test-c' and @wksta <> sfu1-018
Call Test.scr
$process_login='n'
?'Dublin Login scripts are NOT run on Test Machines.'
?
BEEP
BEEP
get $t

CASE @wksta <> 'preprod-a' and @wksta <> 'preprod-b'
Call Preprod.scr
$process_login='n'
?'Dublin Login scripts are NOT run on Test Machines.'
?
BEEP
BEEP
get $t

CASE exist ('c:\winnt\canflag.txt')=1
?'Dublin Login scripts are NOT run on Canada Machines.'
?' Please call 4500 for more info.'
?
BEEP
BEEP
get $t

CASE 1
$process_logon='y'
?
?'Processing NT system logon script...'

ENDSELECT


Hope this gives you some ideas.

Top
#13535 - 2001-10-26 02:25 AM Re: Trouble with @wksta variable using Kix v. 3.47
MCA Offline
KiX Supporter
*****

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

Your kixtart version is very old. Without any problem you can upgrade
to kixtart 3.63 version. Only extension were made to your version. Up-
grading from earlier versions will never be a problem.
This version was already published a long time ago.


You can simplify such upgrade for clients by using our package kix363upgrade.exe, which
you can find it on our site
http://home.wanadoo.nl/scripting
and you only need one statement to install it.
The batch can be:

code:

@echo off
%0\..\kix363update.exe /q
kix32 %0\..\your_script.kix
@echo off


Be aware that you also replace the kixrpc.exe file on your servers.

Greetings.


btw: upgrading to Kixtart 4.00 release can give some problems because
some functions are removed.

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
#13536 - 2001-10-26 02:26 AM Re: Trouble with @wksta variable using Kix v. 3.47
MCA Offline
KiX Supporter
*****

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

Your script contains an error. Missing endif.
Some remarks:

  • we think your meaning with line
    IF @wksta <> 'test-a' AND @wksta <> 'test-b' AND @wksta <> 'test-c' AND @wksta <> sfu1-018
    is: run script test.scr when workstation name is one of those names.
    YES: change it to
    @wksta = 'test-a' OR @wksta = 'test-b' OR @wksta = 'test-c' OR @wksta = sfu1-018
  • same remark about your line IF @wksta <> 'preprod-a' AND @wksta <> 'preprod-b'
    change it to IF @wksta = 'preprod-a' OR @wksta = 'preprod-b'
  • use MessageBox instead of ? 'Press any key to continue...'.
    You doesn't need the BEEP command by using the MessageBox function.

We verify your code with our tool kixstrip.
Result:

code:

IF @wksta <> 'test-a' AND @wksta <> 'test-b' AND @wksta <> 'test-c' AND @wksta <> sfu1-018
CALL Test.scr
$process_login='n'
?'Dublin Login scripts are NOT run on Test Machines.'
?
BEEP
BEEP
?'Press any key to continue...'
IF @wksta <> 'preprod-a' AND @wksta <> 'preprod-b'
CALL Preprod.scr
$process_login='n'
?'Dublin Login scripts are NOT run on Pre-Production Machines.'
?
BEEP
BEEP
?'Press any key to continue...'

ELSE
IF exist ('c:\winnt\canflag.txt')=1
$process_login='n'
?'Dublin Login scripts are NOT run on Canada Machines.'
?' Please call 4500 for more info.'
?
BEEP
BEEP
?'Press any key to continue...'
GET $t
ELSE
$process_login='y'
ENDIF
; if on nala
IF $process_logon='y'
?
?'Processing NT system logon script...'

;($begin)
;
; fri 26-oct-2001 00:25:49 (kix 4.00 vs 2.29e)
;
;Informative KIXSTRIP: input=32 output=32 skip=0
;
;Warning KIXSTRIP: 1 error in block structure. 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 [4:2:1]
; - select:case:endselect [0:0:0]
; - while:loop [0:0]
;Warning KIXSTRIP: some lines contains errors or possible errors.
;Informative KIXSTRIP: 4 block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: no 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: 2 CALL
;Informative KIXSTRIP: 1 GET
;
;($end)


We restyle your script a little bit.
Our version is:

code:

$process_login="y"
SELECT
CASE (@wksta = "test-a") OR (@wksta = "test-b") OR (@wksta = "test-c") OR (@wksta = "sfu1-018")
CALL test.scr
$process_login="n"
$result=MessageBox("Dublin Login scripts are NOT run on Test Machines.","Login process",16,30)
CASE (@wksta = "preprod-a") OR (@wksta = "preprod-b")
CALL preprod.scr
$process_login="n"
$result=MessageBox("Dublin Login scripts are NOT run on Pre-Production Machines.","Login process",16,30)
CASE 1
IF (Exist("c:\winnt\canflag.txt") = 1)
$process_login="n"
$result=MessageBox("Dublin Login scripts are NOT run on Canada Machines."+CHR(13)+" Please call 4500 for more info.","Login process",16,30)
ELSE
$process_login="y"
ENDIF
ENDSELECT

IF ($process_logon = "y")
? "Processing NT system logon script..."
ENDIF



greetings.
_________________________
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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

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