Jump to content

repeat/update question


Recommended Posts

Hi, im new to the baords so please bare with me

i started to learn about AutoIT a few days ago, and have been playing around with functions and variables since.

Now, i encountered a problem:

I have a label, that is displaying the information from one of my variables that is taken from another client

so:

CODE
#include <GUIConstants.au3> ; notes to self

Global $title = WinGetTitle("notepad", "") ; grabs the full titlename of the notepad

Global $text = WinGetText( $title, "memo1") ; gets the text into the variable

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("Control window", 300, 300) ; creates the gui window

GUICtrlCreateLabel("Here are the values of all the variables displayed", 10, 10)

GUIctrlCreateLabel($text , 10, 100, "", 300)

GUISetState(@SW_SHOW) ; Makes the window Visible

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;makes the closebutton in topright work

while 1

sleep(1000)

WEnd

Func CLOSEClicked()

Exit

EndFunc

BUT, my problem is, i want the label to update constantly, or like every millisecond with the new text that is written in notepad in this case. How do i do that ?

Mahadeva

Link to comment
Share on other sites

$Label=GUIctrlCreateLabel($text , 10, 100, "", 300)

Replace your loop with this:

While 1
   $text=WinGetText( $title, "memo1") 
   GuiCtrlSetData($Label,$text)
   Sleep(100)
Wend
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...