Bert Posted December 10, 2007 Share Posted December 10, 2007 I have a script that makes and displays data. Pretty basic. What it does is allows you to make a short string of data for a title, then make a long string that can be a paragraph if you like. Example: short string: Called user Long string: Called user, left voice mail. Waiting for user to call back. Sent user email to notify them of receiving of ticket. My question is this: I need a method of storing the data so that can be added to a array when the script runs. I thought of using an CSV file, but if the user doesn't have Office installed, that wouldn't work. I thought of using an INI, but I do not know how to handle things such as carriage returns, and if the user put in a "=" sign in his long or short string, that would cause a failure. If I use string split, and the user uses what I use to split the string, then a failure occurs there also. If you need to see the script, I'm happy to post it, but I think in this case it isn't needed. I simply need a method of storing the data for future retrieval in an 2-dimensional array without any failures. Thoughts? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JerryD Posted December 10, 2007 Share Posted December 10, 2007 (edited) IniWriteSection _ArrayToString Edited December 10, 2007 by JerryD Link to comment Share on other sites More sharing options...
Bert Posted December 10, 2007 Author Share Posted December 10, 2007 I thought of that, but what if the user uses a "=" sign? That would break it, for you use equal signs in ini files. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
ChrisL Posted December 10, 2007 Share Posted December 10, 2007 I have a script that makes and displays data. Pretty basic. What it does is allows you to make a short string of data for a title, then make a long string that can be a paragraph if you like. Example:short string: Called userLong string: Called user, left voice mail. Waiting for user to call back. Sent user email to notify them of receiving of ticket.My question is this: I need a method of storing the data so that can be added to a array when the script runs. I thought of using an CSV file, but if the user doesn't have Office installed, that wouldn't work. I thought of using an INI, but I do not know how to handle things such as carriage returns, and if the user put in a "=" sign in his long or short string, that would cause a failure. If I use string split, and the user uses what I use to split the string, then a failure occurs there also. If you need to see the script, I'm happy to post it, but I think in this case it isn't needed. I simply need a method of storing the data for future retrieval in an 2-dimensional array without any failures. Thoughts?Why do you need Office installed for a CSV? You only need Office installed if you want to open the CSV in excel.You could store all of the data in a CSV then I assume you want to look at this data later on from th saved file yes?Then just write another program which imports the data back from the CSV file and displayes it however you want evnen using array display if you can't be bothered to write your own GUI [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted December 10, 2007 Share Posted December 10, 2007 Why do you need Office installed for a CSV? You only need Office installed if you want to open the CSV in excel.You could store all of the data in a CSV then I assume you want to look at this data later on from th saved file yes?Then just write another program which imports the data back from the CSV file and displayes it however you want evnen using array display if you can't be bothered to write your own GUIOh and reading your post above, if using the CSV file method then encapsulate the data in Speach marks then if you have a comma in a sentence it won't matter, just do a string replace on " with 2 single ' ones before writing to the CSV to avoid breaking the encapsulation in speach marks [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Bert Posted December 10, 2007 Author Share Posted December 10, 2007 I've already have written the GUI last night. I ran into this problem, and been thinking of a method to solve it. expandcollapse popup;#cs #include <GUIConstants.au3> HotKeySet("{esc}","_exit") Opt("GUIDataSeparatorChar","|") ;testing $Form1_1 = GUICreate("", 889, 403, 193, 110) $List1 = GUICtrlCreateList("", 16, 8, 210, 340) $Input1 = GUICtrlCreateInput("", 16, 28, 210, 21) GUICtrlSetState($input1, $GUI_HIDE) GUICtrlSetData($List1,"Item1|Item2|Item3","") ;testing $edit1 = GUICtrlCreateEdit("", 248, 8, 625, 377) $Button1 = GUICtrlCreateButton("Close", 88, 352, 65, 33, 0) $Button2 = GUICtrlCreateButton("Edit", 168, 352, 57, 33, 0) $Button3 = GUICtrlCreateButton("Add", 16, 352, 57, 33, 0) $Button4 = GUICtrlCreateButton("Save", 16, 352, 57, 33, 0) $Button5 = GUICtrlCreateButton("Cancel", 88, 352, 65, 33, 0) GUICtrlSetState($Button4, $GUI_HIDE) GUICtrlSetState($Button5, $GUI_HIDE) $lable1 = GUICtrlCreateLabel("title", 16, 8, 23, 20) $lable2 = GUICtrlCreateLabel("text:", 200, 180, 20, 21) GUICtrlSetState($lable1, $GUI_HIDE) GUICtrlSetState($lable2, $GUI_HIDE) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE or $nMsg = $Button1 Exit Case $nMsg = $Button2 _edit1() $GCR = GUICtrlRead($List1) ;--------testing if $GCR = "Item1" then GUICtrlSetData($edit1,"Item1 is highlighted","") GUICtrlSetData($Input1,"Item1") EndIf if $GCR = "Item2" then GUICtrlSetData($edit1,"Item2 is highlighted...","") GUICtrlSetData($Input1,"Item2") EndIf if $GCR = "Item3" then GUICtrlSetData($edit1,"Item3 is highlighted>>>>>","") GUICtrlSetData($Input1,"Item3") endif _edit1() Case $nMsg = $Button5 _return() Case $nMsg = $List1 $GCR = GUICtrlRead($List1) if $GCR = "Item1" then GUICtrlSetData($edit1,"Item1 is highlighted","") if $GCR = "Item2" then GUICtrlSetData($edit1,"Item2 is highlighted...","") if $GCR = "Item3" then GUICtrlSetData($edit1,"Item3 is highlighted>>>>>","") EndSelect WEnd func _exit() Exit EndFunc func _edit1() GUICtrlSetState($list1, $GUI_HIDE) GUICtrlSetState($Button1, $GUI_HIDE) GUICtrlSetState($Button2, $GUI_HIDE) GUICtrlSetState($Button3, $GUI_HIDE) GUICtrlSetState($Button4, $GUI_SHOW) GUICtrlSetState($Button5, $GUI_SHOW) GUICtrlSetState($input1, $GUI_SHOW) GUICtrlSetState($lable1, $GUI_SHOW) GUICtrlSetState($lable2, $GUI_SHOW) EndFunc func _return() GUICtrlSetState($list1, $GUI_SHOW) GUICtrlSetState($Button1, $GUI_SHOW) GUICtrlSetState($Button2, $GUI_SHOW) GUICtrlSetState($Button3, $GUI_SHOW) GUICtrlSetState($Button4, $GUI_HIDE) GUICtrlSetState($Button5, $GUI_HIDE) GUICtrlSetState($input1, $GUI_HIDE) GUICtrlSetState($lable1, $GUI_HIDE) GUICtrlSetState($lable2, $GUI_HIDE) EndFunc ;#ce The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Xandl Posted December 10, 2007 Share Posted December 10, 2007 To separate string data in the storage file, you can use "chr(1)", and StringSplit on it. This has proven to work reliable, so maybe write a sort of csv file, separated by chr(1). ciao Xandl Link to comment Share on other sites More sharing options...
picaxe Posted December 10, 2007 Share Posted December 10, 2007 Have you looked at _CSVLib_V1.3.au3 from the examples forum Link to comment Share on other sites More sharing options...
Bert Posted December 10, 2007 Author Share Posted December 10, 2007 Have you looked at _CSVLib_V1.3.au3 from the examples forumThats a good idea. I wasn't sure on the CSV approach, but seeing how you don't need Excel loaded to make it work, it should solve the problem. My thanks to everyone who gave suggestions! The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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