Adamrv1 Posted September 8, 2009 Share Posted September 8, 2009 This is my script:Dim $variable #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MyVar", 155, 90, 398, 238) $Button1 = GUICtrlCreateButton("Create Variable", 8, 8, 137, 33, 0) $Button2 = GUICtrlCreateButton("Display Variable", 8, 48, 137, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 $variable = inputbox("Variable","type Something") Case $button2 MsgBox(0,"Variable","The Variable is: " & $variable) EndSwitch WEndWhen you run it a GUI appears with two buttons:"create Variable" &"Display Variable"First you choose "Create Variable", then you enter some textNext you choose "Display Variable", you will receive a msgbox displaying the variable you just createdNow Let's say i want to first create my variable, exit the script, reopen the script, click "Display variable" and see the variable i assigned before i closed the scriptFirst off, Is this even possible, and if so, can someone please tell me how (examples would help) Link to comment Share on other sites More sharing options...
Khab Posted September 8, 2009 Share Posted September 8, 2009 You'll need to write the variable to something - registry, a file, whatever - and read it back from there. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 8, 2009 Share Posted September 8, 2009 You can write variables to a .ini file easily. Ini files are used for small file databases. Look at the Ini.. Functions. github.com/jvanegmond Link to comment Share on other sites More sharing options...
JohnOne Posted September 8, 2009 Share Posted September 8, 2009 Try ;Dim $variable #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MyVar", 155, 90, 398, 238) $Button1 = GUICtrlCreateButton("Create Variable", 8, 8, 137, 33, 0) $Button2 = GUICtrlCreateButton("Display Variable", 8, 48, 137, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $variable = InputBox("Variable", "type Something") IniWriteSection(@ScriptDir & "\test.ini", "section name", "Variable=" & $variable) Case $Button2 $variable = IniRead(@ScriptDir & "\test.ini", "section name", "Variable", "No variable has been created") MsgBox(0, "Variable", "The Variable Is: " & $variable) EndSwitch WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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