Application that does not accept AutoHotKey Mouse Clicks

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MohamedZaky
Posts: 1
Joined: 17 Feb 2023, 16:56

Application that does not accept AutoHotKey Mouse Clicks

Post by MohamedZaky » 17 Feb 2023, 17:05

Hello Guys,
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
	}

}

I also tried to make a simple application which only when i press ctrl+q it should press double left click on the mouse, it works everywhere except inside the window of thinkorswim application.

Did anybody face an issue like that before? is there any solution for that ?

gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: Application that does not accept AutoHotKey Mouse Clicks

Post by gregster » 17 Feb 2023, 17:10

Usually it's a permissions issue - meaning that your application is running with admin rights while your script runs un-elevated:
See https://www.autohotkey.com/docs/v1/FAQ.htm#uac

gmoises
Posts: 75
Joined: 18 Nov 2017, 16:43

Re: Application that does not accept AutoHotKey Mouse Clicks

Post by gmoises » 18 Feb 2023, 12:42

I suggest you to read carefully the Click command section in the documentation, there are some options and related commands that may solve your issue.
https://www.autohotkey.com/docs/v1/lib/Click.htm

Post Reply

Return to “Ask for Help (v1)”