Sign in to follow this  
Followers 0
t0ddie

registry help

12 posts in this topic

i have been trying to make workarounds for a simple task but keep running into issues!

i am reading a registry value from within a loop and when the registry value changes the script exits out of the loop.

the problem is that sometimes the value that is entered (from another program) is the same as the value that is already in the registry key.

so my script never exits the loop!

one workaround i used was to delete the registry value.

that way it will change every time, but this is not desirable because i need to leave the value there before i write the new value.. or other functionality doesnt work.

i was wondering if its possible to just check if the registry was written to, or if there is any other workaround.

i need to detect a registry value being entered even if the value is the same as it was before.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

here is some pseudo-code to explain what i want to do.

while 1     
$value1 = RegRead("HKEY_CURRENT_USER\Software\Anysoft\Game", "Last login")
        Do
sleep(100)
        $value2 = RegRead("HKEY_CURRENT_USER\Software\Anysoft\Game", "Last login")
        Until $value2 <> $value1
msgbox(0,"passed","passed")
wend

if the value of "Last login" is different every time, then this works.

but sometimes the same value is written to the registry key, so i tried this workaround

while 1     
$value1 = ""
        RegDelete("HKEY_CURRENT_USER\Software\Anysoft\Game", "Last login")
        Do
sleep(100)
        $value2 = RegRead("HKEY_CURRENT_USER\Software\Anysoft\Game", "Last login")
        Until $value2 <> $value1
msgbox(0,"passed","passed")
wend

but i dont want to delete the registry value because another program is using this registry value.

so i was thinking maybe there was a way to determine what TIME a value was written to the registry.

or some other way of detecting it.

this is where im stuck.

thanks.

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

I know there is no way in hell you will be able to understand and implement the answer without tremendous help from somebody (not me). However, I will still tell you against my better judgement that what you are looking for is the Windows API function RegNotifyChangeKeyValue().

Share this post


Link to post
Share on other sites

makes sense. thanks.

your right its beyond my capabilities.

its the idea i came up with as a workaround for my dillemma...

although im not experienced in how to go about doing it.

and yes i would need some serious help to do it :o


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

that is helpful but its not able to be included into a script and run on any machine.

what im looking to do is be able to detect this in a script, not from a third party application.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

that is helpful but its not able to be included into a script and run on any machine.

what im looking to do is be able to detect this in a script, not from a third party application.

Hmmh,

I don´t know if this might help, but I give it a try.

Can you copy the RegValue change it maybe to Login2 an then you campare?

So you´ll have and additional RegKey.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

no that would not work.

it would just present the same issue.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

no that would not work.

it would just present the same issue.

HI,

sure. :o

Next try. What is the value of that regkey? Maybe you could change the value without stopping the other apps dealing with it correctly. And then you can look for your change to be overwritten.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

no that wont work either.

i have no control over what the other application does.

another possibility would be to check when a registry key was read, but then we run into the same problem.

dont have any autoit functions for that.

i could change the reg key value after the application has used it

only problem is i cant "detect" when the other application has used the registry key.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

I know there is no way in hell you will be able to understand and implement the answer without tremendous help from somebody (not me). However, I will still tell you against my better judgement that what you are looking for is the Windows API function RegNotifyChangeKeyValue().

@t0ddie

This looks like your best bet then... look around the forum and see how other people called the windows API. Please don't make a new topic, it gets kinda annoying; you made about 3 for your telnet app. I haven't had the need to do this so i don't know how to do it. Good Luck.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0