Closed fssdfhsdfsdk closed 9 months ago
Hmm. Retrieving this value isn't part of the public API. Though, it might be something that is added in the future.
In the meantime, you can use run_script
or writing an extension as a workaround.
This is a bit verbose, but should work in both v1 and v2 versions of AHK. The script could be less verbose if you knew the AHK version ahead of time.
from ahk import AHK
ahk = AHK()
cursor = ahk.run_script('''\
value = Format("{}", A_Cursor)
filename := "*"
encoding := "UTF-8"
mode := "w"
stdout := FileOpen(filename, mode, encoding)
stdout.Write(value)
stdout.Read(0)
''')
print(cursor)
# Arrow
For AHK doc:
https://www.autohotkey.com/docs/v1/Variables.htm#Cursor
A_Cursor | The type of mouse cursor currently being displayed. It will be one of the following words: AppStarting, Arrow, Cross, Help, IBeam, Icon, No, Size, SizeAll, SizeNESW, SizeNS, SizeNWSE, SizeWE, UpArrow, Wait, Unknown. The acronyms used with the size-type cursors are compass directions, e.g. NESW = NorthEast+SouthWest. The hand-shaped cursors (pointing and grabbing) are classified as Unknown.