Playing game on first monitor - is it possible to do commands on second monitor?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sjdheunaskdf9384348
Posts: 14
Joined: 29 Dec 2015, 16:52

Playing game on first monitor - is it possible to do commands on second monitor?

30 Jan 2016, 16:30

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?
User avatar
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?

01 Feb 2016, 13:14

Hi sjdheunaskdf9384348,

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.
sjdheunaskdf9384348
Posts: 14
Joined: 29 Dec 2015, 16:52

Re: Playing game on first monitor - is it possible to do commands on second monitor?

02 Feb 2016, 12:35

Hey lifeweaver, thanks for the reply!

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
	}
It works even when my game is windowed, borderless, and even fullscreen!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: big-jg, Bing [Bot], Google [Bot], JnLlnd and 202 guests