Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strange RT window not found error - how possible?
#1
I am using QM version 2.4.3.0

I got the following error when running a macro which called a function named "checkcolour"

"Error (RT) in checkcolour: window not found."

The error line it linked to in function "checkcolour" was

scan("color:0x0" win r2 0x1000)


Note r2.left=5; r2.top=922; r2.right=1195; r2.bottom=923

How can I get a "window not found" error when the window referred to is "win" - the current window - surely the current window can always be found? This code has run before and worked ok.

Also the code just before this:

lef

did not work and click the left mouse button which I think is connected to this problem as there was no active window to click in although a few lines earlier QM had detected and output the current active window number with the instruction:

out win

My only guess is that the current window "win" had just been closed by the java application it was running under as it had gone to sleep due to a period of inactivity and was waiting for a mouse over movement to wake it up. This is just a guess and is doubtful.
#2
Try

Macro Macro2537
Code:
Copy      Help
scan("color:0x0" win r2 0x1000)
err
,out _error.description
,outw win
,end
#3
Quote:surely the current window can always be found
Not always. For example, sometimes there is no active window for a very brief time after destroying the currently active window.
This macro also sets "no active window".
Macro Macro2538
Code:
Copy      Help
SetForegroundWindow GetDesktopWindow
outw win
#4
Thank you - your support is fast and helpful.

I cannot currently recreate this error as it has only happened once out of hundreds of executions of the macro but I am worried it may happen again on rare occasions.

I think that the scan probably returned a "window not found" error as the macro runs extremely fast and the screen was changing from displaying an old window to activating a new window (as you mentioned when destroying there may be no active window for a brief moment)

I think that in QM 2.4.3.0 scan with the flag x1000 "scan" will check for a color in a window both for active or even if it is not active ? So windows both not visible or visible on the screen may be scanned for colors without activating them?

So if I use the window number (handle) rather than "win" with "scan" then I should never get this error again as I do not need to activate the window to scan for the colour?

e.g. use

int w1=123456
scan("color:0x0" w1 r2 0x1000)

and NOT

scan("color:0x0" win r2 0x1000)
#5
Yes, with flag 0x1000 can find colors in windows that are behind other windows, ie the window pixel may be not visible. Must be Aero enabled etc, as you can read in Help.

int w1=win(...)
scan("color:0x0" w1 r2 0x1000)

Will be error if the window not found or destroyed.


Forum Jump:


Users browsing this thread: 1 Guest(s)