Jump to content

Recommended Posts

Posted

Yeah, I'm pretty oblivious. I'm having a little trouble with my program right now. Currently, I'm working on a basic text editor. I'm not exactly sure it's all possibly, but I'm trying anyway. =/ Anyway, this is what I have.

#include <GUIConstants.au3>

$MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"

GUICreate("Text Editor V1.0") ; will create a dialog box that when displayed is centered

$newdoc=GUICtrlCreateEdit ("", 5,5,390,390,$ES_AUTOVSCROLL+$WS_VSCROLL)

$filemenu = GUICtrlCreateMenu ("&File")

$fileitem = GUICtrlCreateMenuitem ("&Open",$filemenu)

$saveitem = GUICtrlCreateMenuitem ("&Save",$filemenu)

$exititem = GUICtrlCreateMenuitem ("&Exit",$filemenu)

GUISetState ()

GUICtrlSetData (1,$newdoc,1)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

If $msg = $exititem Then ExitLoop

If $msg = $saveitem Then

$var = FileSaveDialog( "Choose a name.", $MyDocsFolder, "Text files (*.txt)", 3, "*.txt")

$file = FileOpen($var, 1)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWrite($file, $newdoc)

FileClose($file)

EndIf

If $msg = $fileitem Then

$var = FileOpenDialog("Choose a file", $MyDocsFolder, "Text files (*.txt)", 1 + 4, "*.txt")

$file = FileOpen($var, 0)

$newdoc = $file

EndIf

Wend

I'm not sure how to get the FileOpenDialog and FileSaveDialog to work with the GUI Edit. Any suggestions? ^_-;

Posted

Yeah, I'm pretty oblivious. I'm having a little trouble with my program right now. Currently, I'm working on a basic text editor. I'm not exactly sure it's all possibly, but I'm trying anyway. =/ Anyway, this is what I have.

I'm not sure how to get the FileOpenDialog and FileSaveDialog to work with the GUI Edit. Any suggestions? ^_-;

$text = FileRead($file)
GUICtrlSetData ($newdoc, $text)oÝ÷ Ù«­¢+ØÀÌØíÑáÐôU%
ÑɱI ÀÌØí¹Ý½¤)¥±]É¥Ñ ÀÌØí¥±°ÀÌØíÑáФ
Posted

$text = FileRead($file)
GUICtrlSetData ($newdoc, $text)oÝ÷ Ù«­¢+ØÀÌØíÑáÐôU%
ÑɱI ÀÌØí¹Ý½¤)¥±]É¥Ñ ÀÌØí¥±°ÀÌØíÑáФ
Saving works now, but whenever I attempt to open a file, I get this error.

ERROR: FileRead() [built-in]called with wrong number of args.

$text = FileRead($file)

Posted

You are using old version 3.1.1 or old beta version.

Instal latest beta (133) or better new release version 3.2.0.1

! It works now. Many thanks. :P

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...