I have been struggling with this issue using AutoHotKey to automate button clicks inside application called "ThinkOrSwim" , What i am trying to do is that when a value inside a specific Cell in Excel changes to "Trigger" value, it should go to ThinkOrSwim application and goes to the position of specific button and press it. so the program works and it goes to the program and go to the position of the button but it doesn't click the button (I even added a MsgBox after Clicking to make sure it doesn't skip the click line). I used the following code:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
CoordMode, Mouse, Screen
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
MsgBox Program Started
FileSelectFile, Path
Excel := ComObjCreate("Excel.Application")
Excel.visible := True
Workbook := Excel.Workbooks.Open(Path, 0, False)
Worksheet := Workbook.Sheets("Sheet1")
OldValue := Worksheet.Range("A1").Value
NewValue := 0
Triggered := False
While (true) {
try {
NewValue := Worksheet.Range("A1").Value
If (NewValue == "Trigger" and !Triggered) {
WinActivate, ahk_exe thinkorswim.exe
Sleep, 1000
Click, 1488 100,
NewValue := 0
Triggered := True
} Else if ( NewValue != "Trigger"){
Triggered := False
}
} catch e {
; Log the error message
;FileAppend, % "Error: " . e . "\n", error.log
}
}
Did anybody face an issue like that before? is there any solution for that ?