Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check for new messages trigger
#1
I'm using the script below to check for new messages, and it's working well.
https://i.ibb.co/hWCPcmp/a.png

I think LA window triggers should be able to achieve the same functionality. I'm not very familiar with how LA triggers work.
Could you provide a code example?

Also, I'm curious which of these methods is more resource-efficient?

Code:
Copy      Help
// script "newMes.cs"
//.
script.setup(trayIcon: true, sleepExit: true);
//..

print.clear();

L1:

var w = wnd.find(1, "*", "MainWnd").Activate();
var e = w.Elm["BUTTON", "Messeges"].Find(1);
string n = e.Value;

if (!n.NE())
{

    print.it(n);
}


1.s();

goto L1;
#2
Window triggers - no. Unless the window name changes.

Sometimes can be used class WinEventHook. It is like QM triggers of type "Accessible object". But in this case probably would not be better than your code.
#3
Thanks for your help.
With the above code, both LA and The Program are stuck in infinite execution, consuming 1-2% CPU usage.
Is it possible to create a trigger to scan images? Similar to the QM code below, Or suggest a more efficient monitoring method?

   
Macro Macro33
Code:
Copy      Help
int w=win("" "MainWnd")
if scan("image:hE9074BBF" w 0 1|2|16)
,out "ok"
#4
Your code can be optimized to eat less CPU.
1. Remove the 1 from Find(1).
2. Search in a smaller area, not in entire window. Find that area (a parent or ancestor UI element of the wanted element) at the start, and later search in it.


Forum Jump:


Users browsing this thread: 1 Guest(s)