Hello.
The last script I shared was wrong, because I did not know very well how the conditional worked in Autohotkey. Two conditional were executed, one behind another. As I have studied philosophy (logic), I went to bed knowing about the problem and thinking how to solve it. Four conditions are given for each key pulsed:
As I do not want to deepen more about the conditional, this script works (use this script with the FastKey program, in four separate scripts and this is fine).
Code: Select all
NumpadHome::
CoordMode, Mouse
MouseGetPos, xpos, ypos
WindowName := "ahk_exe PotPlayerMini64.exe"
if !WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+8, "int", Y+1)
; MsgBox, without PotPlayer, Monitor 1
Click, Down
}
if !WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+8, "int", Y+2)
Click, Down
; MsgBox, without PotPlayer, Monitor 2
}
if WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X, "int", Y+1)
Click, Down
; MsgBox, with PotPlayer, Monitor 1
}
if WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X, "int", Y)
Click, Down
; MsgBox, with PotPlayer, Monitor 2
}
;----------------
NumpadPgUp::
CoordMode, Mouse
MouseGetPos, xpos, ypos
WindowName := "ahk_exe PotPlayerMini64.exe"
if !WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+W-4, "int", Y)
Click, Down
}
if !WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+W-5, "int", Y+2)
Click, Down
}
if WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+W-4, "int", Y)
Click, Down
}
if WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+W-6, "int", Y)
Click, Down
}
;----------------
NumpadPgDn::
CoordMode, Mouse
MouseGetPos, xpos, ypos
WindowName := "ahk_exe PotPlayerMini64.exe"
if !WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", W+X-12, "int", Y+H-12)
Click, Down
}
if !WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", W+X-12, "int", H+Y-10)
Click, Down
}
if WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", W+X-4, "int", Y+H-4)
Click, Down
}
if WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", W+X-4, "int", H+Y-6)
Click, Down
}
;----------------
NumpadEnd::
CoordMode, Mouse
MouseGetPos, xpos, ypos
WindowName := "ahk_exe PotPlayerMini64.exe"
if !WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+5, "int", Y+H-10)
Click, Down
}
if !WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+5, "int", Y+H-10)
Click, Down
}
if WinActive(WindowName) and xpos < 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+6, "int", Y+H-6)
Click, Down
}
if WinActive(WindowName) and xpos > 3840
{
WinGetPos, X, Y, W, H, A
DllCall("SetCursorPos", "int", X+3, "int", Y+H-6)
Click, Down
}
Return
(On the "NumPadhome" key, i placed AutohotKey put messages, to see that the conditional functioned.)
Teadrinker, your first scripts worked down, on the right and left, but none of the two positions above.