Jump to content

Search the Community

Showing results for tags 'regwrite'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 14 results

  1. I am having an issue with windows 10 and regwrite. when i run my script it acts as though it has updated the registry but when i view the registry it has not updated the keys. I added error checking to the script but it is not showing errors. now if i remove #requireadmin i will get error 1 - unable to open requested key. her is my code. #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Process.au3> ; Declared Variables Global $userName = "user" Global $userPassword = "Ktesting" Global $autologin = "1" Global $notification = "0" Global $balloon = "0" If @OSArch = "X64" Then Global $HKLM = "HKLM64" Else Global $HKLM = "HKLM" EndIf ; Looks for switch on program start If $CmdLine[0] > 0 Then ; looks for switch on startup If $CmdLine[1] = "/boot" Then BootMachine() Else MachineInstallation() EndIf ; Setup Kiosk for first time Func MachineInstallation() #RequireAdmin MsgBox (1, "Installation", "Starting Install") ; Add Program to Run registry Key RegWrite ($HKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "DL Kiosk", "REG_SZ", "c:\temp\DL Testing Kiosk\dl testing kiosk.exe /boot") If @error Then MsgBox (1, "error", @error) EndIf ; Add Automatic Logon Registry Key RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", $autologin) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", $userName) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", $userPassword) If @error Then MsgBox (1, "error", @error) EndIf ; Pop Ups and Notification Center Registry RegWrite ("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "REG_SZ", $notification) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableBalloonTips", $balloon) If @error Then MsgBox (1, "error", @error) EndIf MsgBox (1, "Installation", "Install completed") EndFunc Exit EDIT: i think i figured out my problem. I was missing the space between Windows and NT. user error, sorry.
  2. So I want to remap Capslock to Ctrl using Autoit ;3A00 = Caps ;1D00 = Ctrl RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout","Scancode Map","REG_BINARY","000000000000000002000000E0473A0000000000") However it isn't doing anything. And I have no idea why my code doesn't work.
  3. Hi all to the forum guru and expert I am trying to automate this. in the registry I have the network profile name network 2 and network I want to change their CATEGORY to Private . Can someone lead me in the right direction. Private is 1 and Public is 0 #RequireAdmin Global $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM" RegWrite($sHKLMRoot &"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" ,'/v NetworkList /t REG_MULTI_SZ /d 00000000 /f') see attached picture below Much appreaciate
  4. Hello guys, I'm having a problem right here .. I was trying to create a few Registry Values using autoit, but it seems to me that Autoit can't write those values to this specific part of the registry .. Here is the code I'm trying to run: RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\test\command", "", "REG_SZ", "C:\test\convert.exe %1 geojson|convert") I'm definitly sure that the path is correct. Script is runned with Admin Rights. Everything's fine here. It's possible to read other values stored by Windows in this directory: MsgBox(0, 0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.burn", "Description")) But you can't edit those using Autoit. I don't know what this is. In my eyes it's an Autoit Bug or something like that ... Possible solution for me is to write a ".reg" file and run it afterwards, but this is an unclean method I don't really want to use .. Any suggestions on this? Edit: the OS is Windows 7 x64 German Language btw ..
  5. 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[4] = [$MSI_runAs_chk,$CMD_runAs_chk,$BAT_runAs_chk,$REG_runAs_chk] local $runAS_function_check[4] = [$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.
  6. 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 EndFuncHow 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
  7. Hi, is this the right way to use RegWrite func on 32-bit and 64-bit Windows $HKEY_CURRENT_USER = 'HKEY_CURRENT_USER64' If @OSArch = 'X86' Then $HKEY_CURRENT_USER = 'HKEY_CURRENT_USER' RegWrite($HKEY_CURRENT_USER & '\Software\Microsoft\Windows\CurrentVersion\Run', 'Obd2Diag', 'REG_SZ', 'app') Thanks in advance
  8. So I am trying to write a script that can take the current computer name and write it to a registry key. This key uses REG_BINARY type of key and looks like this: Value 1 Name: LocalName Type: REG_BINARY Data: 00000000 54 4f 55 47 48 42 4f 4f - 4b 36 30 39 38 00 00 00 TOUGHBOOK6098... 00000010 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000020 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000030 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000040 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000050 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000060 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000070 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000080 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000090 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000a0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000b0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000c0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000d0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000e0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000f0 00 00 00 00 00 00 00 00 - ........ Its apparently very important that all the ending 00's are in there I found this out as I was working on some other keys that had to do with security settings, and if the key was say 01 00 00 putting any less or any extra ending zeros would cause the change in the regsitry to not effect the software. So what I am attempting to do is use the @ComputerName macro and plug it into a StringtoBinary() function and then write it to the registry. The challenge I face is how to fill in the entire binary value for the registry key and not just the converted strings value. I wonder if there is some easy code to do that. I imagine there must be a few ways but I am looking for the most straight forward/easiest. Also on a side note, instead of using RegWrite is there a way to create a .REG file that I can call from CMD with Reg Import? This is being done at an enterprise level and the users do not have access to write to the registry, but they can import a reg file via .bat or in my case a Autoit .exe with @ComSpec Currently I am importing all the "static" keys I need for configuration, but computer name is dynamic so that is why I am trying to find a way to use the @ComputerName macro to insert that value. Regards,
  9. So im trying to install office 2013 via the OEM click to run app which i get through with "send()" but i need to disable UAC and reboot because of the prompt. you can do this by changing some registry keys but i cant for the life of me get this to run. when i run the following from cmd: ;Run('C:\Windows\System32\cmd.exe /k %windir%System32reg.exe ADD "HKLMSoftwareMicrosoftWindows NTCurrentVersionWinlogon" /v DefaultPassword /t REG_SZ /d password /f ') it tells me the operation completed sucsessfully and the values have changed. when i run the same command from autoit it tells me it was sucsessful however the registry values have not changed. ive tried running as administrator and as a regular user but no dice. ive tried regwrite and also using @comspec. these are the only 4 values i need to change, can someone shed some light on where im going wrong? ;Run('C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f ') RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "1") sleep(1000) ;Run('C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Admin /f ') RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", "Admin") sleep(1000) ;Run('C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d password /f ') RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", "password") sleep(1000) ;Run('C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f ') RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_DWORD", "0") sleep(4000) Shutdown(6)
  10. Hi...I was trying to mute flash player sound so, when I couldnt I find an alternate way to mute sound. here is my code:- RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Play_Background_Sounds", "REG_SZ", "no") #include <IE.au3> Local $oIE = _IECreate("www.mywebsite.us") sleep(10000) _IEQuit($oIE) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Play_Background_Sounds", "REG_SZ", "yes") so, basically, first regedit is disabling IE sound. But it only works with HTML5 player not Flash player. So, I find a regedit key which can disable Flash in IE. (After disabling Flash in IE, videos are playing in HTML5 player which is already muted, and my object is fulfilled.) i.e.:- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}] "Compatibility Flags"=dword:00000400 I want to put it in 2nd line of my code but I cant figure out how I set this regkey using RegWrite function. Can anyone please help me? --- oK..I did it RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}") Regwrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}", "Compatibility Flags", "REG_DWORD", "1024")
  11. Hi guys For a script i need to show extension ( if is not enabled by default ) and the restore the original value after my function. The script: Global $Ini = @ScriptDir & "\Test.ini" FileExt("Show") Sleep(5000) FileExt("Default") Func FileExt($parameter) Local $RegKey = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt") Local $SaveKey = IniRead($Ini, "Data", "HideFileExt", "") If $parameter = "Show" And $SaveKey = 1 Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 0) EndIf If $parameter = "Default" Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", $SaveKey) EndIf EndFunc ;==>FileExt The problem is i can't see any difference I have try to send F5 ( and press F5 on my keyboard ) but nothing. The only thing work is click with the mouse left on the desktop/folder --> Refresh There is an equivalent for my script? Thanks as always
  12. I am trying to replace an existing registry value (which is a string) by another one. The following doesn't work, any idea why ? RegWrite("KEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0001", "UserInit", "REG_SZ", $modifiedValue) Thanks
  13. Hello All, I'm sure this is an easy issue (for someone.) I really did do a bunch of searching, but have had no luck. I'm simply trying to change the value of a REG_EXPAND_SZ registry, but failing with an error code of 0. The RegRead works and is correct, so the registry path is correct. I'm guessing it has something to do with how I'm building the string for the reg_expand_sz. I have other RegWrite's that are REG_SZ that write correctly earlier in the script. Any help would be much appreciated! $currentDefault = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "Default") MsgBox(4096, "Current Default Profile in Registry", $currentDefault) $model = InputBox("Model Profile", "Enter the profile that you want to be default.") $r = RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "Default", "REG_EXPAND_SZ", "%SystemDrive%\Users\"&$model)
  14. Hello again I an trying to make a script that changes the screensaver settings through registry on a domain useraccount. This setting is located behind a string with the SID of that user. My problem is when I try to write this information into the string it wont apply the changes. #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=C:\Installationwizard\Remove_Screensaver.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Process.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1_1", 221, 174, 281, 190) $TimeoutInput = GUICtrlCreateInput("TimeoutInput", 72, 40, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $UsernameInput = GUICtrlCreateInput("Username", 72, 80, 121, 21) $Label = GUICtrlCreateLabel("How many second timeout?", 72, 16, 135, 17) $ON = GUICtrlCreateRadio("ON", 16, 16, 41, 17) $OFF = GUICtrlCreateRadio("OFF", 16, 40, 41, 17) $Start_button = GUICtrlCreateButton("Start", 24, 120, 75, 25) $Exit_button = GUICtrlCreateButton("Exit", 112, 120, 75, 25) $Label2 = GUICtrlCreateLabel("Username:", 16, 80, 55, 17) GUISetState(@SW_SHOW) $Form1 = GUICreate("Form1", 600, 175, 526, 192) $Label1 = GUICtrlCreateLabel("Label1", 24, 8, 180, 17) $Label2 = GUICtrlCreateLabel("Label2", 24, 40, 180, 17) $Label3 = GUICtrlCreateLabel("Label3", 24, 72, 180, 17) $Label4 = GUICtrlCreateLabel("Label4", 24, 104, 180, 17) $Label5 = GUICtrlCreateLabel("Label5", 24, 136, 400, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $var[5] $var[0] = 0 ;OFF $var[1] = 0 ;ON $var[2] = 0 ;Timeout $var[3] = 0 ;Username $var[4] = 0 ;SID While 1 GUICtrlSetData( $Label1, $var[0]) GUICtrlSetData( $Label2, $var[1]) GUICtrlSetData( $Label3, $var[2]) GUICtrlSetData( $Label4, $var[3]) GUICtrlSetData( $Label5, $var[4]) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OFF $var[0] = 1 $var[1] = 0 Case $ON $var[1] = 1 $var[0] = 0 Case $Start_button $var[2] = GUICtrlRead($TimeoutInput) $var[3] = GUICtrlRead($UsernameInput) _RunDOS('if not exist C:\temp\ mkdir C:\temp\ && wmic path win32_useraccount where name="' & $var[3] & '" get sid > C:\temp\sid.txt') FileOpen("C:\temp\sid.txt", 0) Sleep(200) $var[4] = FileReadLine("C:\temp\sid.txt", 2) $var[4] = StringStripWS($var[4], 8) Sleep(500) If $var[0] = 1 Then RegWrite("HKEY_USERS\" & $var[4] & "\Software\Policies\Microsoft\Windows\Control Panel\Desktop", "ScreenSaveActive", "REG_SZ", "0") EndIf If $var[1] = 1 Then RegWrite("HKEY_USERS\" & $var[4] & "\Software\Policies\Microsoft\Windows\Control Panel\Desktop", "ScreenSaveActive", "REG_SZ", "1") RegWrite('HKEY_USERS\"' & $var[4] & '"\Software\Policies\Microsoft\Windows\Control Panel\Desktop', "ScreenSaveTimeOut", "REG_SZ", $var[2]) if @error Then msgbox(0, "Error", @error) ;msgbox(0, "Done", "Settings are changed") EndIf Case $Exit_button Exit EndSwitch WEnd I tried to debug the script by putting in another GUI that shows all variables, but the variables are correct, it just wont apply. And 1 more question: is the @error working so that it gives the error message of the last RegWrite? PS! The RegWrite function works if I just put this simple script: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=C:\installationwizard\Regtest.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** global $var[2] $var[0] = 60 $var[1] = "S-1-5-21-1927809936-1189766144-1318725885-362183" RegWrite("HKEY_USERS\" & $var[1] & "\Software\Policies\Microsoft\Windows\Control Panel\Desktop", "ScreenSaveTimeOut", "REG_SZ", $var[0]) Kind Regards, Akarillon
×
×
  • Create New...