Owen
Owen
CC#
Created by Owen on 1/27/2023 in #help
❔ 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
CC#
Created by Owen on 12/7/2022 in #help
❔ Regex assistance
Looking for some assistance with regex - details posted in #other-langs For context, i'm pulling orders from an API and am looking to use Regex to return the amount of orders - aswell as the amount of orders after a certain date
11 replies
CC#
Created by Owen on 11/21/2022 in #help
❔ Removing JSON data from JSON File
18 replies
CC#
Created by Owen on 11/16/2022 in #help
❔ 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:
{
"image_asset_urls": [

{
"bot_icon":"test.com/test.png"
}

]
}
{
"image_asset_urls": [

{
"bot_icon":"test.com/test.png"
}

]
}
Here's my C# translation using Newtonsoft.Json:
[JsonProperty("image_asset_urls")]
public List<KeyValuePair<string, string>>? Images { get; set; }
[JsonProperty("image_asset_urls")]
public List<KeyValuePair<string, string>>? Images { get; set; }
How would I correctly do this? Thanks.
67 replies