Sign in to follow this  
Followers 0
Hawkwing

regread problem

8 posts in this topic

From what I can see, this code should constantly display the tooltip 1 beneath the cursor. It works when the background is set to Bliss, but when I change it to anything else, the code doesn't do anything.

While 1
    If Not RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then ;I assume that this is the part that doesn't work for some reason
        ToolTip ("1")
    EndIf
    If RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then
        ToolTip ("1")
    EndIf
WEnd

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites



It should be like this:

While 1
    If RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") <> "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then;I assume that this is the part that doesn't work for some reason
        ToolTip ("1")
    EndIf
    If RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then
        ToolTip ("2")
    EndIf
WEnd

Share this post


Link to post
Share on other sites

I see. So instead of using "If Not" I just have to replace the = with <>. Thanks.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

You can also keep in the same way just enclose it by ()

While 1
    If Not (RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp") Then ;I assume that this is the part that doesn't work for some reason
        ToolTip ("1")
    EndIf
    If RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then
        ToolTip ("1")
    EndIf
WEnd

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Why not just use this?

While 1
    If RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") = "C:\WINDOWS\Web\Wallpaper\Bliss.bmp" Then
        ToolTip(1)
    Else
        ToolTip(0)
    EndIf
WEnd

The thing was the way you said it was Not RegRead ("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") which will equal 1 if true else false then you are doing the = and with 1|0 doesn't equal a "C:\WINDOWS\Web\Wallpaper\Bliss.bmp". I just changed the way it was being said with NOT and enclosed in braces the comparision of two strings if they equal 1 then the finished product will be 0, if is 0 then 1 will be shown.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Also look at the order of operation under the help.

From highest precedence to lowest:

NOT

^

* /

+ -

&

< > <= >= = <> ==

AND OR

The only thing that counter it would be that of ()

You can use brackets to force a part of the expression to be evaluated first.

e.g. (2 + 4) * 10 equals 60.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

I was editing a script that changed the background. I was trying to make a loop that would change the background between $x different .bmp files. I used the If Not and didn't know that I had to put brackets around the RegRead. This script was just a simple test to locate exactly where the problem was happening.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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