Jump to content
Sign in to follow this  

need help with text in an edit box

Recommended Posts

I need help i'm a newbie and I wanted to know if there was a way to display the contents of a text file in an edit box when a user presses a button.

Share this post

Link to post
Share on other sites

here's one way.

#include <GUIConstants.au3>

$filename = @ScriptDir & '\myfile.txt'

GUICreate("My GUI edit", 500, 500)  ; will create a dialog box that when displayed is centered

$myedit = GUICtrlCreateEdit("", 10, 10, 480, 450, $ES_AUTOVSCROLL + $WS_VSCROLL)
$btn = GUICtrlCreateButton("Read file", 225, 475, 90, 20)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $btn
            GUICtrlSetData($myedit, FileRead($filename, FileGetSize($filename)))

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...