Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
filter by app
#2
If you are writing a filter function, please read "Filter function examples" in QM help (Example1).

Program: if it is for trigger, use scope rather than evaluate it in filter function. If it is in a macro, use wintest.

You should use wintest rather than win. Function win searches for specified window and returns window handle, so, if such window exists, the code allows macro to run. Function wintest examines window (first argument is window handle) and returns 1 if window's properties match other arguments. This handle, for example, can be f.hwnd (in filter function) or win() (active window).

QM status bar shows id for control (child window) under mouse pointer. Top-level window does not have id. You can, for example, search for window-specific control. Use function id or child. For example, following filter function allows trigger if window contains a child with text "Text" and class "Static":

Code:
Copy      Help
;/
function# iid FILTER&f

if(child("Text" "Static" f.hwnd)) ret iid

Following filter function allows trigger if window contains a child with id 2:

Code:
Copy      Help
;/
function# iid FILTER&f

if(id(2 f.hwnd)) ret iid

Of course, function child is better in this case, because many windows, even in the same app, can have a control with id 2.


Note: in current QM version, there is one bug in filter functions: for mouse-click triggers, it can give root owner window in f.hwnd. Use win() instead of f.hwnd.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)