Notifications
Clear all
[Closed] Text Load/Save
Dec 31, 2011 11:52 am
Hi everyone;
I have a little question but i couldnt find my answer in help document…
I’m planning to create a pose control menu to save and load poses for my character.
In this case i need to learn how can i save and load the items of a listbox as a .txt file?
Best regards…
3 Replies
Dec 31, 2011 11:52 am
--save:
(dotnetClass "System.IO.File").writeAllLines [I]<filePathAsString> <yourListBox>[/I].items
--load:
[I]<yourListBox>[/I].items = (dotnetClass "System.IO.File").readAllLines [I]<filePathAsString>[/I]
Note that ideally you would want more error checking than this.
Dec 31, 2011 11:52 am
Thank you so much! thats really what im looking for…
but isnt there a way to save it without using dot.net commands?
Dec 31, 2011 11:52 am
yes, look into ‘filestream’ objects in the help file. Though the code is longer.