waardd Posted January 25, 2012 Share Posted January 25, 2012 (edited) When i run my script it does not write the variables to the registry. Please help. expandcollapse popup $igui = GUICreate("Profieleditor", 780, 500, -1, -1, -1) GUISetState(@SW_SHOW) Local $RGBfront, $RGBback, $RF, $GF, $BF, $RB, $GB, $BB, $RFlabel, $GFlabel, $BFlabel, $RBlabel, $GBlabel, $BBlabel, $rgbhexfg, $rgbhexbg, $clrlabel1, $colorchoice, $stopbutton $RFlabel = GUICtrlCreateInput("0", 10, 15, 50, 20) $GFlabel = GUICtrlCreateInput("0", 10, 35, 50, 20) $BFlabel = GUICtrlCreateInput("0", 10, 55, 50, 20) $RBlabel = GUICtrlCreateInput("255", 70, 15, 50, 20) $GBlabel = GUICtrlCreateInput("255", 70, 35, 50, 20) $BBlabel = GUICtrlCreateInput("255", 70, 55, 50, 20) $RGBlabel = GUICtrlCreateLabel("RGB front RGB back", 10, 2, 150, 12) $clrlabel1 = GUICtrlCreateLabel("Dit is een kleurtest voor de profieleditor", 140, 15, 57, 60) _colorbutton() $colorchoice = GUICtrlCreateButton("kleurkiezen", 10, 105, 74, 20) Func _colorbutton() $RF = GUICtrlRead ($RFlabel) $GF = GUICtrlRead ($GFlabel) $BF = GUICtrlRead ($BFlabel) Local $RGBfront = $RF&","&$GF&","&$BF $RB = GUICtrlRead ($RBlabel) $GB = GUICtrlRead ($GBlabel) $BB = GUICtrlRead ($BBlabel) Local $RGBback = $RB&","&$GB&","&$BB msgbox(0,"",$RGBfront&@CRLF&$RGBback) $rgbhexfg = "0x" & Hex($RF,2) & Hex($GF,2) & Hex($BF,2) $rgbhexbg = "0x" & Hex($RB,2) & Hex($GB,2) & Hex($BB,2) GUICtrlSetColor($clrlabel1, $rgbhexfg) GUICtrlSetBkColor($clrlabel1, $rgbhexbg) RegWrite("HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\TESTPROF", "Colour0", "", $RGBfront) _colorbutton() $colorchoice = GUICtrlCreateButton("kleurkiezen", 10, 105, 74, 20) Func _colorbutton() $RF = GUICtrlRead ($RFlabel) %2 Edited January 26, 2012 by waardd Link to comment Share on other sites More sharing options... MrMitchell Posted January 25, 2012 MrMitchell Active Members 738 Share Posted January 25, 2012 What the return value of the RegWrite function? Assign the function to a variable and check the result against the help file to see why it's not writing. Link to comment Share on other sites More sharing options... Moderators JLogan3o13 Posted January 25, 2012 JLogan3o13 Moderators 10.5k 87 115 and holding Moderators Share Posted January 25, 2012 Hi, Waardd. The RegWrite lines work for me when I add in the type: RegWrite("HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessionsTESTPROF", "Colour2", "REG_SZ", $RGBback) Also, if you want to use the $GUI_EVENT_CLOSE in your Case statement, you need to include GUIConstantsEx.au3 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
BrewManNH Posted January 25, 2012 Share Posted January 25, 2012 Your RegWrite command is written wrong. Your 3rd parameter should be the type of key you're writing, it can't be blank as far as I'm aware. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 25, 2012 Moderators Share Posted January 25, 2012 I've wondered about that as well, BrewManNH. The help file states that it is optional, but I've never gotten it to work without the type. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
BrewManNH Posted January 25, 2012 Share Posted January 25, 2012 (edited) I think this was brought up before, they're only optional if you don't use any of them, once you use the second parameter you have to use them all or it fails. I can't seem to find the thread or bug trak that mentioned it, but I'll keep looking. EDIT: Found one started by MvGulik Edited January 25, 2012 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
waardd Posted January 26, 2012 Author Share Posted January 26, 2012 In some wierd caase it looks like it was happening because is showed the variable first and then tried to use it. I remoddeled the script a little so it looks like this and it works. Time to extend the pssibilitys of this script Tnx for al the help!! expandcollapse popup#include <GUIConstantsEx.au3> $igui = GUICreate("Profieleditor", 780, 500, -1, -1, -1) GUISetState(@SW_SHOW) ;Building the screen ;Labels Local $RGBfront, $RGBback, $RF, $GF, $BF, $RB, $GB, $BB, $RFlabel, $GFlabel, $BFlabel, $RBlabel, $GBlabel, $BBlabel, $rgbhexfg, $rgbhexbg, $clrlabel1, $colorchoice, $stopbutton $RFlabel = GUICtrlCreateInput("0", 10, 15, 50, 20) $GFlabel = GUICtrlCreateInput("0", 10, 35, 50, 20) $BFlabel = GUICtrlCreateInput("0", 10, 55, 50, 20) $RBlabel = GUICtrlCreateInput("255", 70, 15, 50, 20) $GBlabel = GUICtrlCreateInput("255", 70, 35, 50, 20) $BBlabel = GUICtrlCreateInput("255", 70, 55, 50, 20) $RGBlabel = GUICtrlCreateLabel("RGB front RGB back", 10, 2, 150, 12) $clrlabel1 = GUICtrlCreateLabel("Dit is een kleurtest voor de profieleditor", 140, 15, 57, 60) _preview() ;Button creation $preview = GUICtrlCreateButton("preview", 10, 105, 74, 20) $setprofile = GUICtrlCreateButton("Set profilecolor", 10, 125, 74, 20) ;End builduing the screen While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $preview _preview() Case $setprofile _setprofile() EndSwitch WEnd GUISetState() Func _preview() _readvalues() $rgbhexfg = "0x" & Hex($RF,2) & Hex($GF,2) & Hex($BF,2) $rgbhexbg = "0x" & Hex($RB,2) & Hex($GB,2) & Hex($BB,2) GUICtrlSetColor($clrlabel1, $rgbhexfg) GUICtrlSetBkColor($clrlabel1, $rgbhexbg) EndFunc Func _setprofile() _readvalues() Local $RGBback = $RB&","&$GB&","&$BB Local $RGBfront = $RF&","&$GF&","&$BF RegWrite("HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessionsTESTPROF", "Colour0", "REG_SZ", $RGBfront) RegWrite("HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessionsTESTPROF", "Colour2", "REG_SZ", $RGBback) EndFunc Func _readvalues() $RF = GUICtrlRead ($RFlabel) $GF = GUICtrlRead ($GFlabel) $BF = GUICtrlRead ($BFlabel) $RB = GUICtrlRead ($RBlabel) $GB = GUICtrlRead ($GBlabel) $BB = GUICtrlRead ($BBlabel) Endfunc 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