NegativeNrG Posted December 13, 2005 Posted December 13, 2005 (edited) Im working on my Text Editor and i dont know how to save the WHOLE text written in the EDIT box.heres my Sample code:$Form1 = GUICreate("Simple Text v0.1", 477, 299, 199, 129) $Edit1 = GUICtrlCreateEdit("", 8, 32, 465, 249, -1, $WS_EX_CLIENTEDGE) GUIctrlsetdata($Edit1,"") $menu = GUIctrlcreatemenu("File") $item1 = GUIctrlcreatemenuitem("Open",$menu) $item = GUIctrlcreatemenuitem("Save As..",$menu) GUISetState(@SW_SHOW) While 1 $msg = GUIgetmsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $item [b]$save = FileSaveDialog("Save To..","C:\","Text Documents(*.txt)",16)[/b] FileWrite($save,$Edit1)In Bold it doesnt work, ive tried FileWriteline, but also doesnt work. Can anyone help me? Edited December 13, 2005 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload.
Moderators SmOke_N Posted December 13, 2005 Moderators Posted December 13, 2005 $Form1 = GUICreate("Simple Text v0.1", 477, 299, 199, 129) $Edit1 = GUICtrlCreateEdit("", 8, 32, 465, 249, -1, $WS_EX_CLIENTEDGE) GUIctrlsetdata($Edit1,"") $menu = GUIctrlcreatemenu("File") $item1 = GUIctrlcreatemenuitem("Open",$menu) $item = GUIctrlcreatemenuitem("Save As..",$menu) GUISetState(@SW_SHOW) While 1 $msg = GUIgetmsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $item $ReadEdit = GuiCtrlRead($Edit1) $save = FileSaveDialog("Save To..","C:\","Text Documents(*.txt)",16) FileWrite($save,$ReadEdit) 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.
NegativeNrG Posted December 13, 2005 Author Posted December 13, 2005 Doh!, should have thought of that first..forgot all about GUictrlread() [size=20]My File Upload[/size]Register at my site and upload.
NegativeNrG Posted December 13, 2005 Author Posted December 13, 2005 ok i have another problem, When i open up a .Txt File in my Text Editor, i Then Deleted the words, then wrote something, saved it, but then it doesnt save, it does but...Read example. i have a Text document with the words "hello" in it, i then delete the words hello, then write testing, but when i save it, it says hellotesting. anyone help? [size=20]My File Upload[/size]Register at my site and upload.
SandelPerieanu Posted December 13, 2005 Posted December 13, 2005 Try this! #Include<GuiConstants.au3> $FORM1 = GUICreate("Simple Text v0.1", 477, 299, 199, 129) $EDIT1 = GUICtrlCreateEdit("", 8, 32, 465, 249, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData($EDIT1, "") $MENU = GUICtrlCreateMenu("File") $ITEM1 = GUICtrlCreateMenuItem("Open", $MENU) $ITEM = GUICtrlCreateMenuItem("Save As..", $MENU) GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE ExitLoop Case $MSG = $ITEM $SAVE = FileSaveDialog("Save To..", "C:\", "Text Documents(*.txt)", 16) FileOpen($SAVE, 2) FileWrite($SAVE, GUICtrlRead($EDIT1)) FileClose($SAVE) Case $MSG = $ITEM1 $OPEN = FileOpenDialog("Open..", "C:\", "Text Documents(*.txt)", 16) GUICtrlSetData($EDIT1, "") GUICtrlSetData($EDIT1, FileRead($OPEN, FileGetSize($OPEN))) EndSelect WEnd
NegativeNrG Posted December 13, 2005 Author Posted December 13, 2005 hi psandu.ro, Thanks, and that worked, im about 1/2 Complete . [size=20]My File Upload[/size]Register at my site and upload.
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