I need to create a macro that monitors a area (defined as x by y) on a program window that is running. Area is blank (white) and I want to be notified when any line of text shows up in that area so that I can then click three buttons on that same page. The recording of the buttons seems straightforward but thee monitoring of the area is what has me stumped. Any suggestions or help>. Thank you very much for a great piece of software!
I have found the FIND IMAGE ...Wait window and changed the option to Wait until something changes. I am having a problem with the DRAG button. I get the crosshair to define a corner but cannot get it to define anything. If I let go of the mouse the Find Image box comes back and I never defined anything. Can you maybe go into a little moree details on how to drag this area back into the window? I am fully blink in one eye and vision in other is not the best so reading a lot of tutorial files online or watching videos is difficult. Please be patient with me.
RECT r SetRect&r 5050100100;;coordinates in the client area of the window int w=win("Untitled - Notepad""Notepad") wait0-S "" w r 16
To define a rectangle area, edit the values in the SetRect line. They are coordinates of left, top, right and bottom. You can see mouse coordinates in the status bar of the Quick Macros window.
01-19-2019, 10:13 PM (This post was last modified: 01-19-2019, 10:38 PM by AggieBQ1972.)
Here is my generated code. However I am not seeing the mouse coordinates in the QM Status Bar. Not seeing the QM Status bar at all. I've looked Tools and I see Status Bar and Mouse position is checked but there is no check mark in front of status bar to turn on/off like I would have expected.
RECT noqso
SetRect &noqso 50 50 100 100
int w=win("WSJT-X v2.0.0 by K1JT" "Qt5QWindowIcon")
wait 0 -S "" w noqso 16
status bar covereee by another window. Back to get coordinates
RECT r
SetRect &r 1170 260 2160 510
int w=win("WSJT-X v2.0.0 by K1JT" "Qt5QWindowIcon")
wait 0 -S "" w r 16
#region Recorded 1/19/19 4:50:02 PM
int w1=act(win("WSJT-X v2.0.0 by K1JT" "Qt5QWindowIcon"))
lef 1139 26 w1 ;;title bar
lef 1044 992 w1 1 ;;push button 'Erase Alt+E'
lef 1748 990 w1 1 ;;push button 'Halt Tx Alt+H'
#endregion
I am attaching screenshot. QM Floating toolbar is located just below the coordinate 1170 260. When run, I expect that when the lines populate in the right window below 1170 260 that QM will run the recorded portion of Erasing the entire Right window followed by Halt button. As you can see from the attached image there are multiple lines populating even below the QM toolbar which according to the 4 coordinates should be in the area watching for changes. Can you see what might be the problem? Thank you veery much!
01-20-2019, 10:11 PM (This post was last modified: 01-20-2019, 10:17 PM by Gintaras.)
To debug it, insert out 1 and out 2 above and below the wait line:
out 1 ;;note: at this time the area must be still blank
wait 0 -S "" w r 16 ;;during this waiting time the area should become non-blank
out 2 ;;now the area is non-blank
If the macro works as expected, it should print 1 and 2 in the output.
If it prints only 1, probably nothing changed in that area while the wait line is waiting.
I tested this macro with the screenshot in Firefox. The area initially is blank. When I run the macro, it prints 1. Then when I scroll the page, the text is scrolled into the area, and the macro prints 2.
out RECT r SetRect&r 16002601700300 int w=win("monitor blank area of window for any change - Mozilla Firefox""MozillaWindowClass") out1 wait0-S "" w r 16 out2
That macro works. Problem was I had another macro running and I had to delete that macro first. Is there a way to run. multiple macros (I had simultaneous running macros set on the first macro that I had to delete. Or should I create this as a function and call from the macro I had to delete?
Second question: duet to my eye sight issue I am having trouble finding the Tray where help file says I should see if macro is running.
This macro will work one time. However, after the sccxreen is cleared on the right sided and the area I want to monitor is blank again, dit no longer will work. It continues to let data lin es fill up the monitored area/. Any suggestions
RECT r
SetRect &r 2000 710 2500 900
int w=win("WSJT-X v2.0.0 by K1JT" "Qt5QWindowIcon")
Somehow I am getting an error running this macro. Oudtpu box gives the following error:
Error in <open ":1: /179">BlankAreaCk: empty block. Did you forget to tab-indent following lines?.
No lines were mentioned other than this error message
Can you see anything?
RECT r
SetRect &r 2000 326 3500 500
int w=win("WSJT-X v2.0.0 by K1JT" "Qt5QWindowIcon")
out 1
wait 0 -S "" w r 16
out 2
rep
01-24-2019, 10:07 PM (This post was last modified: 01-24-2019, 10:29 PM by Kevin.)
you didn't copy code correctly
read here on how to copy code to and from qm forum
http://www.quickmacros.com/forum/showthread.php?tid=786
also your code can be greatly improved to not rely on mouse clicks .. The problem with mouse clicks and using x any y coordinates is if you change window size or screen resolution they won't work..
RECT r SetRect&r 20007102500900 int w=win("WSJT-X v2.0.0 by K1JT""Qt5QWindowIcon") Acc a rep ,wait0-S "" w r 16 ,a.Find(w "PUSHBUTTON""Halt Tx Alt+H"""0x31) ,a.DoDefaultAction ,lef36521388 w 1;;radio button ,a.Find(w "PUSHBUTTON""Erase Alt+E"""0x1) ,a.DoDefaultAction ,a.Find(w "CHECKBUTTON""Enable Tx Alt+n"""0x1001) ,a.DoDefaultAction
can be improved further
what are you clicking in this line lef 3652 1388 w 1 ;;radio button
if you let me know what it is i can probably find a better way that doesn't use the mouse and coordinates
RECT r SetRect&r 20007102500900 int w=win("WSJT-X v2.0.0 by K1JT""Qt5QWindowIcon") rep ,wait0-S "" w r 16 ,#region Recorded 1/21/19 10:43:15 AM ,lef29261056 w 1;;push button 'Halt Tx Alt+H' ,lef36521388 w 1;;radio button ,lef17481060 w 1;;push button 'Erase Alt+E' ,lef24561062 w 1;;check box 'Enable Tx Alt+n' ,#endregion ,1
Kevin: Here is the window that I am trying to monitor for ham radio transmission automation monitoring. I have a macro built that makes a ham contact and logs it to my logging program and repeats the calling for a new ham contact. All works well until someone returns my contact but does not supply the full information that is required for a complete verifiable ham contact. In this case the right side of the screen (all ;lines in yellow) keeps repeating the exact same line over and over and over again without ever cancelling the contact and starting initiation of my macro. I thought that if I defined an area ind the bottom of the right side where the white area is and if anything changes in thaat area....any colored linen matter what is there.... will then run a recording to press the HALT DTX button, Erase button dot clear eevverything on the right side, press the CQ W4EIS EM13 lineOR the radio button in the next columm and finally the ENABLE TX button to start the transmission all over again. Right now the defined area to monitor for any change is LARGER that the white area showing in this screen shot is not working.
I will inclue a copy of each of three macros.
Macro [b]BlankAreaCk[/b] [help1][/help1]
[code]RECT r SetRect&r 20007102500900 int w=win("WSJT-X v2.0.0 by K1JT""Qt5QWindowIcon") rep ,wait0-S "" w r 16 ,#region Recorded 1/21/19 10:43:15 AM ,lef29261056 w 1;;push button 'Halt Tx Alt+H' ,lef36521388 w 1;;radio button ,lef17481060 w 1;;push button 'Erase Alt+E' ,lef24561062 w 1;;check box 'Enable Tx Alt+n' ,#endregion ,1[/code]
WSJX Macro - this works logging contacts and restarting until returning station does not reply
01-26-2019, 06:06 AM (This post was last modified: 01-26-2019, 06:17 AM by Kevin.)
ok i installed that program for testing. i am not a ham nor could i hook it up to a radio.
this macro locates the text area on the right side of the window and then creates a rectangle of that area minus the scrollbars and then monitors it for any change.
displays a brief green rectangle at the start that shows the rectangular area the macro is monitoring.
to copy this code click the select all button .then right click the selected code and click copy
then in qm find BlankAreaCk macro select all the code inside and then paste
When I ran the macro there were no errors but it worked tooo well. Immediately after posting the first line where I was calling out for a contzct it cleared the screen and started over. The blank area to monitor needs to be in the bottom 20% or so of the bottom of the right side. Do you have a PayPal Acct Kevin?
New code shows only 2 lines before erasing and resetting. Are you measuring depth on the right side window by number of lines or by a Percentage of the box from top? I have lost sight om one eye but if you want to tell me what/wherfre in the code to change I might be able too adjust?
a few things to note while using this. You cannot change the window size once it starts. you cannot obscure the window either. When the macro starts it shows green rectangle that shows the area its monitoring.
see pic below
i tested macro on my end it only stops the transmission once text hits that area. so not sure what is going on
01-27-2019, 04:53 PM (This post was last modified: 01-27-2019, 05:51 PM by AggieBQ1972.)
Recopied/[asted and macro appears to be working now.
There is still one problem with making this fully automatic. Occasionally two people come back to me at one time and apparently turn off the ENABLE TX button.
Don't think this is a QM problem but could you write a macro to watch the Enable TX button and if off for 15sec./....turn it back on
Thank you!
Lee Clayton
[img]blob:http://www.quickmacros.com/0817e39b-1202-49ee-9f2d-99aec2af2ea5[/img]
Here is a screenshot showing the entire right side of the screen completely full. This should not have happened as I was running the new BlankAreaCk macro.
KEVIN: Your updated code, when run BY ITSELF, will clear the right window when the 9th line of text is displayed. There are a possible 31 lines on the window so it is "rebooting" after top 29% is populated instead of allowing it to go to the BOTTOM 20-25% before rebooting window. However, when I add in another macro that actually logs the contact then it stops rebooting the right window all together. Do the two macros need to be built into one? Also, when the WSJTX macro runs and a contacc is logged there is a small box that pops up with contact information that does cover part of the right window temporarily. This is a WSJTX program window. Now for the two macros for you to inspect for the problem.
I see the line "if numlines(lines) >8". and I can increase line number myself. Will leave it at 8 for now for testing purposes. If you can help me incorporate the two macros into one I think the solution will be found!@!!!!!
02-06-2019, 02:34 PM (This post was last modified: 02-06-2019, 02:35 PM by Kevin.)
probably the new code fails because when added to you other macro is because the new macro is not setup to run simultaneously. Easy enough to fix. NOt sure why your initial macro is setup with a trigger.
we can surely combine it as it looks like your main macro just does a couple things then runs the main program..
from what i can tell you starter macro clicks ok? on the log window
then
erase
then click radion next to Tx6 button?
then clicks
Enable Tx button