SWSSSM Posted August 6, 2020 Share Posted August 6, 2020 Hey Girls & Guys I tried to create an scipt part (like the fist part) that includes RegWrite commands and Send Commands to write a registry key (just one). After part 1 would come part 2/3/4/5 (all just install-parts with RUN that i already wrote) Can someone help me, what is wrong in my Part1 script? Here the script: ; Folder: 01. Enable\Optimierung.reg - Registry key add part #RequireAdmin ; Admin priviledge $regFile = @TempDir & '\01. Enable\Optimierung.reg' RunWait("Regedit " & $regFile) ; Key check RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections") ; Key write RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "REG_DWORD", "00000001") Sleep(4000) If WinActive("Registrierungs-Editor", "") Then Send("{ENTER}") EndIf Link to comment Share on other sites More sharing options...
Nine Posted August 6, 2020 Share Posted August 6, 2020 (edited) I think your problem comes from the RunWait, although you did not say what is your problem. RunWait will wait until the program you are running (in your case regedit) is completed before continuing the script. What you really want is to use Run or ShellExecute (in your case I would use ShellExecute). Something like this should work : #RequireAdmin #include <Constants.au3> $regFile = "Test.reg " ; @TempDir & '\01. Enable\Optimierung.reg' ShellExecute ($regFile) Local $hWnd = WinWait ("[CLASS:#32770]") ControlSend ($hWnd, "", "", "{ENTER}") Sleep (300) $hWnd = WinWait ("[CLASS:#32770]") ControlSend ($hWnd, "", "", "{ENTER}") ; Key check Local $sReg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections") MsgBox ($MB_SYSTEMMODAL,"",$sReg) ; Key write RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "REG_DWORD", 1) If @error Then MsgBox ($MB_SYSTEMMODAL,"Error",@error) Only thing left for you is to add more error handling. I only add one at the end. I do not fully understand why you are mixing the execution of .reg file with RegWrite function. My advice is to use only RegWrite and drop the .reg files. And when you post code, please use this tool. Edited August 6, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
jguinch Posted August 7, 2020 Share Posted August 7, 2020 Use Regedit /s to skip the message box from regedit Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF 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