|
Post by Johnc on Sept 29, 2018 15:35:32 GMT
Hi Steve,
Is there a way to detect a pixel colour change without knowing the colour? I am guessing one would have to sample the colour first at a particular location and then do a pixel colour compare afterwards, right?
Pixel colour comparing should be straight forward but how do we sample the colour value at a particular location? Any action to do that?
Ideally, MMM should detect pixel colour change automatically, without concerning what the exact colour is.
Thanks,
John
|
|
|
Post by Kamp on Sept 29, 2018 19:13:05 GMT
Add Condition > IF > PIXEL COLOR
|
|
|
Post by Johnc on Sept 30, 2018 3:32:27 GMT
Tks Kamp for your reply! I meant detecting a pixel colour change without knowing exactly what the colours are before and after! The simple
Add Condition > IF > PIXEL COLOR
Won't work coz you have to know exactly what colour to look for.
Thank you!
|
|
|
Post by Steve on Oct 2, 2018 0:30:22 GMT
Yeah John that's a good one. I get it. Some logic like: 5 | RUN ACTION | DEFINE STRING VARIABLE | %STRING%::PIXEL At Location [X:1095 Y:421] 6 | IF | PIXEL COLOR | Color [%STRING%]::At Location [X:1095 Y:421] | IS THE SAME | ACTION That would be cool. I'll look into it...not promising anything might not get it in to the next update. I'm way to close to releasing the next version without adding another feature lol it'll have to wait
|
|
|
Post by Johnc on Oct 2, 2018 2:48:55 GMT
Hurrah!! Steve u r on the ball! Exactly what I was looking for! I can think of so many applications for this!
Better yet, if u can build it all into the code as a function, the 1 liner may look something like this:
6 | IF | PIXEL COLOR | At Location [X:1095 Y:421] | Has changed | 1 time | Continue/Action -just detecting a single colour change at X,Y location and then action. Otherwise wait.
or
6 | IF | PIXEL COLOR | At Location [X:1095 Y:421] | Has changed | 2 times | Continue/Action -don't action until the colour has changed 2 times! Otherwise wait.
or
6 | IF | PIXEL COLOR | At Location [X:1095 Y:421] | Has changed | 3 times | Continue/Action
-don't action until the colour has changed 3 times! Otherwise wait.
This is so convenient as you don't have to worry about the exact colour that the webpage will give u. BTW, the last sampled colour can be stored in the internal variable %COLOR%! This should be useful for future use perhaps lol!
Look forward to the future release containing this new feature Steve!
Thanks once again!
|
|
|
Post by Johnc as guest on Oct 2, 2018 9:10:48 GMT
actually to simply the implementation, the following will be sufficient:
149 | IF | PIXEL COLOR | At Location [X:1300 Y:312] | HAS CHANGED | CONTINUE
I can then use this line multiple times to detect multiple colour changes.
No need to implement %COLOR% to save time. Then this should be a very fast tweak to the MMM code B)
Thanks!
|
|
|
Post by Steve on Oct 2, 2018 22:40:21 GMT
actually to simply the implementation, the following will be sufficient: 149 | IF | PIXEL COLOR | At Location [X:1300 Y:312] | HAS CHANGED | CONTINUE I can then use this line multiple times to detect multiple colour changes. No need to implement %COLOR% to save time. Then this should be a very fast tweak to the MMM code B) Thanks! ....there are never any fast tweaks to the MMM code lol
|
|
|
Post by Johnc on Oct 4, 2018 3:59:28 GMT
Good sense of humor Steve! You have made me so hungry LOL!
|
|
|
Post by Steve on Oct 4, 2018 23:17:56 GMT
I had a look at the code and added it in for the upcoming update. It made it in lol
So it works like this:
1 | IF | PIXEL COLOR | At Location [X:1194 Y:461] | CHANGES::2::10::100 | MESSAGE PROMPT | 2 changes detected within 10 seconds with a 100 ms delay::Pixel Changes::0 - If the pixel at location X 1194 and Y 461 changes 2 times, within 10 seconds, with a 100 milliseconds delay between changes, then run the Message Prompt action.
1 | IF | PIXEL COLOR | At Location [X:1194 Y:461] | CHANGES::10::0::0 | CONTINUE - When the pixel at location X 1194 and Y 461 changes 10 times continue. Thanks for the idea John. It was pretty easy to implement. Cheers, Steve.
|
|
|
Post by Johnc on Oct 5, 2018 1:53:18 GMT
Wow wow wow! Steve! You are absolutely brilliant and you have done it again! Such a welcome surprise and thank you so much! It was a super fast development cycle despite the coding challenge! I was also thinking about the time delay between the changes and wasn't sure how to handle it properly! Coz there might be some fast flashes on the screen (like a full screen pop-down menu etc) that you want to ignore. Looks like the CHANGES::X::X::X instruction is taking care of that! Congratulations once again Steve! An excellent feature addition to boost the power, reliability and simplicity of MMM immensely for web automation and any other applications that need to wait for a certain screen response! This is so awesome Steve and you deserve all the credit! I just ate the delicious spaghetti lol! Can't wait for the next release!!
Cheers, John
|
|