Replies: 5 comments
|
Hello @macevhicz, I didn't get to implement the proper API for SysGet. However, you should be able to access it via from ahk.flow import ahk_call
ahk_call("SysGet", "Monitor")It calls the following _SysGet function: AutoHotkey.py/ahkpy/Lib/Commands.ahk Lines 476 to 485 in 17ecfbc |
0 replies
|
Ahh, that'll work. Thank you very much!
Another quick question... I have a script to move the cursor to the center
of my chosen monitor in a multiple monitor setup.
```# Send cursor to center of specified monitor
def sendCursorToCenter(monNum):
numMon = ahk_call("SysGet", "MonitorCount")
print ("numMon: " + str(numMon))
# Bail if the specified monitor doesn't exist.
if monNum > numMon:
return
info = ahk_call("SysGet", "Monitor", monNum)
infoStr = "({}, {}) ({}, {})".format(info["Left"], info["Top"],
info["Right"], info["Bottom"])
print ("\n(x1, y1) (x2, y2): " + infoStr)
x = (info["Left"] + info["Right"]) / 2
y = (info["Top"] + info["Bottom"]) / 2
print ("Center Point (x, y): " + str((x, y)))
ahkpy.mouse_move(x, y, relative_to="screen")
checkPos = ahkpy.get_mouse_pos(relative_to='screen')
print ("checkMousePos: " + str(checkPos))
ahkpy.hotkey("#Numpad1", sendCursorToCenter, 1)
ahkpy.hotkey("#Numpad2", sendCursorToCenter, 2)
ahkpy.hotkey("#Numpad3", sendCursorToCenter, 3)```
It determines the center point correctly, and performs `mouse_move`, but
the cursor goes to the wrong position, and a check of the cursor position
confirms it went to the wrong point. Any idea what I'm doing wrong here?
…On Sun, Jun 5, 2022 at 1:48 AM Sviatoslav Abakumov ***@***.***> wrote:
Hello @macevhicz <https://github.com/macevhicz>, I didn't get to
implement the proper API for SysGet. However, you should be able to access
it via ahk.flow.ahk_call:
from ahk.flow import ahk_callahk_call("SysGet", "Monitor")
It calls the following _SysGet function:
https://github.com/Perlence/AutoHotkey.py/blob/17ecfbc41757e5ba5008dcd157d1528d7b57decd/ahkpy/Lib/Commands.ahk#L476-L485
—
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIFKPVZRDPTVIYOW242ELT3VNRSVFANCNFSM5X37QFYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
0 replies
|
Unfortunately, I haven't worked the multi-monitor setups, but there's this note in the original AHK docs:
You could do the call with ctypes like this: import ctypes
ctypes.windll.user32.SetCursorPos(x, y) |
0 replies
|
Yes, that works. Thanks very much for your help!
And thanks for this package. I love AHK, but find its interface somewhat
cumbersome. It's much nicer to be able to write AHK in python!
Thanks!
…On Sun, Jun 5, 2022 at 12:20 PM Sviatoslav Abakumov < ***@***.***> wrote:
Unfortunately, I haven't worked the multi-monitor setups, but there's this
note in the original AHK docs
<https://www.autohotkey.com/docs/commands/MouseMove.htm#Remarks>:
The following is an alternate way to move the mouse cursor that may work
better in certain multi-monitor configurations:
DllCall("SetCursorPos", "int", 100, "int", 400) ; The first number is the X-coordinate and the second is the Y (relative > to the screen).
You could do the call with ctypes like this:
import ctypesctypes.windll.user32.SetCursorPos(x, y)
—
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIFKPV3SRSQMJS4YATOF4CDVNT4WRANCNFSM5X37QFYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
0 replies
|
Thank you, I appreciate it! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
AutoKeyKey has a comment "SysGet"
https://www.autohotkey.com/docs/commands/SysGet.htm
which facilitates working with monitor (resolution, size, etc). I cannot find Sysget within AutoHotKey.py... Is it available, and if so, how?
All reactions