Jump to content

Recommended Posts

Posted

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

Posted

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:

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
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.18.0 X86 - SciTE 4.4.6.0WIN 11 24H2 X64 - Other Examples Scripts

Posted

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:

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
×
×
  • Create New...