Jump to content

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.")
    Exit
EndIf

; write the values of editboxes text into the textfile

Run("D:\Davy\AutoScripts\send\prjSend.exe")
WinWait("Form1")
FileWriteLine($file, GUICtrlRead ("TEdit2"))
FileWriteLine($file, GUICtrlRead ("TEdit1"))
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...