Owen
❔ Triggering an action after a complex on-screen dialog with a small time window
Apologies for the confusing title but this is a very complex one to explain.
I'm running a test to see how far I can automate basic activities using C#.
The activity I'm trying to automate involves clicking a number presented in a circle when the red line meets the green section - an example gif is here for said circle: https://share.zeron.dev/CKXj2VV.gif
This red line changes in speed and the green section is randomly placed around the circle. The red line moves at quite a fast pace sometimes too. The green only changes colour after the input is given too, for context.
I have already setup OCR to read the number in the center but I am struggling to think of a good way to trigger the keypress (specifically at the right time).
My initial thought is to screenshot the dialog area of the screen constantly until the green pixels are detected - then I can keep rechecking to see if those green pixels turn red (meaning the bar has began to cross), and I would fire the keypress with the number.
The only reason I haven't tried this process yet is because I know the method for checking image pixels in C# is very slow - so I'm wondering if anyone has any better ideas for this?
Thanks a lot!
3 replies
❔ JSON array to List KeyValuePair with Newtonsoft.JSON?
As the title reads, i'm attempting to load a config file (which successfully works) except I am struggling to figure out how I can take in my image assets as a KeyValuePair with the JSON name and value being the parameters.
Here's my JSON code snippet:
Here's my C# translation using Newtonsoft.Json:
How would I correctly do this?
Thanks.
67 replies