Monday, June 15, 2015

AutoHotkey - Improved Script

Here's an automated GUI test script using objects, coordinates, values, for each loop and if condition.

Numpad1 & Numpad2::

IfWinExist TradingApp
{

;;Activate window
WinActivate

;Create coordinates data
CoList :={}
CoListCount = 6

Loop, % CoListCount 
   CoList[A_Index] := {} 

CoList.1 := {X: "268", Y: "189", Val: ""}
CoList.2 := {X: "255", Y: "111", Val: ""}
CoList.3 := {X: "441", Y: "155", Val: ""}
CoList.4 := {X: "146", Y: "396", Val: "Risky Accounts"}
CoList.5 := {X: "500", Y: "249", Val: "27029445{Enter}"}
CoList.6 := {X: "500", Y: "249", Val: "27029000-28029000{Enter}"}


for each, co in CoList 


    Sleep 1000

    val := co.Val
    MouseClick,Left,co.X, co.Y
    if(val)
    {
      Send, %val%
    }
}
}

Return

Esc::ExitApp
Return

No comments :