Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triggers help
#1
I’m just banging my head around in QM trying to do so thing I know is going to be stupid simple yet I just can’t seem to figure it out 


I’m running a program in the bottom right of the program is a status window in that window it will display one of three things text that says sending receiving or error I need my macro to trigger when it says error I just have no idea what I would select and where I wouldn’t input this information in the riggers menu the rest I can write on what it is I want it to do it’s I jist the bloody trigger that has me hung up
#2
Try accessible object trigger.

Example with Notepad:
Macro Macro6
Trigger $a 140 -4 "" "msctls_statusbar32" 1025 "" "Notepad" "- Notepad" 41     Help - how to add the trigger to the macro
Code:
Copy      Help
;\
function hwnd idObject idChild
Acc a.FromEvent(hwnd idObject idChild)
str s=a.Name
out s

sel s 1|2
,case "*error*"
,out "ERROR"

How to know the trigger data?
1. Select QM menu Tools -> Output -> Log -> Acc. trigger events. OK.
2. Activate your program and let it change status bar text.
3. Activate QM and uncheck the same menu item (step 1).
4. Look for trigger info in the output pane. It can look like this (or it can be different, but it must contain the status bar text):
Code:
Copy      Help
8. NAMECHANGE, CLIENT, 2
    ow: class="msctls_statusbar32", id=1025
    pw: class="Notepad", name="Untitled - Notepad"
    ao: role=STATICTEXT, state=0x0, name="   Ln 1, Col 2  "
5. In the Properties dialog select trigger "Accessible object". Then enter the trigger info. If using the above info: select EVENT_OBJECT_ -> NAMECHANGE, then in the idObject combobox select CLIENT, in ow class field paste ow class (msctls_statusbar32), in pw fields paste pw class and name, click button Next, select role STATICTEXT.
6. OK. If asks, let it insert trigger data; then uncomment the 2 green lines.
7. Test the trigger: Activate your program and let it change status bar text. If the trigger works, your macro runs and displays status bar text in QM output.
#3
the only way i can find the text im looking for is if i go find accessible object in which case it gives me

win("some program" "Qt5QWindowIcon")
Role "STATIC TEXT
class Qt5QWindowIcon
XY 2 688
State 0x0 0
STATICTEXT "Error Restart Send"


it's when i get thats error restart send that i need the macro to trigger when i tried your output log couldn't get it to show
#4
Probably this accessible object does not raise events. Then cannot use accessible object triggers.

Another way - wait for the accessible object. Note: it consumes some CPU while waiting.
Create new function and assign a window trigger, so that it runs when the window is shown. In tab "Function properties" check "single thread".
In dialog "Find accessible object", capture the status text object. Click Test, OK.
Let the function find the accessible object. Then wait for changed Name in loop. If contains "error", run a macro.

Example with Notepad:
Function Function2
Trigger !ca"- Notepad" "Notepad"     Help - how to add the trigger to the macro
Code:
Copy      Help
int w=TriggerWindow
Acc a.Find(w "STATICTEXT" "" "class=msctls_statusbar32" 0x1005 3 0 "next")
str text=a.Name
out F"Trigger started. Now status text is: {text}"
rep
,0.5 ;;smaller = faster response but more CPU
,if(!IsWindow(w)) ret ;;exit when window closed
,str s=a.Name; err ret
,if(s=text) continue
,text=s
,out F"Status text changed: {s}"
,
,sel s 1|2
,,case "*error*"
,,out "ERROR"
,,;mac "Macro12345"
,,
#5
Hurm I’m not really certain how to solve my problem then I’m certain some one such as your self could make 6-7 clicks and it would be done would you be interested in a small bounty in exchange for helping me out ? I could toss ya a few bucks via PayPal or some bitcoin if you’d like ? Apologies if this is allowed or not I’d be willing to setup a team view session and we could find a means of communication that works for the both of us it’s really a rather simple challenge I just don’t have a very good grasp of macros and to be honest it’s a fairly popular program in my community that I would like to keep the macro private as I don’t want it being abused I could explain more in private if it’s somthing that interests you

-James


Forum Jump:


Users browsing this thread: 2 Guest(s)