Jump to content

registry Search RegEnumKey


Mecano
 Share

Recommended Posts

Hallo forum members,

I try to find out how to find a exact key from the register

RegEnumKey shows the key is there in de Message box

So when $var contains Photoshop then the message must be MsgBox(48,"Found","Found Photoshop",2)

But it shows

No Photoshop","No Photoshop found

What Im doing wrong?

;Test if to find out if Photoshop was on this computer

#NoTrayIcon

For $i= 1 to 10
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe", $i)
    If @error <> 0 then ExitLoop
MsgBox(4096, "SubKey #" & $i & " under HKLM\Software: ", $var);Msg box is just an test to see Photoshop is there
Next

$ff = ($var & "\Photoshop")
    If $ff = 1 Then
    
MsgBox(48,"Found","Found Photoshop",2)
        
Else
        
MsgBox(64,"No Photoshop","No Photoshop found",2)
EndIf
Link to comment
Share on other sites

$ff = ($var & "\Photoshop")

If $ff = 1 Then

MsgBox(48,"Found","Found Photoshop",2)

Else

MsgBox(64,"No Photoshop","No Photoshop found",2)

EndIf

for you info... $ff value is "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop" and not 1 !!

that's why you get "No Photoshop found"

Link to comment
Share on other sites

or you can do this...

;Test if to find out if Photoshop was on this computer

#NoTrayIcon

For $i= 1 to 10
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe", $i)
    If @error <> 0 then ExitLoop
    If $var = "Photoshop" Then
         MsgBox(48,"Found","Found Photoshop",2)       
    Else       
         MsgBox(64,"No Photoshop","No Photoshop found",2)
    EndIf
;MsgBox(4096, "SubKey #" & $i & " under HKLM\Software: ", $var);Msg box is just an test to see Photoshop is there
Next
Link to comment
Share on other sites

Thanxs to all for repley

I started with this RegRead and didnt work that's why I tried it with RegEnumKey

$result = RegRead("HKLM\Software\Adobe\Photoshop", "")
If @ERROR Then
    MsgBox(0,"","Photoshop not found"): Nope
Else
    MsgBox(0,"","Photoshop found")
EndIf

Doesn't work

you have to put the full string in the script ,dont want to use this cause could be as well an other version

-----------------------------------------------------------------------------------------------------------------------------------

result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\9.0", "PluginPath")
If @ERROR Then
    MsgBox(0,"","Photoshop not found")
Else
    MsgBox(0,"","Photoshop found"): Yep
EndIf

==========================================================================

This script give a loop 4 times an message box the third says found photoshop

#NoTrayIcon

For $i= 1 to 10
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe", $i)
    If @error <> 0 then ExitLoop
    If $var = "Photoshop" Then
         MsgBox(48,"Found","Found Photoshop",2)       
    Else       
         MsgBox(64,"No Photoshop","No Photoshop found",2)
    EndIf
;MsgBox(4096, "SubKey #" & $i & " under HKLM\Software: ", $var);Msg box is just an test to see Photoshop is there
Next

-----------------------------------------------------------------------------------------------------------------------------------

the reg code:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\9.0]
"FreeBeforeSlopAdjust"=dword:0013ddf0
"FreeSpace"=dword:0009c228
"ApplicationPath"="E:\\Program Files\\Adobe\\Adobe Photoshop CS2\\"
"PluginPath"=""

Want to make tis one to detect more versions then Photoshop 9

Maybe StringSplit an option?

but I'm an newbie with this

a little kick in the right direction

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...