KeshHERE Posted May 8, 2016 Share Posted May 8, 2016 $gui1=GUICreate("google", 250, 150) $input1 = GUICtrlCreateInput("", 75, 40, 100, 25) $OK1 = GUICtrlCreateButton("Done", 100, 120, 55, 20,$BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW,$gui1) $google="google,hi,ih" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $OK1 CHANGEVARIABLE($google,'hi,hi,hi') EndSwitch WEnd So, what i want to do is.. I want to change $google variable value after pressed "ok" button, so that next time i open script (to run or to edit), value of $google will be new value. it should permanently change value of that variable in script, so that even after i close this script and reopen it next day, new (changed value 'hi,hi,hi') value is there, rather then old value "google,hi,ih". i don't think there is any direct function for it cause it checked it, so is there any way to do it?? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 8, 2016 Developers Share Posted May 8, 2016 Save the value in an INI file or somewhere in the registry and restore that when you start the program. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
KeshHERE Posted May 8, 2016 Author Share Posted May 8, 2016 thanks, using iniwrite() function right? Link to comment Share on other sites More sharing options...
TheDcoder Posted May 8, 2016 Share Posted May 8, 2016 Yes @KeshHERE. Use IniWrite and IniRead EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
KeshHERE Posted May 8, 2016 Author Share Posted May 8, 2016 thank you very much.. Actually i am trying to write an AI (not high level just basic). After i complete it, is there a way to share it among all autoit user so that you can check it for improvement or use it for their daily tasks? Link to comment Share on other sites More sharing options...
TheDcoder Posted May 8, 2016 Share Posted May 8, 2016 Yes, you can share your programs here: https://www.autoitscript.com/forum/files/ Good luck, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
KeshHERE Posted May 8, 2016 Author Share Posted May 8, 2016 Thanks, @TheDcoder Link to comment Share on other sites More sharing options...
Trong Posted May 10, 2016 Share Posted May 10, 2016 for simple data: Global $hGUI = GUICreate("Google", 407, 55, -1, -1) Global $Input1 = GUICtrlCreateInput("google,hi,ih", 115, 16, 188, 21) Global $OK1 = GUICtrlCreateButton("SAVE", 316, 8, 87, 36) GUICtrlCreateLabel("Input data to save:", 16, 18, 93, 17) Global $sFileToSaveData = @ScriptDir & "\" & @ScriptName & "_DATA.ini" ; Change to path you want to save Global $Google = FileRead($sFileToSaveData) If Not @error And $Google <> "" Then GUICtrlSetData($Input1, $Google) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case -3 Exit Case $OK1 $Google = GUICtrlRead($Input1) CHANGEVARIABLE($Google) MsgBox(32, "Done", $Google & " saved to" & $sFileToSaveData) EndSwitch Sleep(10) WEnd Func CHANGEVARIABLE($VARIABLE) Local $hOpen = FileOpen($sFileToSaveData, 2 + 8 + 128) FileWrite($hOpen, $VARIABLE) Return SetError(@error, FileClose($hOpen), 1) EndFunc ;==>CHANGEVARIABLE Regards, 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