I've experienced this issue with my bot script. First, I have this, there are a few checks, as I'm using pixelsearch I need to make sure the screen resolution is the correct dimensions for it to be accurate... but really I'm setting the active_id
checkWindow(byref active_id){
width := 816
height := 639
WinGet id, ID, Toontown Rewritten [BETA]
active_id := id
IfWinExist, Toontown Rewritten [BETA]
{
WinActivate ; use the window found above
WinGetPos,winX,winY,curWidth,curHeight
if(curWidth != width || curHeight != height)
WinMove, Toontown Rewritten [BETA], , , , width, height
return true
}
else{
TrayTip TTR Tools, "Toontown Application not open", 1, 1
guiText("txt", "Toontown not open")
exitGardening()
return false
}
}
Then, for controlclick, I do this:
safeClick(x,y){
checkWindow(active_id)
MouseGetPos, mouseX, mouseY
if((mouseX >= 0 && mouseX <= 816) && (mouseY >= 0 && mouseY <= 639))
MouseMove, x, y
sleep,25
ControlClick,X%x% Y%y%,ahk_id %active_id%,,,1, NA
ControlSend,, {Ctrl},ahk_id %active_id%
}
and controlsend
checkWindow(active_id)
ControlSend,, {Left DOWN},ahk_id %active_id%
Sleep 1337
ControlSend,, {Left UP},ahk_id %active_id%