Sign in to follow this  
Followers 0
LuisPro

Loop script and GUI Question.

4 posts in this topic

#include <GUIConstantsEx.au3>

GUICreate("GUI test", 400, 400)
GUISetState()

While 1
   $msg = GUIGetMsg()               ;odczytanie zdarzenia jakie zaszło w GUI
   Switch $msg                      ;instrukcja warunkowa
      case $GUI_EVENT_CLOSE         ;jeżeli użyto przycisku zamknięcia okna
         ExitLoop                   ;to wyjście z pętli i koniec skryptu
   EndSwitch
WEnd

While 1
    $color = PixelGetColor(25, 125)
    If $color <> 0xF6F6F6 Then
        SoundPlay(@WindowsDir & "\media\tada.wav", 1)
    EndIf
    sleep(100)
WEnd

First while is GUI, second while is main function of my script.

How  this should be created to works together?

I try this:

#include <GUIConstantsEx.au3>

GUICreate("GUI test", 400, 400)
GUISetState()

While 1
   $msg = GUIGetMsg()               ;odczytanie zdarzenia jakie zaszło w GUI
   Switch $msg                      ;instrukcja warunkowa
      case $GUI_EVENT_CLOSE         ;jeżeli użyto przycisku zamknięcia okna
         ExitLoop                   ;to wyjście z pętli i koniec skryptu
   EndSwitch

    $color = PixelGetColor(25, 125)
    If $color <> 0xF6F6F6 Then
        SoundPlay(@WindowsDir & "\media\tada.wav", 1)
    EndIf
    sleep(100)
WEnd

But i think its worng. Cant close window etc.

Share this post


Link to post
Share on other sites



  1. Why are you using PixelGetColor, most apps can be automated by a better way. Name the app and we will try our best.
  2. GuiGetMsg() and sleep is the problem. So delete the sleep.

Share this post


Link to post
Share on other sites
2 hours ago, AutoBert said:
  1. Why are you using PixelGetColor, most apps can be automated by a better way. Name the app and we will try our best.
  2. GuiGetMsg() and sleep is the problem. So delete the sleep.

1. Is any better alternative than PixelGetColor? I use it to alert myself if in screen are some changes.

2. without sleep i feel like "fps drop".. everything is not work smoothly.

Share this post


Link to post
Share on other sites
1 hour ago, LuisPro said:

2. without sleep i feel like "fps drop".. everything is not work smoothly.

But it runs, if isn't what you want there is only

 

4 hours ago, AutoBert said:

Why are you using PixelGetColor, most apps can be automated by a better way. Name the app and we will try our best.

left!

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