Jump to content
Sign in to follow this  
radboi22

Adding a text file to the GUI?

Recommended Posts

radboi22

Hi, Im new to AUTOIT obviously, I was wondering if anyone would Depart some information on how to put a Text file into the GUI, And will it update in REAL TIME as information is added to this file? Basically, I want the text from a notepad file to show on the GUI, And update in real time.

Also the program im working with has A Remote option, IP/PORT, how do I Manipulate this, and how can I draw information from this? (Parsing, etc...)

THANK YOU =D

Share this post


Link to post
Share on other sites
rasim

Hi, Im new to AUTOIT obviously, I was wondering if anyone would Depart some information on how to put a Text file into the GUI, And will it update in REAL TIME as information is added to this file? Basically, I want the text from a notepad file to show on the GUI, And update in real time.

Try this:

#include <GuiConstants.au3>

Global $ReadNotepad, $ReadEdit

$hGUI = GUICreate("MainGUI", 300, 200, 0, 0)

$hEdit = GUICtrlCreateEdit("", 10, 10, 280, 180, BitOR($ES_WANTRETURN, $WS_VSCROLL))

GUISetState()

Run("notepad.exe")
WinWait("[Class:Notepad]")
$hWnd = WinGetHandle("[Class:Notepad]")
ConsoleWrite($hWnd & @LF)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    
    $ReadNotepad = ControlGetText($hWnd, "", "Edit1")
    $ReadEdit = GUICtrlRead($hEdit)
    If ($ReadNotepad <> "") And ($ReadNotepad <> $ReadEdit) Then GUICtrlSetData($hEdit, $ReadNotepad)
WEnd
Edited by rasim

Share this post


Link to post
Share on other sites
radboi22

Try this:

#include <GuiConstants.au3>

Global $ReadNotepad, $ReadEdit

$hGUI = GUICreate("MainGUI", 300, 200, 0, 0)

$hEdit = GUICtrlCreateEdit("", 10, 10, 280, 180, BitOR($ES_WANTRETURN, $WS_VSCROLL))

GUISetState()

Run("notepad.exe")
WinWait("[Class:Notepad]")
$hWnd = WinGetHandle("[Class:Notepad]")
ConsoleWrite($hWnd & @LF)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    
    $ReadNotepad = ControlGetText($hWnd, "", "Edit1")
    $ReadEdit = GUICtrlRead($hEdit)
    If ($ReadNotepad <> "") And ($ReadNotepad <> $ReadEdit) Then GUICtrlSetData($hEdit, $ReadNotepad)
WEnd

Kewl ty =D

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  

×