Hello, I recently set up a script that is running really well while I don't have games running.
Basically, it runs ImageSearch on my secondary monitor, and when it finds a match it clicks on a random spot over there.
However, if I am playing a game, the script isn't able to move the mouse to my secondary monitor and click. I tried with Fullscreen, Borderless, and Windowed.
I just ran a test to see if the image is being found (using MsgBox) and apparently the image is found on the secondary monitor while I have the game running.
Because of that, I believe the issue is just moving the actual mouse to the secondary monitor and completing the action.
I was searching earlier, and found old threads that were the opposite situation (using computer to browse etc, and wanted autohotkey to input to a game on second monitor). They had mentioned using ControlClick and such, but that there wasn't much of a solution.
Any suggestions?
---EDIT--- While we're at it, is there a way to run a second mouse without using a VM? Meaning, I use one mouse, and the autohotkey script uses the other?
Playing game on first monitor - is it possible to do commands on second monitor?
-
- Posts: 14
- Joined: 29 Dec 2015, 16:52
- lifeweaver
- Posts: 144
- Joined: 10 May 2014, 05:57
- Location: OH
- Contact:
Re: Playing game on first monitor - is it possible to do commands on second monitor?
Hi sjdheunaskdf9384348,
Sounds like ControlClick is exactly what you need.
Sounds like ControlClick is exactly what you need.
AutoHotkey Help file ControlClick examles wrote: ControlClick, OK, Some Window Title ; Clicks the OK button
ControlClick, x55 y77, WinTitle ; Clicks at a set of coordinates. Note the lack of a comma between X and Y.
; The following method may improve reliability and reduce side effects:
SetControlDelay -1
ControlClick, Toolbar321, WinTitle,,,, NA x192 y10 ; Clicks in NA mode at coordinates that are relative to a named control.
-
- Posts: 14
- Joined: 29 Dec 2015, 16:52
Re: Playing game on first monitor - is it possible to do commands on second monitor?
Hey lifeweaver, thanks for the reply!
I ended up doing this:
It works even when my game is windowed, borderless, and even fullscreen!
I ended up doing this:
Code: Select all
searchForImage()
if ErrorLevel = 0
{
Random, smallRoll, 3000, 4000
Random, bigRoll, 25000, 30000
KeyWait Home
BlockInput, On
WinActivate, Browser Window Name Here
MouseMove, %xMove%, %yMove%
sleep, smallRoll
Click, %xMove%, %yMove%
BlockInput, Off
sleep, bigRoll
Goto outer
}
Who is online
Users browsing this forum: balawi28, Bing [Bot], Chunjee, moltenchees and 270 guests