Jump to content

Script doesn't work in the background

Recommended Posts


I'm a new member but I always find solutions to my problems here by google. This time I couldn't find any so i'm creating this topic.

I've got a script:

Func work()
    sendlog("Working in progress...")
    GUICtrlSetData($label1, "Active")
    GuiCtrlSetState($graphic1, $GUI_HIDE) ;turn green light
    GuiCtrlSetState($graphic2, $GUI_SHOW)
    sendlog("I'm waiting...")
    While $count <> 0 ;loop is working while there is any tasks on the list
        if $next_when <= 80 Then ;if there is less than 80s to do task ($next_when = _DateDiff('s', _NowCalc(), $datetime))
            sendlog("I'm preparing")
            While $wait = 0
                If @HOUR = $an_hour Then
                    If @Min = $an_minute Then
                        If @SEC = $an_second Then
            MsgBox(0, "", "Success")
            $wait = 0
    GuiCtrlSetState($graphic1, $GUI_SHOW) ;turn red light if not active
    GuiCtrlSetState($graphic2, $GUI_HIDE)

It works fine but only if window is active. I'm not using WinActive anywhere.

If I focus other window and this is working in the background it goes to the "I'm preparing" message and that's it. Then infinite loop I guess. I'm not receiving msgbox "success" or anything after that.

In this script I'm using IE.au3 (not in this case), WinAPIFiles.au3, Date.au3, File.au3 and some other like WindowsConstants.au3 etc.

What it could be?

Link to post
Share on other sites
  • Moderators

@mjb_ you are showing one function out of your entire script, we need to see all the missing pieces in order to assist

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...