Page 1 of 2 12>
Topic Options
#74845 - 2003-05-07 02:57 AM Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Hello folks,
I first need to admit that I am HORRIBLY new at writing kixtart scripts however the code that I have is direct from the Kixtart manual I got to from this site.

-------------------------------------------------
code

; Lotus notes registry entry script

$ReturnCode = Loadkey("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes", "c:\logon\regislotus.reg")
IF $ReturnCode = 0
? "key loaded....."
else ;I added this part to be sure at least some of my code was working
? "key not loaded"
EndIf
-------------------------------------------------

the only thing different with my script and the one from the book is the commented area and the specific Reg Key and the .reg file to load.

I know you guys can help me , and I thank you for all of it.

P.S.

What I'd really like to do is add a select..case that determines if the reg key is already there or not. But I'm taking it one step at a time.

"I'm doin' the work, I'm babystepin..."
Bob

[ 07. May 2003, 03:05: Message edited by: jacks73 ]

Top
#74846 - 2003-05-07 03:37 AM Re: Loadkey problem
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Check the manual for examples of how to use KeyExist(). Combine it with IF...Endif and I think you will have the code you want.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#74847 - 2003-05-07 05:04 AM Re: Loadkey problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Check the FAQ section on the use of LoadKey. It only works with binary files and not text based .reg files.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#74848 - 2003-05-07 07:40 AM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Further to Les' response. [Smile]

LOADKEY - Why doesn't it work

HTH,

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

Top
#74849 - 2003-05-07 06:55 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
I have figured out what I need to evaluate in order for my IF statement to work. I need my script to determine if the key looks like this:

Regkey;
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes]
@=""

or this:

Regkey;
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes]
@="Lotus Notes"

to run

code
-----------------------------------------------------------
shell "regedit.exe /s regislotus.reg"; which worked like a charm, thanks Kdyer
------------------------------------------------------
thanks again all

[ 07. May 2003, 18:59: Message edited by: jacks73 ]

Top
#74850 - 2003-05-07 06:59 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
uhm...
I wonder does that actually relate to anything...
_________________________
!

download KiXnet

Top
#74851 - 2003-05-07 07:02 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

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

I think you can do this all native to KiX..

code:
IF READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","")<>""
$RC=WRITEVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")
ENDIF

Merging .REG file is not necessary for one or even five values. If you have "whole pile" of them, then yes you could do that.

Kent

[ 07. May 2003, 20:02: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74852 - 2003-05-07 07:11 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Updated the FAQ with the caveat about merging these files..

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

Top
#74853 - 2003-05-07 07:11 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Thank you again for the tip Kdyer, however I don't see where the code enters the value data of the key. You see, I know the key exists I need to change the value data of the key.
Top
#74854 - 2003-05-07 07:14 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Let's look at how this works..

First line..
IF READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","")<>""

We are testing the "@" or Default Value for what value exists. If it does not meet the "" or blank condition continue on.

$RC=WRITEVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")

Set this value to be blank...

ENDIF

Quit the conditional test.

HTH,

Kent

[ 07. May 2003, 20:01: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74855 - 2003-05-07 07:49 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Thank you for talking slowly Kdyer, I get it now. So I want the value data to be Lotus notes so I changed the code to this

code
------------------------------------------------------------
If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes","")=""
$RC=WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes","Lotus Notes","REG_SZ")
EndIf
------------------------------------------------------------------

and I get "script error : error in parameter(s) !.

Top
#74856 - 2003-05-07 07:53 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

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

It really should be -

code:
If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","")=""
$RC=WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")
EndIf

If you need more detail, please check the Docs for the DataTypes, etc.

HTH,

Kent

[ 07. May 2003, 19:59: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74857 - 2003-05-07 08:10 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Hey Kdyer,
Thanks for your effort. I think I am having trouble communicating what I need. However you have helped me.

code:
  

If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes","")=""
shell "regedit.exe /s regislotus.reg"
? "Value data changed"
endif
code:
  

I appreciate all your help

"Baby steps onto the elevator...AHHHHHHHHHHHHH!(for 25 floors)"
Bob

[ 07. May 2003, 20:12: Message edited by: jacks73 ]

Top
#74858 - 2003-05-07 08:13 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The problem is that you don't provide sufficient information and half of your posts don't really make sense. Please read the FAQ Forum and the KiXtart Manual. They contain valuable information.

[ 07. May 2003, 20:15: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#74859 - 2003-05-07 08:38 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
[Confused] As a moderator Sealeopard you could stand to be a little more consrtuctive and a lot less critical. And maybe you could notice that the very fisrt line of my post explained ineptitude. The result of this script could easily be accomplished by sending an email to my users with an attachment, had them launch it and then press "yes". I however enjoy the challenge of learning new things and Kixtart is the latest. I think that for 2 weeks of knowledge I'm doing pretty well.
Top
#74860 - 2003-05-07 08:54 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I would like to help. However, you do not provide sufficient helpful information. You do not specify which version of KiXtart you're using, whether it is a login or administrative script, which operating systems are supported, and so on. Additionally, you are attemting to write to HKEY_LOCAL_MACHINE, which requires administrative privileges under Windows NT/2000/XP/2003. Writing for example to HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER has different effects. However, as I do not know the OSes you're supporting with this, I can't really say much.

So, please provide more information.
_________________________
There are two types of vessels, submarines and targets.

Top
#74861 - 2003-05-07 09:36 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
What version of of KiXtart are you running?

With the extract your did from the Registry, what are you trying to change? One value? 20 Values?

From what you have posted, it is simply one value and the Merge routine is not really necessary and that is why I explained the READVALUE/WRITEVALUE routines to get this job done.

The other thing to watch for... Anytime that you write to the HKLM, you need to have "Power User" rights or better.

Thanks,

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

Top
#74862 - 2003-05-07 09:44 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
[Smile] That was a much more constructive posting, thanks. I am on Kixtart v3.60.0 and all systems are running Win2K pro. You are right that the script only runs properly with admin privilages so I've got to toss a SU command in. I'll post the code with that when I figure it out. If you have any ideas about my previous issues with the key I would love to hear them.
I have been hitting the books and will continue to, but the examples weren't working for me.

Top
#74863 - 2003-05-07 09:51 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Is there an option to get to 4.x? It will alleviate some headaches too.

For, example with KiXtart 4.x, you can push this remotely..

Consider the following post (my final response on it) -

Machine registrations in AD

This way, you don't have to expose potential risks.

If this not an option. Please peruse the following:

Installing an Application as an Admin

There are some other good topics, including deployment and updating KiXtart here -

KiXtart FAQ & How to's

Thanks,

Kent

[ 07. May 2003, 21:54: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74864 - 2003-05-07 09:54 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Just one Kdyer. I am trying to change the value of the subkey

HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes

from this

name type value data
(default) REG_SZ

to look like this

name type value data
(default) REG_SZ Lotus notes

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.091 seconds in which 0.063 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org