Maximus1 Posted July 11, 2010 Share Posted July 11, 2010 (edited) hi i created a GUI with some input fields. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $a=0 $Items=0 #Region ### START Koda GUI section ### Form=C:\items.kxf $Stranditems = GUICreate("Stranditems", 514, 347, 192, 124, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Tabs = GUICtrlCreateGroup("Tabs", 16, 8, 337, 105) $Tab1 = GUICtrlCreateInput("von links", 32, 46, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Tab1a = GUICtrlCreateInput("von oben", 32, 84, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Tab2 = GUICtrlCreateInput("von links", 96, 46, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Tab3 = GUICtrlCreateInput("von links", 160, 46, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Tab4 = GUICtrlCreateInput("von links", 224, 46, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Label2 = GUICtrlCreateLabel("Tab 1 von links", 33, 24, 32, 17) $Label3 = GUICtrlCreateLabel("Tab 2 von links", 113, 24, 32, 17) $Label4 = GUICtrlCreateLabel("Tab 3 von links", 193, 24, 32, 17) $Label5 = GUICtrlCreateLabel("Tab 4 von links", 273, 24, 32, 17) $Pic1 = GUICtrlCreatePic("logo.gif", 16, 191, 269, 114) $Info = GUICtrlCreateGroup("", 304, 264, 193, 65) $Stranditems1 = GUICtrlCreateLabel("items gemacht:", 313, 280, 106, 17) $Label1 = GUICtrlCreateLabel("items übrig:", 313, 306, 88, 17) $Label7 = GUICtrlCreateLabel(""& $a, 424, 280, 22, 17) $Label9 = GUICtrlCreateLabel(""& $Items-$a, 424, 306, 22, 17) $Itemlink = GUICtrlCreateGroup("Itemlink", 368, 8, 129, 105) $link1 = GUICtrlCreateInput("von links", 400, 46, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $link1a = GUICtrlCreateInput("von oben", 400, 76, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Label8 = GUICtrlCreateLabel("", 120, 24, 4, 4) $Ladebalken = GUICtrlCreateGroup("Ladebalken", 368, 120, 129, 113) $coord = GUICtrlCreateInput("von links", 400, 147, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $coord1 = GUICtrlCreateInput("von oben", 400, 175, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $color = GUICtrlCreateInput("Farbe", 400, 200, 57, 21) ;~ ****************************************************************** $Menge = GUICtrlCreateGroup("Menge", 256, 120, 97, 57) $Items = GUICtrlCreateInput("", 272, 144, 65, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) ;~ ****************************************************************** $Starten = GUICtrlCreateButton("Starten", 16, 128, 97, 49) $Pause = GUICtrlCreateButton("Pause", 128, 128, 97, 49) $Load = GUICtrlCreateButton("Laden", 296, 224, 57, 25) $Save = GUICtrlCreateButton("Speichern", 296, 192, 57, 25) ;~ GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### as next i made a function to save the variables into a file with filewriteline... $file= "test.opt" FileDelete($file) FileOpen("$file",1) FileWriteLine("test.opt", "" & GUICtrlRead($Tab1)) FileWriteLine("test.opt", "" & GUICtrlRead($Tab1a)) FileWriteLine("test.opt", "" & GUICtrlRead($Tab2)) FileWriteLine("test.opt", "" & GUICtrlRead($Tab3)) FileWriteLine("test.opt", "" & GUICtrlRead($Tab4)) FileWriteLine("test.opt", "" & GUICtrlRead($link1)) FileWriteLine("test.opt", "" & GUICtrlRead($link1a)) FileWriteLine("test.opt", "" & GUICtrlRead($color)) FileWriteLine("test.opt", "" & GUICtrlRead($Items)) FileClose($file) now i want to restore the variables, but i don`t know how to do it $file= "test.opt" FileOpen("$file",1) $Tab1 = FileReadLine($file,1) is not working. can you tell me how to do it? Edited July 11, 2010 by Maximus1 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 11, 2010 Share Posted July 11, 2010 You want GUICtrlSetData(). GUICtrlSetData($Tab1, FileReadLine($file,1)) Something like that, but note that using a txt file can and most likely will be a hassle. What are you gonna do when the file doesn't exist, or the value isn't there? I recommend you use the Ini*() functions instead. Much easier. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Maximus1 Posted July 11, 2010 Author Share Posted July 11, 2010 thanks, that was it. i tried this too, but had some errors in it. Link to comment Share on other sites More sharing options...
Maximus1 Posted July 11, 2010 Author Share Posted July 11, 2010 (edited) did it... Edited July 11, 2010 by Maximus1 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