Tripredacus Posted October 22, 2007 Share Posted October 22, 2007 (edited) Greetings! I have encountered a weird situation where the program I have written is not writing to the registry properly. The RegWrite calls from a variable that is generated from an input box, but when it writes it to the registry, instead of the text that is in the variable, a number 4 appears! I have some extra code floating around in there. Change the RegWrite variable to file2 and the correct registry information appears (based on what file2 is hard-coded to have in it). So here are the results: 1. If using the input field, the value written is "4". The msgbox displays "serialnumber" 2. If using the hardcoded var, the value written is "serialnumber". The msgbox displays whatever you typed in the field. Is there something I am missing here? I cannot locate where this 4 is coming from. ; Nero 7 Essentials Suite 2 Serial Number Changer ; Coded by Tripredacus ; sources: msfn.org, autoitscript.com #include <GUIConstants.au3> ; main program $user = @UserName $mainwindow = GuiCreate("Nero Serial Changer", 320, 120) $Label_text = GuiCtrlCreateLabel("Input Serial Number with Hyphens",10,5,300,20) $file = GUICtrlCreateInput ( "", 10, 20, 300, 20) $file2 = "serialnumber" GUICtrlSetState(-1,$GUI_DROPACCEPTED) $btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn exitloop EndSelect Wend RegDelete( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info") RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "CDNR" , "REG_SZ" , "12938" ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "Company" , "REG_SZ" , "" ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "EulaAccepted" , "REG_SZ" , "1" ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "MissingFilesState" , "REG_SZ" , "0" ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "Serial7_1185911858" , "REG_SZ" , $file ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "User" , "REG_SZ" , $user ) RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "Version" , "REG_SZ" , "7.8.5.0" ) MsgBox (4096, "New Serial Number", GUICtrlRead($file)) ; serialnumber NOTE: any text in the above code with the word "serialnumber" has an actual serial number in my code. The commented one at the bottom was a copy/paste line for testing. Edited October 26, 2020 by Tripredacus attribution Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
weaponx Posted October 22, 2007 Share Posted October 22, 2007 (edited) The syntax for this line is wrong: RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "Serial7_1185911858" , "REG_SZ" , $file ) should be RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\ahead\Installation\Families\Nero 7\Info" , "Serial7_1185911858" , "REG_SZ" , GuiCtrlRead($file) ) BTW..... 4 = ControlID of inputbox Edited October 22, 2007 by weaponx Link to comment Share on other sites More sharing options...
Tripredacus Posted October 22, 2007 Author Share Posted October 22, 2007 Thanks a lot. I knew it was something simple! Twitter | MSFN | VGCollect 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