Jump to content
Sign in to follow this  

Reading text from GUIs to text files

Recommended Posts


i came up with the following code which reads text from an edit control in a text file

i get an error.were am i going wrong?

$file = FileOpen("D:\Davy\AutoScripts\send.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")

; write the values of editboxes text into the textfile

FileWriteLine($file, GUICtrlRead ("TEdit2"))
FileWriteLine($file, GUICtrlRead ("TEdit1"))

Share this post

Link to post
Share on other sites
Don N

From the docs:

Mode (read or write) to open the file in.

0 = Read mode

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

Both write modes will create the file if it does not already exist.

When you set mode to 0 you are openign the file for reading, not writing. Use 1 or 2 in order to write to the file after opening it.

Hope this helps.

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.