Sign in to follow this  
Followers 0
MariusN

Regread or some other command?

7 posts in this topic

The below code will display the Sring Value DATA that's in "Shell" --->

$read = RegRead("HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\", "Shell")

MsgBox(0x10, "WARNING!!!",$read)

What i want to know is, how can i code to show if only the "Shell"-key exists? (i dont worry whats IN the shell, just want to know if "Shell" exists...

thx folks

Share this post


Link to post
Share on other sites



If RegRead("HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\", "Shell") == "" then MsgBox(0x10, "WARNING!!!","Key doesnt exist")

Share this post


Link to post
Share on other sites

I have tried it Juvigy...it doesnt work. If Shell IS there (but the DATA is empty) it will tell me the key is not there, while

in the meantime it IS there :graduated:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ops no i'm wrong...still doesnt work :graduated:

Edited by MariusN

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Can't you just check the @error value of RegRead? If @error is 1,2 or -1, the value doesn't exist.

Edit. typo

Edited by Tvern

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Tvern is Right

$_Var = RegRead ( "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell", "" ) 
Switch @error
    case 1
        $_Msg  = 'Unable to open requested key'
    case 2
        $_Msg  = 'Unable to open requested main key'    
    case 3
        $_Msg  = 'Unable to remote connect to the registry' 
    case -1
        $_Msg  = 'Unable to open requested value'   
    case -2
        $_Msg  = 'Value type not supported' 
    case Else
        $_Msg  = $_Var  
EndSwitch   
    
ConsoleWrite ( "-->-- " & $_Msg & @Crlf )

if key exists but no value, it gives "Unable to open requested value"

if key not exists, it gives "Unable to open requested key" Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Tvern is Right

$_Var = RegRead ( "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell", "" ) 
Switch @error
    case 1
        $_Msg  = 'Unable to open requested key'
    case 2
        $_Msg  = 'Unable to open requested main key'    
    case 3
        $_Msg  = 'Unable to remote connect to the registry' 
    case -1
        $_Msg  = 'Unable to open requested value'   
    case -2
        $_Msg  = 'Value type not supported' 
    case Else
        $_Msg  = $_Var  
EndSwitch   
    
ConsoleWrite ( "-->-- " & $_Msg & @Crlf )

if key exists, it gives "Unable to open requested value"

if key not exists, it gives "Unable to open requested key" Posted Image

Geez....why didnt i think of that...thanks guys :graduated:

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