Jump to content
Sign in to follow this  
keilamym

help please... simple RegRead issue

Recommended Posts

keilamym

i just started writing this new code and as of now, its rather simple... i want autoit to look at the main "rebootrequired" key and based on its existance, i'll have it produce a popup or whatever...

I created this simple code but the error code is ALWAYS the same (1) , regardless of if the rebootrequired key is there or not.

RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired","")
MsgBox(4096,@error,@error)

I figured the space between "Auto Update" was creating a problem but couldn't figure it out... ive writtien many scripts and have never had this problem.. any assistance would be appreciated.

Edited by keilamym

Share this post


Link to post
Share on other sites
Nessie

Try this:

$Check_Key = _Reg_KeyIsEmpty("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired")

If $Check_Key = -1 Then
MsgBox(16, "Error", "Key doesn't exist")
Else
If $Check_Key = 0 Then
MsgBox(0, "Done", "The key exist and have values and keys.")
ElseIf $Check_Key = 1 Then
MsgBox(0, "Done", "The key exist and have only Keys.")
ElseIf $Check_Key = 2 Then
MsgBox(0, "Done", "The key exist and have only Values.")
ElseIf $Check_Key = 3 Then
MsgBox(0, "Done", "The key exist and have NOT values and Keys.")
EndIf
EndIf

Func _Reg_KeyIsEmpty($eKey)
; -1: key doesn't exist
; 0: keys and values
; 1: only Keys
; 2: only Values
; 3: no Keys, no Values
RegRead($eKey, '')
If @error = 1 Then Return -1
Local $RegKeyIsEmptyCount = 0
RegEnumVal($eKey, 1)
If @error = -1 Then $RegKeyIsEmptyCount += 1
RegEnumKey($eKey, 1)
If @error = -1 Then $RegKeyIsEmptyCount += 2
Return $RegKeyIsEmptyCount
EndFunc ;==>_Reg_KeyIsEmpty
Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
Akshay07

Hi Nessie (and all),

I am also having problems when attempting to read this registry key:

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000CodecInitDelay

Nessie, I used your script and get the message "Key doesn't exist" but it does exist, I see its value with regedit.

The path is correct, I used the "Copy Key Name" feature of the Windows Registry Editor.

Key type is REG_SZ.

Any hint would be welcomed !

Edit 1: I believe

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000CodecInitDelay

is available on most of the Windows PCs.

Edit 2:

If I use:

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000

I get "The key exist and have values and keys."

But i want the value of CodecInitDelay. Am I using the wrong instruction (RegRead) ?

Edited by Akshay07

Share this post


Link to post
Share on other sites
careca

I have HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000

But don't have that key 'CodecInitDelay'.

win7 x64 pro

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Akshay07

Thanks Careca,

My question is valid for any REG_SZ value that is under

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000\

Share this post


Link to post
Share on other sites
Nessie

Hi Nessie (and all),

I am also having problems when attempting to read this registry key:

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000CodecInitDelay

Nessie, I used your script and get the message "Key doesn't exist" but it does exist, I see its value with regedit.

The path is correct, I used the "Copy Key Name" feature of the Windows Registry Editor.

Key type is REG_SZ.

Any hint would be welcomed !

Edit 1: I believe

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000CodecInitDelay

is available on most of the Windows PCs.

Edit 2:

If I use:

HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000

I get "The key exist and have values and keys."

But i want the value of CodecInitDelay. Am I using the wrong instruction (RegRead) ?

The HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000CodecInitDelay doesn't exist on my Windows XP SP3 x86.

Instead HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass{4D36E96D-E325-11CE-BFC1-08002BE10318}0000 exist and contains values and keys.

Do you have an x64 system? BTW you have to use:

RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0000\CodecInitDelay", "THE NAME OF THE VALUE THAT YOU WANT READ")
.

If you are using a 64 bit os you have to add a "64" after HKEY_LOCAL_MACHINE,so:

RegRead("HKEY_LOCAL_MACHINE64\SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0000\CodecInitDelay", "THE NAME OF THE VALUE THAT YOU WANT READ")

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
LarryDalooza

ugh...

RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0000","CodecInitDelay")
Edited by LarryDalooza

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
careca

LoL, yeah... :P


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Akshay07

ugh...

RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0000","CodecInitDelay")

Thank you !

Share this post


Link to post
Share on other sites
Nessie

Thank you !

So your CodecInitDelay is a value and not a registry key as you have always said, that's why you had problem :P

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

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  

×