Gif Posted May 26, 2007 Share Posted May 26, 2007 (edited) this is my list$mainlist = GUICtrlCreateList("", 10, 35, 375, 340)oÝ÷ ٩ݶ,yªÞÙ»¶ì¶±«Þ¶¢¡ûazX¬µ©Ý¶§¢§¶¬j÷~)^jëh×6Case $smsg = $saveplay $savedialog = FileSaveDialog("Save skiki", "My Documents", "skikis (*.ski)", 2) FileDelete($savedialog) FileWrite($savedialog, GUICtrlRead($mainlist)) Case $smsg = $openplay $opendialog = FileOpenDialog("Open skiki", "My Documents", "skikis (*.ski)", 1) if @error = 1 then sleep(100) ElseIf @error = 0 Then GUICtrlSetData($mainlist, FileRead($opendialog)) Else msgbox(0, "Error", "Cant open the selected file", 2) EndIf the problem is here FileWrite($savedialog, GUICtrlRead($mainlist)) the saved file cannot save the input.... whatever i do it keeps on saving a blank fileany soluton? Edited May 26, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
Gif Posted May 26, 2007 Author Share Posted May 26, 2007 cant anyone help me? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 26, 2007 Moderators Share Posted May 26, 2007 In order to read something in GUICtrlCreateList() you actually have to select it... If you're doing this, and are leaving it up to us to assume you are doing it correctly, then post a working example that re-creates your issue... The guessing game to help you with your problem is not something that most of us that know what we are talking about enjoy or will even do. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Gif Posted May 26, 2007 Author Share Posted May 26, 2007 (edited) In order to read something in GUICtrlCreateList() you actually have to select it... If you're doing this, and are leaving it up to us to assume you are doing it correctly, then post a working example that re-creates your issue... The guessing game to help you with your problem is not something that most of us that know what we are talking about enjoy or will even do. ? didnt i just posted a script ? and it works.... but i sayed before what's the problem #include <GUIConstants.au3> GuiCreate(".......", 600, 600) GuiSetState(@SW_SHOW, -1) $mainlist = GUICtrlCreateList("", 10, 10, 400, 580) $saveplay = GuiCtrlCreateButton("save", 10, 450, 80, 20) $openplay = GuiCtrlCreateButton("open", 100, 450, 80, 20) while 1 $smsg = GuiGetMsg() select Case $smsg = $GUI_EVENT_CLOSE exit Case $smsg = $saveplay $savedialog = FileSaveDialog("Save skiki", "My Documents", "skikis (*.ski)", 2) FileDelete($savedialog) FileWrite($savedialog, GUICtrlRead($mainlist)) Case $smsg = $openplay $opendialog = FileOpenDialog("Open skiki", "My Documents", "skikis (*.ski)", 1) if @error = 1 then sleep(100) ElseIf @error = 0 Then GUICtrlSetData($mainlist, FileRead($opendialog)) Else msgbox(0, "Error", "Cant open the selected file", 2) endselect wend Edited May 26, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
Gif Posted May 26, 2007 Author Share Posted May 26, 2007 OK YOU ARE RIGHT AND EXCUSE ME FOR MY BEHAVIOR , IT SAVES THE SELECTED TEXT, NOW THE QUESTION IS HOW CAN I MAKE IT SAVE THE WHOLE TEXT IN THE LIST (NOT ONLY THE SELECTED)? AND BY SPLITING THE TEXTS IN THE LIST BY A "|" Link to comment Share on other sites More sharing options...
martin Posted May 26, 2007 Share Posted May 26, 2007 this is my list $mainlist = GUICtrlCreateList("", 10, 35, 375, 340)oÝ÷ ٩ݶ,yªÞÙ»¶ì¶±«Þ¶¢¡ûazX¬µ©Ý¶§¢§¶¬j÷~)^jëh×6Case $smsg = $saveplay $savedialog = FileSaveDialog("Save skiki", "My Documents", "skikis (*.ski)", 2) FileDelete($savedialog) FileWrite($savedialog, GUICtrlRead($mainlist)) Case $smsg = $openplay $opendialog = FileOpenDialog("Open skiki", "My Documents", "skikis (*.ski)", 1) if @error = 1 then sleep(100) ElseIf @error = 0 Then GUICtrlSetData($mainlist, FileRead($opendialog)) Else msgbox(0, "Error", "Cant open the selected file", 2) EndIf oÝ÷ ÚØ^¦ºé¢²«xX¥yjâµí7êƯyØB¶¹Qy§tß©yb²ßÛ¶¬j÷~)^q©ç¢Û½ëaz)éºÜ!jׯz¸¢+dyêl¢{¾)ài¹ZGâæ§ÊÊ%ºÚ'þ«¨µæ(¹Æ§ky§Z[azX§zÊh¸¬·e ÚåEæÓ~¦j)åËb¶åÊ·vËayË«éí+ç-yØzh§¶¥ËGj÷$jÑ®¸¬µ«·{az)Üç^±ú%uêÎìÊÚ£Z·*.Á©íËhæy§!צ{azX¬µ©Ý¸z+m¢Ø^~)^¢w¥wµ«bæ(¹Æ§¶§«^®·vÞ)ÞjÖg®çâæv)à¶)Þ¶azX¬µ«¢+Ø)½ÈÀÌØíôÀѼ}U% Ñɱ1¥ÍÑ ½Õ¹Ð ÀÌØíµ¥¹±¥ÍФ´Ä(¥±]É¥Ñ1¥¹ ÀÌØíÍÙ¥±½°}U% Ñɱ1¥ÍÑÑQáÐ ÀÌØíµ¥¹±¥ÍаÀÌØí¤)¹á and similarly use FileReadLIne to get the data back. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Gif Posted May 26, 2007 Author Share Posted May 26, 2007 You cannot read all the lines of a List with GUICtrlRead($mainlist), it only reads the currently selected item in the list. Have a look at GuiList.au3 in the includes folder. One way to do what you want is to read each item in the list and write it to the file one line at a time. You can then later read one line at a time from the file adding that line to the list. for $a = 0 to _GUICtrlListCount($mainlist) - 1 FileWriteLine($savedialog, _GUICtrlListGetText($mainlist, $a) next and similarly use FileReadLIne to get the data back. thanks a lot but there is one (final) problem, the values in the file saved are not separated by a "|" and so when i open the file again the list comes with all the previous values in one line for example list: 1 2 3 when i open again the file it's: 123 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 26, 2007 Moderators Share Posted May 26, 2007 You're looping it, using FileWriteLine() (Not FileWrite()), and it's still putting it all as one string without a Carriage Return/Line Feed? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Gif Posted May 26, 2007 Author Share Posted May 26, 2007 You're looping it, using FileWriteLine() (Not FileWrite()), and it's still putting it all as one string without a Carriage Return/Line Feed?sorry for the late respond, it writes the strings in different lines... it works i have a little problem with FileReadLine() but i 'll figure it out probably...or maybe a future Topic Link to comment Share on other sites More sharing options...
Zedna Posted May 28, 2007 Share Posted May 28, 2007 sorry for the late respond, it writes the strings in different lines... it works i have a little problem with FileReadLine() but i 'll figure it out probably... or maybe a future Topic GUICtrlSetData($mainlist, StringReplace(FileRead($opendialog),@CRLF,'|')) Resources UDF ResourcesEx UDF AutoIt Forum Search 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