I have an array of data with the following values:
Code: Select all
Array := {"A1":"300","A2":"90","A3":"150"}
Code: Select all
Array := {"A2":"90","A3":"150","A1":"300"}
There is one but..
Sometimes a key can store two values at once, for example "A4":"170.80"
and you need to somehow make sure that the array no longer has A4 170 and 80, but for example A4 170 and B4 80.
What do I need all this for:
I have the following code:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#InstallMouseHook
#InstallKeybdHook
#NoEnv
#Include Include\Gdip_All.ahk
#Include Include\Gdip_ImageSearch2022.ahk
I_Icon = icon.ico
Menu, Tray, Icon, %I_Icon%
Process, Priority, , H
CoordMode Pixel, Screen
Numpad4::
Token := Gdip_Startup()
WinGet, hwnd, ID, A
;hwnd := "790488"
ArrayVar := {}
Loop, 10
{
bmpHaystack := Gdip_BitmapFromHWND(hwnd)
bmpNeedle := Gdip_CreateBitmapFromFile(A_Index - 1 ".bmp") ;
image1 := Gdip_ImageSearch(bmpHaystack, *4 bmpNeedle, outputVar,932,930,0,0,0,0xFF0000,1,3)
Gdip_DisposeImage(bmpHaystack)
Gdip_DisposeImage(bmpNeedle)
Sleep, 17
If outputVar
{
ClipBoard := outputVar
outputVar := RegExReplace(outputVar, "(.*)\,.*","$1")
ArrayVar[A_Index - 1] := outputVar
}
}
For key, value in ArrayVar
{
MsgBox, % "Key: " key ", Value: " value
}
return
I have 10 images named from 0.bmp to 9.bmp, each image searches for a digit on the screen at a specific location.
If he finds a digit, he remembers its coordinates and writes it to an array with the desired key.
After a full scan of the screen, I need to calculate in what order the numbers are in order to convert them into a readable form.
I haven't come up with anything better yet.