Iam more from the Microsoft Power Automate Area, so basics are here but not much. Did already some search on the v2 Boards, but getting lost with all the other Topics, so i try it with some basics.
The Script has already been working in V1, but it was converted to V2 (because i dont know)
Code: Select all
HasVal(haystack, needle) {
if !(IsObject(haystack)) || (haystack.Length = 0)
return 0
for index, value in haystack
if (value = needle)
return index
return 0
}
class Button {
__New(pos1,pos2){
this.pos1 := pos1
this.pos2 := pos2
this.center := this._getCenter()
}
_getCenter(){
x := this.pos1["x"] + ((this.pos2["x"] - this.pos1["x"]) / 2)
y := this.pos2["y"] + ((this.pos1["y"] - this.pos2["y"]) / 2)
return {x:x,y:y}
}
print(){
MsgBox("this.pos1[`"x`"] this.pos1[`"y`"]")
}
isExists(){
color1 := PixelGetColor(this.pos1["x"], this.pos1["y"], )
color2 := PixelGetColor(this.pos2["x"], this.pos2["y"], )
return hasVal(this.pos1["colors"], color1) or hasVal(this.pos2["colors"], color2)
}
click(){
MouseClick("left", this.center["x"], this.center["y"], , 0)
}
}
startBMD := Button({x: 346,y: 639,colors: [0xF57000 , 0xFF7500]}, {x: 351,y: 631,colors: [0xF59808, 0xFF9E08]})
NTCS := Button({x: 244,y: 621,colors: [0x232339 , 0x232339]}, {x: 453,y: 278,colors: [0x4EAA94, 0x4EAA94]})
Why should i need an Item?
The reason behind all this is to use a class for different Calls with different Color Pickers.
I personally would prefer some kind of imagesearch, but well, first Babysteps.
would be nice if somebody tell me what iam doing wrong and where to find the correct Infos.