ned98 Posted July 13, 2010 Share Posted July 13, 2010 (edited) Hi everybody! It's been a long time from my last post, but now i have a new problem that I hope you can resolve! So here it is: I've created a GUI with 3 input boxes and one button. You insert year, month and day in the inputboxes and press the button that will create a txt file inserting inputboxes values. My problem it's that FileWrite does not insert my inputbox variables, but it insert YEAR=4, MONTH=3, DAY=13! Here's my code: (I used KODA) #Region ### START Koda GUI section ### GUICreate("MY GUI", 135, 221, 195, 125) $MESE_input = GUICtrlCreateInput("", 62, 72, 41, 21) $ANNO_input = GUICtrlCreateInput("", 62, 44, 41, 21) $Anno = GUICtrlCreateLabel("Anno:", 22, 48, 32, 17) $Mese = GUICtrlCreateLabel("Mese:", 22, 77, 33, 17) $PATCHbtn = GUICtrlCreateButton("1.) PATCH FILE", 8, 128, 121, 25, 0) $GIORNO_input = GUICtrlCreateInput("", 62, 100, 41, 21) $Label5 = GUICtrlCreateLabel("Giorno:", 21, 102, 38, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $PATCHbtn FileWrite("FILE.txt", "[KEY_DATE]" & @CRLF & "YEAR=" & $ANNO_input & @CRLF & "MONTH=" & $MESE_input & @CRLF & "DAY=" & $GIORNO_input & @CRLF & "[NEW_DATE]" & @CRLF & "YEAR=2020" & @CRLF & "MONTH=12" & @CRLF & "DAY=31") EndSwitch WEnd Attached there's the file that FileWrite has to create. I hope in your support! Best regards, NGMFILE.txt Edited July 13, 2010 by ned98 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 13, 2010 Moderators Share Posted July 13, 2010 ned98,You need to use GUICtrlRead to get the content of the Inputs - at the moment you are just writing the ControlIDs. 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...
NicePerson Posted July 13, 2010 Share Posted July 13, 2010 You must read input before writing it to txt file! Check it: #Region ### START Koda GUI section ### GUICreate("MY GUI", 135, 221, 195, 125) $MESE_input = GUICtrlCreateInput("", 62, 72, 41, 21) $ANNO_input = GUICtrlCreateInput("", 62, 44, 41, 21) $Anno = GUICtrlCreateLabel("Anno:", 22, 48, 32, 17) $Mese = GUICtrlCreateLabel("Mese:", 22, 77, 33, 17) $PATCHbtn = GUICtrlCreateButton("1.) PATCH FILE", 8, 128, 121, 25, 0) $GIORNO_input = GUICtrlCreateInput("", 62, 100, 41, 21) $Label5 = GUICtrlCreateLabel("Giorno:", 21, 102, 38, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $PATCHbtn $ANNO_input_read = GUICtrlRead($ANNO_input) $MESE_input_read = GUICtrlRead($MESE_input) $GIORNO_input_read = GUICtrlRead($GIORNO_input) FileWrite("FILE.txt", "[KEY_DATE]" & @CRLF & "YEAR=" & $ANNO_input_read & @CRLF & "MONTH=" & $MESE_input_read & @CRLF & "DAY=" & $GIORNO_input_read & @CRLF & "[NEW_DATE]" & @CRLF & "YEAR=2020" & @CRLF & "MONTH=12" & @CRLF & "DAY=31") EndSwitch WEnd Link to comment Share on other sites More sharing options...
ned98 Posted July 13, 2010 Author Share Posted July 13, 2010 Thank you really very much for help! Now the file is correct! 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