This piece of code creates and reads OK a key at "HKEY_LOCAL_MACHINE" and can be changed for a key at "HKEY_CURRENT_USER"
$sta= RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor", "wav", "REG_SZ", "5555") MsgBox(4096,"wrote", $sta &@cr& @error) $zz= RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor", "wav") MsgBox(4096,"readed","="&$zz &@cr& @error) Exit With HKEY_CURRENT_USER, in RegEdit we can see the created key, and we can create the key by hand/RegEdit and everything Works OK.
At HKEY_LOCAL_MACHINE we can´t see the created key above thru RegEdit, but it Works (even not seeing, I can read). But if I create "by hand"/RegEdit the key, it can´t read it with $zz= RegRead ("HKEY_LOCAL_MACHINE.... above.
I´m the PC´s WIN.7 administrator. Even so I ran RegEdit as administrator and also the compiled AU3 and also plain. No changes.
edit: even if Try "HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav", the same holds true.
$sta= RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav", "REG_SZ", "4444") MsgBox(4096,"wrote", $sta &@cr& @error) $zz= RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav") MsgBox(4096,"readed","="&$zz &@cr& @error) Exit Seems that it creates this key at another place.... I can read the above value ("4444"), even after a boot, even the key not showing in regedit. And if I create it by hand key AAA/wav with a distinct value (666), t, it continues Reading the old value = 444.
I'm writing a little applet that basically tells you when Windows was installed. There is a REG_DWORD in Windows that gives you this. It's basically a value that is the # of seconds from 1970.
The location is: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate"
So if I run this in AutoIT, I should get the value displayed within the msgbox:
MsgBox($MB_SYSTEMMODAL, "InstallDate Test", RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate"))
However, what happens is it always returns a value of "0" I tried this on several machines (Windows 8, Windows 8.1 and Windows 10).
Am I missing something? If I manually view this REG_DWORD with RegEdit, it shows me the HEX value, or I can view the Decimal value. I don't care which value AutoIT reads, as I can always convert back and forth, but I just don't see why it can't read a value from this REG_DWORD. As a test, I've read other REG_DWORD values, and with most it doesn't return any value, not even a 0.
Please, even if you guys have some other (perhaps better) way to read the Windows install date, I would still like to find a resolution to this problem, because I want to understand why I am having so much difficulty with reading REG_DWORD values from the Windows Registry with AutoIT.
Thanks for any help!
Hi all, first post here ever, I'm working on a project, Helpdesk type tool. I'm trying to set the State (Checked, Unchecked) of check boxes, and Or button, (a Toggle). this would be set by determining the Value of Certain Reg keys, here is my phone below. $PC_select_data is the Computer Name so you could replace it with "@Computer".
I looked and looked and couldn't find whats wrong.
I'm new to Autoit somewhat.
I may be complicating things by assigning Arrays for my controls, but I think this will work.
the first part is fine, I get a Computer from a list (that I got from AD with Water's Awesome UDF)
please not I'm using onevent also, well. the UDF OnEventA that allows upto 4 ByVal or Ref's
I get the Value $PC_selected_data
return the value to the Function
I send a test Key with Regread, if I can't read it I launch sc.exe to run Remote Reg.
Then I read 5 values from the Remote Reg. I assigned a Array of those Values and Also Assigned a Array of my CheckBoxes also.
Now my logic, if the Value of the REG key is "" (blank) then UnCheck all the check boxes, else, Check them. Now, to make this more efficient, I put the Controls in an Array, of the Same Lenth. now here is the think, I run my script, it runs fine, finds the value, and Un-checks all of the check boxes, now if I go change one of the REG values, it does not Check them. because of the Logic for the For Loop. I would have figured that If the first value of the Array $Run_as_MSIscheck = somevalue that it would see that as a "ELSE" and Check the box. Since the For loop contains the If - then- Else, but I Understand that it only runs the first Block, IF the condition is True. So I guess Am I totally off track?
Func Check_PC_status($PC_select_Data) local $pingPC local $regtemp = "" local $x = "" local $Run_as_MSIcheck,$Run_as_CMDcheck,$Run_as_BATCheck,$Run_as_REGcheck local $RUNas_chks = [$MSI_runAs_chk,$CMD_runAs_chk,$BAT_runAs_chk,$REG_runAs_chk] local $runAS_function_check = [$Run_as_MSIcheck,$Run_as_CMDcheck,$Run_as_BATCheck,$Run_as_REGcheck] ;~ @error: ;~ 1 = Host is offline ;~ 2 = Host is unreachable ;~ 3 = Bad destination ;~ 4 = Other errors ;Sends Ping to pc to see if its live or not. $pingPC = ping($PC_select_Data,2000) ;if Ping has returned a good value, NOT 0. check current status of the following lines in registry. checkes for RunAS for CMD/MSI/BAT and Remote REG keys. checks for SMS prompt control. if $pingPC Then ;tries to read a key from the registry, and returns its value, if its blank, $regtemp = RegRead("\\" & $PC_select_Data & "\HKLM\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control", "Permission Required") ConsoleWrite("Sending test Key, is set to: " & $regtemp & @CRLF) ;~error: 3 = Bad destination if @error = 3 or $regtemp = "" Then ConsoleWrite("Unable to determine status of remote registry!!!" & @CRLF & "Trying to start Remote Registry.... via Service Control Manager" & @CRLF ) RunWait(@SystemDir & '\sc.exe \\' & $PC_select_Data & ' start RemoteRegistry',"","") if Not @error then ConsoleWrite("Remote Registry loaded" & @CRLF & @CRLF) EndIf EndIf TCPStartup() $IPadd = TCPNameToIP ($PC_select_Data) ConsoleWrite($IPadd & @CRLF) TCPShutdown() ConsoleWrite("ping Success: " & $pingPC & "ms" & @CRLF) $Sccm_PROMPTcheck = RegRead("\\" & $PC_select_Data & "\HKLM\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control", "Permission Required") $Run_as_MSIcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command", "") ; MSI access Check $Run_as_CMDcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\cmdfile\shell\runas\command", "") ; CMS access Check $Run_as_BATCheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\batfile\shell\runas\command", "") ; BAT access Check $Run_as_REGcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\regfile\shell\runas\command", "") ; REG access Check ConsoleWrite("SMS Client status: " & $Sccm_Promptcheck & @CRLF & "MSI RunAS Status: " & $Run_as_MSIcheck & @CRLF & "CMD RunAs Status: " & $Run_as_CMDcheck & @CRLF & "BAT RunAs Status: " & $Run_as_BATCheck & @CRLF & "REG RunAs Status: " & $Run_as_REGcheck & @CRLF & @CRLF) for $x = 0 to UBound($runAS_function_check) -1 ConsoleWrite("Count: " & $x & @CRLF) if $runAS_function_check[$x] = "" Then $test1 = guictrlread($RUNas_chks[$x]) ConsoleWrite("B4 " & $test1 & @CRLF) GUICtrlSetState($RUNas_chks[$x],$GUI_UNCHECKED) $test2 = guictrlread($RUNas_chks[$x]) ConsoleWrite("After " & $test2 & @CRLF) Else GUICtrlSetState($RUNas_chks[$x],$GUI_CHECKED) EndIf Next Else ConsoleWrite($PC_select_Data & " is Not reachable" & @CRLF & @CRLF) EndIf Endfunc any help is appreciated.
I with @SmOke_N 's help found the answer to this question in this thread: https://www.autoitscript.com/forum/topic/166384-regread-read-saved-credentianls-from-ie/
Now this was working fine until lately. I updated from Windows 7 ultimate to Windows 8.1 Pro. And this small sample doesn't seem to work anymore.
Here is the code from the old thread:
#include <APIRegConstants.au3> #include <Array.au3> #include <WinAPIDiag.au3> #include <WinAPIReg.au3> #include <Crypt.au3> Global $gsValName, $giType Global $giCount = 0 Global $gaInfo Global $sPath = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IntelliForms\Storage2" Global $aPath = "Software\Microsoft\Internet Explorer\IntelliForms\Storage2" Global $ghKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, $aPath, $KEY_READ) While 1 $gsValName = _WinAPI_RegEnumValue($ghKey, $giCount) If @error Then ExitLoop $giType = @extended If Mod($giCount, 100) = 0 Then ReDim $gaInfo[$giCount + 100] EndIf $gaInfo[$giCount] = $gsValName $gaInfo[$giCount] = $giType $gaInfo[$giCount] = BinaryToString(_Crypt_DecryptData(RegRead($sPath, $gsValName), "", $CALG_3DES)) ;$CALG_USERKEY $giCount += 1 WEnd _WinAPI_RegCloseKey($ghKey) ReDim $gaInfo[$giCount] _ArrayDisplay($gaInfo)
When I manually checked the registry in this path HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IntelliForms\Storage2 my credentials aren't saved there anymore.
Does anyone know the right path to the IE's saved credentials?
HotKeySet("^``", "toggle_media_controls") ; Ctrl + ` While 1 Sleep(100) WEnd If Not ProcessExists("wmplayer.exe") And RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") = 1 Then ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf Func toggle_media_controls() Local $sVar = RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") If ProcessExists("wmplayer.exe") Then If $sVar = 0 Then ; Enable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "1") Else ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf EndIf EndFunc How do I amend this code so that without pressing a hotkey, after Windows Media Player is not running, the regkey above is set to 0?
My function and hotkey all work without issue