Jump to content
Sign in to follow this  

Do type values in the edit reading her a txt file?

Recommended Posts


How to type a value in an edit from the data of a file txt?.


Share this post

Link to post
Share on other sites

#include <GUIConstants.au3>
$Form1 = GUICreate("Import File to Editbox", 633, 454, 193, 115)
$Edit1 = GUICtrlCreateEdit("", 8, 32, 617, 417)
$Button1 = GUICtrlCreateButton("Import File to Edit box", 160, 0, 305, 25, 0)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            Local $sFile = FileOpenDialog("Import File", @ScriptDir, "All (*.*)")
            ImportToEdit($Edit1, $sFile)

Func ImportToEdit($Edit, $File)
    Local $sInfo = FileRead($File, FileGetSize($File))
    If @error Then Return
    GUICtrlSetData($Edit, $sInfo)

Try that, it will read a file and put the contents into a edit box. I put the actual code into a function so it's "portable".

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.