Page 1 of 1 1
Topic Options
#124458 - 2004-08-04 07:14 PM Writevalue
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
Hi wonder if you can help me. Im trying to edit my log on script so that it does a couple of registry changes however Im finding that when I do this the script ends before it should.

Following is an extract from my logon script.

Basically it checks what group you are in and applies the appropiate drives and registry changes.

However it only checks the first in group rule and if your in both these groups (GG_Server1 and GG_Server2) it doesnt do the 2nd at all but ONLY if i have a writevalue in the if statement above, If I take this out it works no problem.

Please dont read too much into what the change is its only a section of the changes but all lines are almost same.

Can anyone help please?

Thanks

Glen


IF InGroup("WMS\GG_SERVER1") = 1
? "Mapping SERVER1 Drives"
Use U: /Delete /PERSISTENT
USE U: "\\SERVER1\Department Data"
Use H: /Delete /PERSISTENT
USE H: "\\SERVER1\Home" ; Home Drives

writevalue( "HKEY_CURRENT_USER\Control Panel\Desktop" , "SmoothScroll" , "00,00,00,00", "REG_BINARY" )

ENDIF

? "endit 1"


IF InGroup("WMS\GG_SERVER2") = 1
? "Mapping Logic Drives"
Use L: /Delete /PERSISTENT
USE L: "\\SERVER\User" ; Home Drives

writevalue( "HKEY_CURRENT_USER\Control Panel\Desktop" , "SmoothScroll" , "00,00,00,00", "REG_BINARY" )

ENDIF


Top
#124459 - 2004-08-04 07:32 PM Re: Writevalue
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Welcome to the board!

You are pretty close..

it should be -
Code:

$rc=writevalue("HKCU\Control Panel\Desktop", "SmoothScroll", "00000000", "REG_BINARY")



HTH,

Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#124460 - 2004-08-04 07:38 PM Re: Writevalue
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
Thank you sorry I was wrong with the line. However putting the $rc= at the start of each writevalue line doesnt seem to fix the if in group problem. It simply ignores the 2nd group membership because of writevalue.

Thanks

Top
#124461 - 2004-08-04 07:48 PM Re: Writevalue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Look at the commas (or lack of).
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124462 - 2004-08-04 08:49 PM Re: Writevalue
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Glen,

Les' response is correct.. It is the comma thing that is probably stopping this.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#124463 - 2004-08-04 08:51 PM Re: Writevalue
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
Sorry I should have mentioned I removed the commas in this line "00,00,00,00" before or am I being stupid and missing others?

Glen

Top
#124464 - 2004-08-04 08:56 PM Re: Writevalue
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Try with a Debug ON and see where you are stopping..

You may also need to flush the token cache for KiX.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#124465 - 2004-08-04 09:06 PM Re: Writevalue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Make sure that none of the quotes are the curly type.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124466 - 2004-08-04 09:18 PM Re: Writevalue
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
ok thank you both for your quick answers.

Im going to try using /F when starting my scripts which I believe is the way to flush the cache (did a search) I assume I can just put this in as a standard thing whenever i start a kix script? or is there a time when I shouldnt be using it?

I dont think I have any cirly brackets but Ill check that.

If all that doesnt work ill try the debug on

Ill post what fixed it once i find out.. hopefully one of those does

Ive gone home from work now so will try in thr morning..

Thanks again

Glen


Edited by Glen (2004-08-04 09:19 PM)

Top
#124467 - 2004-08-04 09:42 PM Re: Writevalue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There is a performance penalty for using /F on every launch. Only do it for a short while after making group name changes.

Not {curly} brackets, “curly” quotes! Also, count all your quotes in case you have a mismatch.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124468 - 2004-08-05 12:44 PM Re: Writevalue
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
Thanks both, I found the problem.

There was a mistake (as you said) with the quotes. All were the right kind of quote however I was missing one.

What I didnt realise (have been using kix for a few years to a basic level) that kix must parse the entire script first.

I always thought it did a step through parse line by line. Reason I say this was because the mistake was below the point where it was actually bombing out within the 2nd IF statement. So running debugging it was hitting the 2nd IF in group statement and then litterly igoring the enitre contents of it because there wasa mistake with a command inside the IF statement and ending the script.. interesting error checking. So I was pretty much looking at the wrong point of the script for the problem.

Thanks again

Glen


Edited by Glen (2004-08-05 12:45 PM)

Top
#124469 - 2004-08-05 12:57 PM Re: Writevalue
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, that all changed not so many years ago.
it was 4.21 or 4.22 or... anyway, one of the latest versions that introduced pre-processing as it is now.
ofcourse, it does not fully parse everything, it just translates it to "native kix" from script-kix.
if that goes well, some typos may get unnoticed in even production script.
that's pretty rare though.
_________________________
!

download KiXnet

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

Generated in 0.372 seconds in which 0.308 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