Page 1 of 1 1
Topic Options
#65172 - 2002-05-03 01:36 PM Var-Label @error
Ronald Offline
Fresh Scripter

Registered: 2001-02-13
Posts: 27
Loc: Netherlands
Hi there,

I hope you can help me!

I use the readvalue to get a domain. Then it has to be showed in the screen. For example I'll use for the domain: TEST1
It seems like this :

$RdvDom=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider","AuthenticatingAgent")

? "$$RdvDom = $Rdvdom"

Displayed : $RdvDom = TEST1

The script where I need this part for will run over more domains. There all domains have separate configurations, I use different Labels.

I want to use the readvalue into a label. Such like this:

While @error=0
goto $Rvd
Endif

? "Not logged on to an active Domain !!!"
Exit

:TEST1
? "CONFIGs for clients which logged on to Domain TEST1"
Exit

:TEST2
? "CONFIGs for clients which logged on to Domain TEST2"
Exit

:Test3
? "CONFIGs for clients which logged on to Domain TEST3"
Exit

I hope you do understand my problem.

Thnx a lot for the one who can help me !!!!

Greetings Ro!

Top
#65173 - 2002-05-03 01:48 PM Re: Var-Label @error
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
You didn't descripe any error, so how may we help?

what is going wrong in your script?
_________________________
!

download KiXnet

Top
#65174 - 2002-05-03 01:51 PM Re: Var-Label @error
Jochen Administrator Offline
KiX Supporter
*****

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

you may replace a goto label with a variable, works perfect ...

Your script will error on 'while @error = 0' (I assume this is the error check for readvalue =)

Replace that with 'if @error = 0'

hth

Jochen
_________________________



Top
#65175 - 2002-05-03 03:34 PM Re: Var-Label @error
Ronald Offline
Fresh Scripter

Registered: 2001-02-13
Posts: 27
Loc: Netherlands
This is the active script:

$RdvDom=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider","AuthenticatingAgent")

? "$$RdvDom = $Rdvdom"
?

IF @error=0
goto $Rdv
Endif

? "No active domain!!!"
?
exit
ENDIF

:$Rdv
? " Logged on to Domain: TEST1 "
EXIT

But the output is Still:

$RdvDom = TEST1
script error : LABEL not found !
Endif

So, it doesn't work already!
Can you show me an example by this script ?

Thnx a lot !

[ 03 May 2002, 15:36: Message edited by: Ronald ]

Top
#65176 - 2002-05-03 03:40 PM Re: Var-Label @error
Jochen Administrator Offline
KiX Supporter
*****

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

you can say 'goto $label' but you can't define a label with a variable !

The labels are read at KiX' start, plus it would jump , if it worked, everytime to the same label ...

hth
Jochen
_________________________



Top
#65177 - 2002-05-03 03:42 PM Re: Var-Label @error
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
This should work :

code:
$RdvDom=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Service\MSNP32\NetworkProvider","AuthenticatingAgent")

? "$$RdvDom = $Rdvdom"
?

IF @error=0
goto $RdvDom
Endif

? "No active domain!!!"
?
exit
ENDIF

:TEST1
? " Logged on to Domain: TEST1 "
EXIT

It's bad logic because it will error out with 'label not found' if there is no fitting registry entry ...

[ 03 May 2002, 15:44: Message edited by: jpols ]
_________________________



Top
#65178 - 2002-05-03 06:39 PM Re: Var-Label @error
Ronald Offline
Fresh Scripter

Registered: 2001-02-13
Posts: 27
Loc: Netherlands
Thnx!

I figured out (with your help) what was wrong.
I tried already like you did it in the last post.

I renameld the value to TEST1, it worked !

But in real the name of domains is like this.

"name-tt111"

But she can't figure the "-" in a label so, that's the problem which I have to resolve.

Thnx! for your help.

Greetings Ro!

Top
#65179 - 2002-05-05 10:47 PM Re: Var-Label @error
Ronald Offline
Fresh Scripter

Registered: 2001-02-13
Posts: 27
Loc: Netherlands
Hi there...

The way I solved the "dash" ("-")-problem is written in the script below !

I could work with :

;*==========================
If $RdvDom="name-tt111"
goto "namett111"
Endif

If $RdvDom="paas-ww253"
goto "paas-ww253"
Endif

;==========================

Etc. But If you've got 80 Domains for example...I
think that this is a better way.

So see my script below...It works...But if you have a better (read smaller) method...let me know...The more possibilities you know the better, I always say !

Well see you !

Greetings Ro!

[SCRIPT]
;*****************
;* Check Domain *
;*****************
:Domchk

$RdvDom = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider","AuthenticatingAgent")

? "$$RdvDom = $Rdvdom"

If @error=0

$x = Instr($RdvDom,"-")
? "$$x = $x"
If $x >0
? "yes"

$x1=$x-1
$x2=$x+1

? "$$x1 = $x1"
? "$$x2 = $x2"

$sub1=substr($RdvDom,1,$x1)
$sub2=substr($RdvDom,$x2,20)

? "$$sub1 = $sub1"
? "$$sub2 = $sub2"

$Domain = (($sub1)+($sub2))
? "$$Domain = $Domain"

goto $Domain
Endif

[END OF SCRIPT]

Top
#65180 - 2002-05-05 11:12 PM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... if KiX >= 4

break on

$RdvDom = "domain-test"

? "$$RdvDom = "+ $Rdvdom

$x = Instr($RdvDom,"-")
? "$$x =" + $x
If $x >0
? "yes"

$y = Instrrev($RdvDom,"-")

? "$$x = " + $x
? "$$y = " + $y

$Domain = substr($RdvDom,1,$x-1) + substr($RdvDom,$y+1)
? "$$Domain = " + $Domain

;goto $Domain
Endif

get $_

exit 1

Note also "preferred" way of contatenation, i.e. ? "$$x =" + $x
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65181 - 2002-05-05 11:21 PM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Better yet... for any version

break on

$RdvDom = "domain-test"

? "$$RdvDom = "+ $Rdvdom

$x = Instr($RdvDom,"-")
? "$$x =" + $x
If $x >0

? "$$x = " + $x

$Domain = substr($RdvDom,1,$x-1) + substr($RdvDom,$x+1,len($RdvDom))
? "$$Domain = " + $Domain

;goto $Domain
Endif

get $_

exit 1
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65182 - 2002-05-05 11:38 PM Re: Var-Label @error
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If the clients logon to different domains, it may be easier and more productive to use sub-scripts. If there is unique functionality that occurs for each different domain, why should everyone load and execute code that does not pertain to them? Also if you have to edit the functionality of domain "TEST1" and make a syntax error, then the script will die for everyone.

I suggest the you use a "CALL" command to call a sub-scripts named after the domain.

;Get domain name from registry
$Domain = ReadValue(...
Call $Domain + ".kix"

This permits to edit the functionality of a particular domain without affecting anyone else.

[ 05 May 2002, 23:42: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65183 - 2002-05-05 11:45 PM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Good point... couldn't think "outside the box". Fixated on the string manipulation thingy. [Big Grin]

With CALLs to separate scripts for the 80 domains, you'll save 79 of them the bother of parsing through code meant for others.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65184 - 2002-05-05 11:56 PM Re: Var-Label @error
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You know... If they logon to different domains they all could and probably should just have their own script since only users for that domain would read the script anyway.

Now if they had a master domain model where everyone executes the same script, the call subscript would work wonders for clients of 80 different resource domains.

Example Call @domain + ".kix"
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65185 - 2002-05-06 12:00 AM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...or would that be @LDomain...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65186 - 2002-05-06 12:27 AM Re: Var-Label @error
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
@Domain for my Master Domain Model example. @Ldomain for Ronald. Not sure why he is reading the registry. Did I miss something?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65187 - 2002-05-06 12:32 AM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Anybody's guess...

Every day we dispense advice without seeing the whole picture. Imagine the quality of advice we could offer if only we knew all the details...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65188 - 2002-05-06 09:26 AM Re: Var-Label @error
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
My Scripts not working

Please advise

Thanks [Roll Eyes]

Top
#65189 - 2002-05-06 02:38 PM Re: Var-Label @error
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, I can see why... [Wink]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65190 - 2002-05-06 03:07 PM Re: Var-Label @error
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
... you missed the closing quotation down there in line 487 ... see ? [Big Grin]
_________________________



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 1046 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

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