snowman533 Posted April 27, 2009 Share Posted April 27, 2009 (edited) hey guys i need help, i have managed to diplay a color value in Hex from my inf file in a msgbox, the msgbox is to show me that i have called the value part of the string in the inf file using stringright, what i want to do is create a GUI with that color, currently the GUI is made Black, i want it to come up as a light blue color to this value: 0A9DFF (value is in Hex) i am working in a GUI customization script here is the code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #Include <File.au3> #Include <Array.au3> dim $cArray $scount = 6 $inf = @scriptdir & "\guisets.inf" _FileReadToArray($inf, $cArray) $string=_ArrayToString($cArray) StringSplit($string, "=") $sdis=StringRight($cArray[1],$scount) msgbox(0,"",$sdis) $guicolor= $cArray $gui=GUICreate("testGui",600,600) GUISetState(@sw_show,$gui) GUISetBkColor(StringRight($cArray[1],$scount),$gui) while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() and attached is the INF file i am working off, i have only filled in the value of one line as all i need is to find the right code, then the rest will work thanks in advance *edit* cannot upload file, here it is in code guisets.inf: background=0A9DFF buttons= labels= Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
DrKovra Posted April 27, 2009 Share Posted April 27, 2009 Why don't you use the ....IniRead ... IniWrite ... ? Check the user manual if you like for this solution ! [s][font="Impact"]░▒▓▓►DrKovra◄▓▓▒░[/font][/s]The only thing I [sup]know [/sup]is that I don't know [sub]nothing[/sub]--------------- __________------------------------------ __________--------------- Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 27, 2009 Moderators Share Posted April 27, 2009 snowman533, If you decide to follow DrKovra's excellent advice, you might like to look at this short inifile example I have just posted in another thread. It will give you a good idea of how to use ini files (I hope ;-)) M23. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) still not displaying right, still coming up as black trashed the array section of code new code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #Include <File.au3> $ini = @scriptdir & "\guisets.ini" $gui=GUICreate("testGui",600,600) GUISetState(@sw_show,$gui) $color=IniRead($ini, "colors", "background", "Error") GUISetBkColor(hex($color),$gui) MsgBox(0,"",IniRead($ini, "colors", "background", "Error")) while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() msgbox returns correct value from ini file, a troubleshooter that tells me i am still missing something but i cant find it, and no help file entries help please help me, what am i missing? thanks in advance guisets.ini [colors] background=0A9DFF buttons= labels= Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
BlackPhoenix Posted April 27, 2009 Share Posted April 27, 2009 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #Include <File.au3> $ini = @scriptdir & "\guisets.ini" $gui=GUICreate("testGui",600,600) GUISetState(@sw_show,$gui) $color=IniRead($ini, "colors", "background", "Error") GUISetBkColor('0x'&$color,$gui) MsgBox(0,"",IniRead($ini, "colors", "background", "Error")) while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Instead of using Hex($color) use this, cause the color code is allready hex() You just needed to add 0x in front of it:P Link to comment Share on other sites More sharing options...
99ojo Posted April 27, 2009 Share Posted April 27, 2009 still not displaying right, still coming up as black trashed the array section of code new code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #Include <File.au3> $ini = @scriptdir & "\guisets.ini" $gui=GUICreate("testGui",600,600) GUISetState(@sw_show,$gui) $color=IniRead($ini, "colors", "background", "Error") GUISetBkColor(hex($color),$gui) MsgBox(0,"",IniRead($ini, "colors", "background", "Error")) while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() msgbox returns correct value from ini file, a troubleshooter that tells me i am still missing something but i cant find it, and no help file entries help please help me, what am i missing? thanks in advance guisets.ini [colors] background=0A9DFF buttons= labels=hi, your problem is, that background=0A9DFF is a hex. If you use Hex ("0A9DFF") you get 00000000 as return. If you replace 0A9DFF with 695807 in your ini file it should work. ;-)) Stefan Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) @BlackPheonix: thanks that worked, i added 0x to the entry in the ini file @99ojo: thanks your solution also worked, now to decide which method to use solved Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User 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