Page 1 of 2 12>
Topic Options
#27624 - 2002-08-22 10:51 PM Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
I am a brand new (today) kixtart user with VERY limited scripting experience. I have basically written Novell login scripts up to this point. My issue is, I need to set a variable in a login script that will run from a Windows 2000 server on a Windows 95 desktop. It creates a pointer, so to speak, for an old DOS based program we are still running. The way it was done in Novell was:

IF MEMBER OF "POLLER_1" THEN BEGIN
DOS SET PRCPATH = "$1"
END

IF MEMBER OF "POLLER_2" THEN BEGIN
DOS SET PRCPATH = "$2"
END

IF MEMBER OF "POLLER_3" THEN BEGIN
DOS SET PRCPATH = "$3"
END

Can someone give me a clue as to how I would write this into my script file? I have installed Kixtart 4.1 on the Win2K server to the Netlogon folder and am running kxrpc on the logon server. The scripts are executing, I just can't get this variable to work because I am guessing!

More info available on request! Thanks!
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27625 - 2002-08-22 11:00 PM Re: Variable Help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
to the script way.

only change in this simple example is simple.
the same in kix is:
[code]
IF ingroup("POLLER_1")
$PRCPATH = "$1"
ENDIF
IF ingroup("POLLER_2")
$PRCPATH = "$1"
ENDIF
IF ingroup("POLLER_3")
$PRCPATH = "$1"
ENDIF

so, to use this info I am requesting more info.
what are you trying to do.

from my example you probably have already seen that kix is simpler than any of the languages I know of.
including perl, tcl, some programming languages and wsh.

that's why I say:
"Kix rulez!"
_________________________
!

download KiXnet

Top
#27626 - 2002-08-22 11:04 PM Re: Variable Help
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please read the FAQ section, especially
Kixtart Deployment
Kixtart Starter's Guide
KXRPC - Everything you wanted to know about KXRPC
Suppressing Results when running scripts
W2k/XP - Keep the Window visible on login?
Windows 9x/Me Kixtart Support

Also, your KiXtart code would look like this:
code:
select
case ingroup("POLLER_1")
$dospath="$1"
case ingroup("POLLER_2")
$dospath="$2"
case ingroup("POLLER_3")
$dospath="$3"
endselect
shell 'winset.exe PRCPATH='+$dospath

Please check the SET, SETL, SETM commands in the KiXtart manual
_________________________
There are two types of vessels, submarines and targets.

Top
#27627 - 2002-08-22 11:06 PM Re: Variable Help
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I think what he is really looking for is something like:
select
case ingroup("POLLER_1")
set "PRCPATH=$path1"
case ingroup("POLLER_2")
set "PRCPATH=$path2"
case ingroup("POLLER_3")
set "PRCPATH=$path3"
endselect
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#27628 - 2002-08-22 11:19 PM Re: Variable Help
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, but he's using Windows 95 client and SET doesn't work under Windows 95 (according to the KiXtart manual), Thus, my reference to WINSET.EXE (part of the Windows 9x Resource Kit)
_________________________
There are two types of vessels, submarines and targets.

Top
#27629 - 2002-08-23 03:07 PM Re: Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
Wow - thanks for all of the prompt responses!
Lonkero, here's what I am trying to do:
DOS program - call it PRC, flat file, with many executables spread throughout it's directory structure. PRC uses what are called "pathfiles", which contain paths to each executable, as well as where to send print files. The pathfiles are named "cpathfil.$1, cpathfil.$2 and cpathfil.$3". When a user finishes data input and selects print, the pathfile sends the job to the print "poller" that renders the file and sends it to the printer. The "prcpath" variable is supposed to point the user to the appropriate pathfile in order to run the program and print output. There are 3 mainly because we have 3 print pollers.

I have placed the entry from Sealeopard in my script file and it is working - THANK YOU SO MUCH! This has been a valuable learning experience.

Also, in my haste to get answers, I didn't think about making my username gender specific, or adding enough info in my profile - I'm a she.....and thanks to everyone for your input.
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27630 - 2002-08-23 03:26 PM Re: Variable Help
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
KCOwens: Welcome as one of our (unfortunately few) female KiXtart users [Smile]

Glad you got it working.
_________________________
There are two types of vessels, submarines and targets.

Top
#27631 - 2003-02-19 03:45 PM Re: Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
Hi Folks,

After many months of testing a login script successfully using Kixtart, I created a new login script using variables as I had been but it does not work. Using debug, it gets to the "Select" then jumps to the next command in the script. The section that is not working is (my whole reason for using kixtart):

Select
Case InGroup("POLLER_01")
$dospath="$1"
Case InGroup("POLLER_01")
$dospath="$2"
Case InGroup("POLLER_03")
$dospath="$3"
Shell 'winset.exe PRCPATH='+$dospath
EndSelect

Here is the full script servername replaced by servername - my first attempt by the way so bear with me.....

;**** Last Modified on 01/17/2003 at 2:55:00 PM by kcowens ****
;**** CREATED FOR WINDOWS 95 WORKSTATIONS ****

Break ON ;(re)set Ctrl-C/Break handling
CLS
Color r+/n
Small
? "USER INFORMATION"
?
AT (4,4)
"HI, @userid"
?
? "WHAT TIME IS IT?"
?
? @DAY", " @DATE
?
? @TIME
?
? @MONTH ", " @YEAR
?
?
Sleep 1
CLS
?
?
SetTime "\\servername"
;Use F: /DELETE
;Use F: "@HOMESHR"
;Use G: /DELETE
;Use G: \\servername\clines$
;Use H: /DELETE
;Use H: \\servername\public
Use I: /DELETE
Use I: "\\servername\data$"
Use J: /DELETE
Use J: "\\servername\insurity$"
Use W: /DELETE
Use W: "\\servername\spapps$"
Use y: /DELETE
Use y: "\\servername\HOME"
?
?
If @USERID = POLLER01
Use lpt1 /DELETE
Use lpt1 "\\servername\Solimar_PRC"
Use lpt2 /DELETE
Use lpt2 "\\servername\UW_4SI_1"
EndIf
?
?
If @USERID = POLLER03
Use lpt1 /DELETE
Use lpt1 "\\servername\isd_4si_1"
EndIf
?
?
If @USERID = POLLER04
Use lpt1 /DELETE
Use lpt1 "\\servername\Solimar_PRC"
Use lpt2 /DELETE
Use lpt2 "\\servername\UW_4SI_1"
EndIf
?
?
If InGroup("CL-UNDERWRITING")
Use K: /DELETE
Use K: "\\servername\streets8"
Use U: /DELETE
Use U: "\\servername\autofac$"
Use V: /DELETE
Use V: "\\servername\boeckh$"
EndIf
?
?
If InGroup("\\servername\CLPOLICIES")
Use H: /DELETE
Use H: "\\servername\policies$"
EndIf
?
?
If InGroup("UW_4SI_1")
Use lpt1: /DELETE
Use lpt1 "\\servername\UW_4SI_1"
EndIf
?
?
If InGroup("UW_4SI_2")
Use lpt1: /DELETE
Use lpt1 "\\servername\UW_4SI_2"
EndIf
?
?
If InGroup("UW_HP8_1")
Use lpt1: /DELETE
Use lpt1 "\\servername\UW_HP8_1"
EndIf
?
?
If InGroup("GENARATE_TEST")
Use T: /DELETE
Use T: "\\servername\p1test$"
EndIf
?
?
Select
Case InGroup("POLLER_01")
$dospath="$1"
Case InGroup("POLLER_01")
$dospath="$2"
Case InGroup("POLLER_03")
$dospath="$3"
Shell 'winset.exe PRCPATH='+$dospath
EndSelect
?
?
? "Sample Windows NT Login Script For AVUpdate"
? "Please replace in this file with the name of"
? "the NT Server designated as your update server."
?
If "%OS%" == "Windows_NT" Goto skip
If NOT "%WINBOOTDIR%" == "" Goto 95
?
? "Running AVupdate using WIN3x syntax"
Use P: "\\servername\CheyUp$"
P:\avupdate.exe
Use P: /delete
Goto skip
?
:95
? "Run AVupdate using WIN95 syntax"
? "Running using WIN95 syntax"
\\servername\CheyUp$\avupdate.exe
?
?
:skip
? "Thank you For using AV-Update"
?
?
Exit

I have been through 'Known Problems of Kixtart on Windows 95' and 'fixed' those that apply and still the "PRCPATH" does not get set. All other InGroup statements work fine. We (unfortunately) use the Microsoft Client for Netware and the Microsoft Client for Windows.

Any and all help, suggestions will be appreciated! Will happily provide more information on request. Thanks!
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27632 - 2003-02-19 04:03 PM Re: Variable Help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
K,

the advantage of SELECT CASE constructs is that it processes the first TRUE statement and then 'exits' itself (To catch exceptions one can add a default case 1 statement)... sample :



$x = 1
select
    case $x > 0
        '$$x is greater than 0' ?
    case $x = 1
        '$$x equals one' ?
    case 1
        'Nothing of the above' ?
endselect



this will print '$x is greater than 0' to the screen !
So sometimes this is a good thing , but if you like to have several things done on several cases a nested if else endif construct helps more
As well you can patch several conditions to be evaluated together with a combination of AND OR NOT Operators :

'simple' sample :



if ingroup("Group1") or ingroup("Group2") and not ingroup("Group3")
    ;True if in Group1 or in Group2, but not in Group3
    ;do something
else
    ;do something else
endif

; also you can change evalutaion adding some brackets :

if ingroup("Group1") or (ingroup("Group2") and not ingroup("Group3"))
    ;True if in Group1 no matter what else  [Wink]
    ;do something
else
    ;do something else
endif



Hope this helps
Jochen

[ 19. February 2003, 16:09: Message edited by: jpols ]
_________________________



Top
#27633 - 2003-02-19 04:17 PM Re: Variable Help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Digging a bit deeper in your sample (ok, I confess simply reading your code) I found the mistake you made :

you do the winset within the 3rd CASE evaluation (Thus the Winset only is executed if 3rd case is true and none of the before)

your code should If I got that right look something like this :



Select
    Case InGroup("POLLER_01")
        $dospath="$1"
    Case InGroup("POLLER_01")
        $dospath="$2"
    Case InGroup("POLLER_03")
        $dospath="$3"
EndSelect

Shell 'winset.exe PRCPATH='+$dospath



J.

{edit}
Oh yeah, you might want to display the time after you synchronized it with your Server [Wink]
{/edit}

[ 19. February 2003, 16:21: Message edited by: jpols ]
_________________________



Top
#27634 - 2003-02-19 04:35 PM Re: Variable Help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh yeah,

another addition :

if the variable $dospath is meant to be of type string you may want to assign this as $dospath = "$$n"

Just to prevent future Issues as the $-sign denotes variables in KiX 'normally'

J.
_________________________



Top
#27635 - 2003-02-19 05:09 PM Re: Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
Thanks JPOLS for the suggestions. I did update the script and moved Shell 'winset.exe PRCPATH='+$dospath to come after the EndSelect. Still the PRCPATH does not get set. It is not meant to be type string so the $ shouldn't matter. Incidentally, here is the script that works:

Break ON ;(re)set Ctrl-C/Break handling
CLS
Color r+/n
Small
? "USER INFORMATION"
?
AT (4,4)
"HI, @userid"
?
? "WHAT TIME IS IT?"
?
? @DAY", " @DATE
?
? @TIME
?
? @MONTH ", " @YEAR
?
?
Use w: /delete
Use w: "\\vmi_nt0\spapps$"
?
?
If InGroup("GENARATE_MISC")
Use J: /DELETE
Use J: "\\vmi_nt0\insurity$"
Use lpt1: /DELETE
Use lpt1: \\vmi_nt0\isd_4si_1
EndIf
?
?
?
If InGroup("GENARATE_TEST")
Use T: /DELETE
Use T: "\\vmi_nt0\p1test$"
EndIf
?
?
Select
Case InGroup("POLLER_1")
$dospath="$1"
Case InGroup("POLLER_2")
$dospath="$2"
Case InGroup("POLLER_3")
$dospath="$3"
Shell 'winset.exe PRCPATH='+$dospath
EndSelect
?
?
Exit

And yes it works, even with the Shell in the wrong place...go figure.
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27636 - 2003-02-19 05:19 PM Re: Variable Help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A word of caution on using $. $ can in of itself be a variable, but it is not considered good practice to use it.

Take the following example:

break on
$="test"
$ ?
"\\Server\Users\@UserID$" ?
"\\Server\Users\@UserID$$" ?
get $_

If you assign a string or value to $, and then use sloppy coding for say, hidden shares, it will give you grief. Assigned as a string,

Use "H:" "\\Server\Users\@UserID$"

would concatenate the @UserID and the $ as if it were:

"\\Server\Users\" + @UserID + $

The manual states that if a $ is used within quotes that it should be $$, as in:

Use "H:" "\\Server\Users\@UserID$$"

Check out Ruud's comment on the use of $ in a thread over at ScriptLogic.

http://www.scriptlogic.com/support/forums/display_message.asp?mid=2525
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#27637 - 2003-02-19 08:39 PM Re: Variable Help
ekrasner Offline
Fresh Scripter

Registered: 2000-12-20
Posts: 9
Loc: Federal Way, WA, USA
Another possible problem could be that you don't have the kixrpc service running on the DC's. This will be necessary for the 95 PCs to use the INGROUP function.
Top
#27638 - 2003-02-19 09:24 PM Re: Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
Thank you for all of the replies - I am happy to report that the script is now working. Once I read the FAQ regarding Win 9x/Me Kixtart Support, I found that my Global Groups would not work in a script on Win95. I updated to local groups and everything works fine now.

Thanks again everyone!
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27639 - 2003-02-19 09:35 PM Re: Variable Help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
global groups indeed work but you need kxrpc-service for that.

anyway, glad to hear you found a workaround for it.
I found one of my own too:
I removed all win9x machines from our lan
_________________________
!

download KiXnet

Top
#27640 - 2003-02-19 09:47 PM Re: Variable Help
Im-a-she Offline
Fresh Scripter

Registered: 2002-08-22
Posts: 8
Lonkero - I am running KXRPC on all domain controllers, yet I still had to use Local Groups. July 1 is the deadline for W2k rollout...I'm with you!
_________________________
The worst dilemmas are often the best opportunities in disguise. 'Carpe Diem'

Top
#27641 - 2003-02-19 10:00 PM Re: Variable Help
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Kathy, in your testing you have KXRPC service running on the logon domain DCs correct? Also when you tested and altered the membership of a global group did you logoff and log back on?

See this thread for detail of how INGROUP in 4.x works. RESOLVED - BUG Help 4.01 INGROUP Failures

Are you still using KiXtart version 4.10?

Have you inspected the TokenCache in the registry?
HKEY_CURRENT_USER\Software\KiXtart\TokenCache

Is it populated?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#27642 - 2003-02-19 10:03 PM Re: Variable Help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
dude if you have july as rollout time for w2k...
well, you might currently have problems with it but after july these thingies should be all gone and you can skip those batch-files and all that crap.

uuh, the bless of having no win9x in net is huge!
_________________________
!

download KiXnet

Top
#27643 - 2003-02-19 11:29 PM Re: Variable Help
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
BTW, I've already pointed out these relevant FAQs in her original post from August 2002.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 846 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.071 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