PDA

View Full Version : Registry Reading and updating


jimmy guilfoyle
10-27-2003, 11:48 AM
Hi All

Hi All this is my first post here and as always it connected with something I'm trying to achieve with AP4.

I want to read some values of the registry and then after I've read them I want to click another button which will update the registry.

I have 2 specific keys I wish to read which exist here:-

HKLM/Software/Hewlett-Packard/OpenView/OV_ETC_PATH

HKLM/Software/Hewlett-Packard/OpenView/OV_VAR_PATH

HKLM=HKEY_LOCAL_MACHINE

The above keys at this moment have the following values as can bee seen from the attached screenshot :-


\\nms10_2\openview

I want to read this value an then maybe create an update key to say read
:-

\\nms10_3\openview

But I cant even get the current key never mind update it ?

This is to be run on an NT4 machine.

I have searched the forum and the online help file but I cant seem to master it.

Can someone maybe give me a hand.

All the best

Jimmy

jimmy guilfoyle
10-27-2003, 11:50 AM
Hi

As I can only upload 1 attchment per post I thought I would give the AP get gey screen here as this may help me when someone replies.

Thanks again

:)


Thats strange..I couldnt upload the 2nd Image ?

jimmy guilfoyle
10-28-2003, 08:16 AM
Hi

I thought I would share the resolution of my problem...commonly known as finger trouble. :rolleyes:

I decided that I wasn't really interested in reading a reg value as all I was going to do was change it.

I have attached screen shot of a reg update window which worked.

Now can anyone tell me if it is possible to have the ability for you to be prompted for a key value e.g. rather than my key automatically updating a key to the value of \\NMS10\Openview

I want the user to type this value in manually when prompted and then the code will use whatever has been typed in as the value.

Hopefully that makes sense.

Appreciate any information.

Cheers

jimmy

TJ_Tigger
10-28-2003, 09:39 PM
Originally posted by jimmy guilfoyle
Hi

Now can anyone tell me if it is possible to have the ability for you to be prompted for a key value e.g. rather than my key automatically updating a key to the value of \\NMS10\Openview

I want the user to type this value in manually when prompted and then the code will use whatever has been typed in as the value.



You can use the Dialog.GetInformation to ask for a path where the application is installed. You might want to have a check that verifies the installation location. The value is stored in a variable then you can use that variable to set the registry value.

Not a lot of detail but I hope that helps move you in the right direction.

Cheers
Tigg,

Where in Scotland are you. Just this year I made it to Edinburgh and South Queensferry.

Corey
10-28-2003, 10:05 PM
Jimmy. If you explain, in a sentence, what the goal you are trying to achieve is I might be able to offer a better solution or approach. I'm unclear on the precise overall functionality you are seeking.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

jimmy guilfoyle
10-29-2003, 08:04 AM
Ok Guys...I am Scottish..so give me a break :D

What I have is 2 server PC`s with Network Names of NMS10_1 & NMS10_2

I also have a client PC (Slave) which will connect to either of the above PC`s.

Which one it connects to depends on the value of 2 keys in the registry.

These keys are



HKLM/Software/Hewlett-Packard/OpenView/OV_ETC_PATH

HKLM/Software/Hewlett-Packard/OpenView/OV_VAR_PATH

The actual key values for the above are:


\\NMS10_1\Openview or \\NMS10_2\Openview

So if I want to connect my client PC to a computer called NMS10_1 then I have to change these 2 key values.

This I managed to achieve by using the reg set function for a specific key value. So all the user does is click one of two text box which may say:-

Connect to NMS10_1
Connect to NMS10_2

This works fine but it means that I have to know the network names of the PC`s.

What I was looking for is for the user to enter the name of his PC and this value be used to update the key

e.g. imagine the current key value is \\nms10_2\openview

The user wants to change this value.

For example he clicks a Text box which and a windows asks him to type in the name of the PC he wants to connect to ?

He types in \\nms103\openview


Then this value is used to change the 2 keys


so the fill path & value will now read:-


HKLM/Software/Hewlett-Packard/OpenView/OV_ETC_PATH/NMS103/OPENVIEW

HKLM/Software/Hewlett-Packard/OpenView/OV_VAR_PATH/NMS103/OPENVIEW

HKLM is shorthand for HKEY_LOCAL_MACHINE.

The forward slashes don't actually mean anything, just representing the key & sub key & value.

I think thats maybe waht atributes are used for but I dont really know anything about these.

Hopefully that makes better sense.

Again guys any help would be appreciated.

all the best jimmy


I can always email you the project if thats possible ?


:confused: :confused: :confused:

Corey
10-29-2003, 08:42 AM
Well first, tell me Jimmy have you look into the SYSTEM > GET INFORMATION actions which relate to automatically retrieving LAN info? Might that be a better way to go than prompting for the data?

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

jimmy guilfoyle
10-29-2003, 09:01 AM
Thanks Corey


I see where you are coming from but I dont want anything to complex.

Its either we configure the names each time.

Or if the user wants to change his network names quite often they wont need to keep asking to update the project data for them.

I thought that user input will make the user feel more in control.

So if possible it would ne nice for them to put this value in a "user input box" of some sorts.

I woudl even ask them to put the complete path in \\NMS10100\Openview

So thats is where I am coming from.

Good lcuk

Jimmy


PS Its a fantastic program, I normally just use it for simplistic menus, launching programs, installing programs, but its very powerfull !

Corey
10-29-2003, 09:09 AM
Well then yes, a DIALOG > GET INFORMATION action will work well to get the user to give you the info and put it into a variable which you can then write to your registry key as a value using a REGISTRY > SET VALUE action. That's 2 actions total, nice and wee, "thrifty" even one might say... :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

jimmy guilfoyle
10-29-2003, 10:26 AM
Hi Corey

I have used the get information and I have assigned an atribute to this called jimmy


So I guess now I have info stored as an attribute, How do I now do a reg set using the attribute called jimmy

The attribute jimmy is essentially the value that will be written to the registry.

Its how to implement this :confused: :confused:

Im getting there..slowly !

TJ_Tigger
10-29-2003, 11:17 AM
Jimmy,

In the Registry - Set Value specify the Value Data: as your variable %jimmy%.

Set the Main key: to HKLM

The Sub key: to Software/Hewlett-Packard/OpenView/

The Value name: to OV_ETC_PATH

I assume the Value type: will be REG_SZ

and lastly set Value data: to %jimmy%

You will need to do that twice once for your ETC path and once for your VAR path.

Tigg

jimmy guilfoyle
10-29-2003, 11:41 AM
TJ_Tigger


Yihah

It works.

Did what you said !

Many thanks for that.

Can we expand it a little more ?

I have asked the user to type in information which is essentially my registry value.

He will type it in in the following format

\\NMS10\Openview


Infact the only value I want to change in the registry is that in red below:-

\\NMS10 \Openview


So is it possible to just update a specific characters in a registry key ?

I dont want the user making a mistake and putting in one backslash and maybe mispelling Openview.

I dont care if he puts in the wrong computer name as he can reslove that himself.

So again many thanks for that and if you can help me with the rest I will tell your our Village Motto :D

TJ_Tigger
10-29-2003, 11:57 AM
No problem.

You can ask the user to enter which computer they want to connect to and store that in your variable %jimmy%. Then when you specify the Value data: in your Registry - Set Value specify the following:

\\%jimmy%\Openview

You could make it even easier and have two buttons in the project that change the registy to the appropriate computer without requesting data from the user. If you want it to be more flexible you could use a list box and populate the list box from a txt file that you could distribute regularly when you need to make changes. They could then select the appropriate computer from the listbox object. In any of these scenarios, you could also display the current configuration for the user. Use the Registry - GetValueData to retrieve the current data for those keys and display the current configuration in a TextObject

TJ_Tigger
10-29-2003, 12:21 PM
Originally posted by jimmy guilfoyle
So again many thanks for that and if you can help me with the rest I will tell your our Village Motto :D [/B]

Are you from Linlithgow?

Corey
10-29-2003, 05:05 PM
Glad to hear you got it working Jim! :)

Tigg - For some reason they used to sing, "On the Bonnie shores of Loch Lomond" at our familiy reunions and several of my uncles had kilts and were pipers as teens. I guess that means I'm obviously part Scottish too although I never really realized it until now. Seems like a pretty good chance I might not think about it again for another 33 years, Scotland's too cold for the likes of skinny old me.

That might explain my intrinsic addiction to golf, and/or affinity for the band Big Country though...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

jimmy guilfoyle
10-30-2003, 04:38 AM
Tj & Corey

Very funny guys ! ;)

It`s a veryy powerfull program which has got my mind buzzing of waht i can do with it :eek:

Sunny Linlithgow !

Im not from there , Im from Rothesay Isle Of Bute (http://uk2.multimap.com/clients/browse.cgi?X=200000&Y=650000&gride=&gridn=&width=700&height=400&client=M6&db=&scale=500000&multimap.x=412&multimap.y=101)

My village motto is Every town has its village idiot, but in Rothesay we all take turns each !

:D :D


I now live in Hitching in herts. Moved down here end of June from Edinburgh--career move and all that.

Must admit I would do anything to emigrate...love to goto Canada.

I know a guy in Linlithgow, we call him Shrek...he is big and he`s ugly his real name is David Roy and he works for Bt!

I was on the **** there once !

I also have me kilt although its getting a bit cold, I used to follow Scotland (The tartan Army) (http://www.t-army.com/tar_pics.html)

Where the dress code was kilt and t shirt, I visited Beligium, Holland ,Latvia, London (Very Dangerous...neraly got linched by a mob)

It was good fun, but then I met my woman....and its sort of stopped :(

Anyway guys, can I just say thankyou for thye great support, i am going to ask more questions about this as I quite like the idea of a user inputting computer names which are stored in a text file and then rather than type in a name he chosses computer names from a drop down list.

Im even interested in how the user could do this on a remote computer :confused:


Speak later, must get some work done ;)

Corey
10-30-2003, 12:29 PM
Start a new post about the remote thingy, this one's getting loooooong. Yeah Canada's great, I didn't realize it was hard to move here. From our end it seems like everyone gets in, which is pretty much how we like it. The more diversity the merrier I always say.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)