hookLine Posted November 28, 2008 Share Posted November 28, 2008 I want to have a value from an input box in my GUI written into an .INI file. Here is some code from my script: $Input1 = GUICtrlCreateInput("INSERT HOTKEY", 144, 40, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "Input1Change") How would I write the input value to an .INI file? (When it has been changed already) Link to comment Share on other sites More sharing options...
Josbe Posted November 28, 2008 Share Posted November 28, 2008 I want to have a value from an input box in my GUI written into an .INI file. Here is some code from my script: $Input1 = GUICtrlCreateInput("INSERT HOTKEY", 144, 40, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "Input1Change")oÝ÷ Øz0Â¥t+×触ëoj[¶§ ÒWéⶬmç§r§çZ·w/êº^jëh×6IniWrite($myINI, "config", "myhotkey", GUICtrlRead($Input1)) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
hookLine Posted November 28, 2008 Author Share Posted November 28, 2008 1 more problem (hopefully), it doesn't write the last input in the .INI file The input that it is not writing is H_D_Input ($H_D_Input ;; Variable) Here is the full script: expandcollapse popupOpt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=C:\Users\Owner\Desktop\KODA\Forms\D2US Form.kxf $Form1 = GUICreate("INI Editor 0.1", 405, 299, 261, 123) GUISetIcon("D:\005.ico") GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Skills") $Tele_HKey = GUICtrlCreateLabel("Teleport Hotkey:", 16, 40, 82, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "Tele_HKeyClick") $Tele_Input = GUICtrlCreateInput(IniRead("settings.ini", "Skills", "Teleport", "INSERT HOTKEY WITH {} TAGS"), 144, 40, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "Tele_InputChange") $BO_Hkey = GUICtrlCreateLabel("Battle Orders Hotkey:", 16, 64, 101, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "BO_HkeyClick") $BO_Input = GUICtrlCreateInput(IniRead("settings.ini", "Skills", "BattleOrders", "INSERT HOTKEY WITH {} TAGS"), 144, 64, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "BO_InputChange") $BC_Hkey = GUICtrlCreateLabel("Battle Command Hotkey:", 16, 88, 120, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "BC_HkeyClick") $BC_Input = GUICtrlCreateInput(IniRead("settings.ini", "Skills", "BattleCommand", "INSERT HOTKEY WITH {} TAGS"), 144, 88, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "BC_InputChange") $HS_Hkey = GUICtrlCreateLabel("Holy Shield Hotkey:", 16, 112, 96, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "HS_HkeyClick") $HS_Input = GUICtrlCreateInput(IniRead("settings.ini", "Skills", "HolyShield", "INSERT HOTKEY WITH {} TAGS"), 144, 112, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "HS_InputChange") $Conc_Hkey = GUICtrlCreateLabel("Concentration Hotkey", 16, 136, 107, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "Conc_HkeyClick") $Conc_Input = GUICtrlCreateInput(IniRead("settings.ini", "Skills", "Concentration", "INSERT HOTKEY WITH {} TAGS"), 144, 136, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "Conc_InputChange") $TabSheet2 = GUICtrlCreateTabItem("Delays") $TeleportDelay = GUICtrlCreateLabel("Teleport Delay:", 16, 40, 76, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "TeleportDelayClick") $Tele_Delay = GUICtrlCreateInput(IniRead("settings.ini", "Delays", "TeleDelay", "INSERT TIME PERIOD"), 112, 40, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "Tele_DelayChange") $HammerPeriod = GUICtrlCreateLabel("Hammer Period:", 16, 64, 79, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "HammerPeriodClick") $H_Period = GUICtrlCreateInput(IniRead("settings.ini", "Delays", "HammerPeriod", "INSERT TIME PERIOD"), 112, 64, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "H_PeriodChange") $RiverBreakPeriod = GUICtrlCreateLabel("RiverBreakPeriod", 16, 88, 87, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "RiverBreakPeriodClick") $RB_Period = GUICtrlCreateInput(IniRead("settings.ini", "Delays", "RiverBreakPeriod", "INSERT TIME PERIOD"), 112, 88, 105, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "RB_PeriodChange") $TabSheet3 = GUICtrlCreateTabItem("Messages") GUICtrlSetState(-1,$GUI_SHOW) $H_S_MSG = GUICtrlCreateLabel("Hammer Start MSG:", 16, 40, 98, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "H_S_MSGClick") $H_D_MSG = GUICtrlCreateLabel("Hammer Done MSG:", 16, 64, 100, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetOnEvent(-1, "H_D_MSGClick") $H_S_Input = GUICtrlCreateInput(IniRead("settings.ini", "Messages", "HammerStart", "INSERT HAMMER START MESSAGE"), 120, 40, 273, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "H_S_InputChange") $H_D_Input = GUICtrlCreateInput(IniRead("settings.ini", "Messages", "HammerDone", "INSERT HAMMER DONE MESSAGE"), 120, 64, 273, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetOnEvent(-1, "H_D_InputChange") GUICtrlCreateTabItem("") GUICtrlSetOnEvent(-1, "PageControl1Change") $Button1 = GUICtrlCreateButton("&OK", 246, 272, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button1Click") $Button2 = GUICtrlCreateButton("&Cancel", 326, 272, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button2Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func BC_HkeyClick() EndFunc Func BC_InputChange() IniWrite("settings.ini", "Skills", "BattleCommand", GUICtrlRead($BC_Input)) EndFunc Func BO_HkeyClick() EndFunc Func BO_InputChange() IniWrite("settings.ini", "Skills", "BattleOrders", GUICtrlRead($BO_Input)) EndFunc Func Button1Click() Exit 0 EndFunc Func Button2Click() Exit 0 EndFunc Func Conc_HkeyClick() EndFunc Func Conc_InputChange() IniWrite("settings.ini", "Skills", "Concentration", GUICtrlRead($Conc_Input)) EndFunc Func Form1Close() Exit 0 EndFunc Func Form1Maximize() EndFunc Func Form1Minimize() EndFunc Func Form1Restore() EndFunc Func H_D_InputChange() IniWrite("settings.ini", "Messages", "HammerDone", GUICtrlRead($H_D_Input)) EndFunc Func H_D_MSGClick() EndFunc Func H_PeriodChange() IniWrite("settings.ini", "Delays", "HammerPeriod", GUICtrlRead($H_Period)) EndFunc Func H_S_InputChange() IniWrite("settings.ini", "Messages", "HammerStart", GUICtrlRead($H_S_Input)) EndFunc Func H_S_MSGClick() EndFunc Func HammerPeriodClick() EndFunc Func HS_HkeyClick() EndFunc Func HS_InputChange() IniWrite("settings.ini", "Skills", "HolyShield", GUICtrlRead($HS_Input)) EndFunc Func PageControl1Change() EndFunc Func RB_PeriodChange() IniWrite("settings.ini", "Delays", "RiverBreakPeriod", GUICtrlRead($RB_Period)) EndFunc Func RiverBreakPeriodClick() EndFunc Func Tele_DelayChange() IniWrite("settings.ini", "Delays", "TeleDelay", GUICtrlRead($Tele_Delay)) EndFunc Func Tele_HKeyClick() EndFunc Func Tele_InputChange() IniWrite("settings.ini", "Skills", "Teleport", GUICtrlRead($Tele_Input)) EndFunc Func TeleportDelayClick() EndFunc Link to comment Share on other sites More sharing options...
Josbe Posted November 29, 2008 Share Posted November 29, 2008 1 more problem (hopefully), it doesn't write the last input in the .INI fileThe input that it is not writing is H_D_Input ($H_D_Input ;; Variable).....You're reassigning to same control, another event. Of course, the last assigned, will be used. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta 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