Sign in to follow this  
Followers 0
rony2006

GUI output data refresh - from variable

2 posts in this topic

Hello, I have the following script and I want to see the value of $iColor all the time in a GUI. 

When I start the script I see the actual value of variable but if the color change (on my desktop for ex) the value from gui remains the same.

How I can code to make the GUI like a realtime variable monitor?

#include <ImageSearch.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


While 1

script()
gui()

WEnd






func gui()

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 275, 193, 192, 124)
$Input1 = GUICtrlCreateInput($iColor, 64, 48, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

EndFunc





Func script()

$x1=0
$y1=0
$result = _ImageSearch("origine.bmp",1,$x1,$y1,70)
$var1 = 610
$var2 = 255

Global $xs = $x1 - $var1
Global $ys = $y1 + $var2
if $result=1 Then
Beep (2000, 200)
EndIf



Global $iColor = PixelGetColor($xs, $ys)

;MsgBox($MB_SYSTEMMODAL, "", "The decimal color is: " & $iColor)

$ts = 0
$ts1 = 0

If $iColor < 1500000 Then
MsgBox($MB_SYSTEMMODAL, "", "START CICLU " & $iColor)
Sleep (400)
EndIf
EndFunc

 

Share this post


Link to post
Share on other sites



Your first while loop calls the GUI Func which has its own while in it which never ends, thus your function will only run once per program start.

 

May I ask what this is for?


C0d3 is P0etry( ͡° ͜ʖ ͡°)

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  
Followers 0