by tomakung 06/02/14, 07:18 am
#include
#include
#include
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 448, 24, 97, 33)
$Button2 = GUICtrlCreateButton("Delete", 448, 80, 97, 33)
$Button3 = GUICtrlCreateButton("Save", 448, 140, 97, 33)
$Edit1 = GUICtrlCreateEdit("", 40, 24, 177, 289)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
case $Button1
$file = FileOpen("test.txt", 0)
$show= FileRead($file)
GUICtrlSetData(-1, $show)
FileClose($file)
Case $GUI_EVENT_CLOSE
Exit
case $Button2
$Edit1=GUICtrlSetData(-1, "")
Case $Button3
$hsave=FileSaveDialog("Choose...",@ScriptDir,"Text Files (*.txt)")
If $hsave="" Then
cancel()
else
FileWrite($hsave&".txt",GUICtrlRead($Edit1))
MsgBox(64,"Saved","Document was saved",5)
EndIf
EndSwitch
WEnd
Func cancel()
MsgBox(64,"Cancelled","Cancelled")
EndFunc