MariusN Posted November 15, 2010 Share Posted November 15, 2010 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 Link to comment Share on other sites More sharing options...
Juvigy Posted November 15, 2010 Share Posted November 15, 2010 If RegRead("HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\", "Shell") == "" then MsgBox(0x10, "WARNING!!!","Key doesnt exist") Link to comment Share on other sites More sharing options...
MariusN Posted November 15, 2010 Author Share Posted November 15, 2010 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 Link to comment Share on other sites More sharing options...
MariusN Posted November 15, 2010 Author Share Posted November 15, 2010 (edited) Ops no i'm wrong...still doesnt work Edited November 15, 2010 by MariusN Link to comment Share on other sites More sharing options...
Tvern Posted November 15, 2010 Share Posted November 15, 2010 (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 November 15, 2010 by Tvern Link to comment Share on other sites More sharing options...
wakillon Posted November 15, 2010 Share Posted November 15, 2010 (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" Edited November 15, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
MariusN Posted November 15, 2010 Author Share Posted November 15, 2010 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" Geez....why didnt i think of that...thanks guys Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now