hessebou 0 Posted July 29, 2019 Hello, in Windows is an option, that let you move your cursor with the numeric keypad. i set it up and it works, when i press the numeric keys on my physical keyboard then my cursor moves. but if i try to do it via autoit for example send (" {NUMPAD8} ") instead the cursor is moving, a 8 was typed. so whats wrong here? shouldnt it be the same as the physical keystroke? Share this post Link to post Share on other sites
JLogan3o13 1,639 Posted July 29, 2019 @hessebou you can probably do this with hotkeyset, but can you please explain more about what you are trying to accomplish? There is undoubtedly a better way. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Share this post Link to post Share on other sites
Seminko 11 Posted July 29, 2019 I'm probably missing something but if you want to automate mouse movement using AutoIt, why not use MouseMove / MouseClick directly? Share this post Link to post Share on other sites
Nine 995 Posted July 29, 2019 I don't think he wants to move mouse but move carret. I tested it and it is true that it will send an 8 no matter what numlock is. Not sure but it might be considered as a bug... Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Multi-keyboards HotKeySet Fast and simple WCD IPC Multiple Folder Selector GIF Animation (cached) Share this post Link to post Share on other sites
Zedna 280 Posted July 30, 2019 Look at HotKey UDF here Or you can use keybd_event directly through DllCall like in this example: expandcollapse popup#Include 'HotKey.au3' #Include 'vkConstants.au3' HotKeySet('{Esc}', '_Quit') _HotKeyAssign(BitOR($CK_WIN, $VK_L), 'ScreenSaver') While 1 Sleep(10) WEnd Func ScreenSaver() Local Const $SC_SCREENSAVE = 0xF140 Local $Timer = TimerInit() DllCall('user32.dll', 'int', 'LockWorkStation') Do Sleep(10) If TimerDiff($Timer) > 1000 Then Return EndIf Until _IsWorkstationLocked() _SendMessage(_WinAPI_GetDesktopWindow(), $WM_SYSCOMMAND, $SC_SCREENSAVE, 0) While _IsWorkstationLocked() Sleep(10) WEnd DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_L, 'int', 0, 'int', 2, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_LWIN, 'int', 0, 'int', 2, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_RWIN, 'int', 0, 'int', 2, 'ptr', 0) EndFunc ;==>ScreenSaver Func _IsWorkstationLocked() Local Const $DESKTOP_SWITCHDESKTOP = 0x0100 Local $Result = False $hDesktop = DllCall('user32.dll', 'hwnd', 'OpenDesktop', 'str', 'Default', 'int', 0, 'int', 0, 'int', $DESKTOP_SWITCHDESKTOP) If Not @error Then $Result = DllCall('user32.dll', 'int', 'SwitchDesktop', 'hwnd', $hDesktop[0]) $Result = Not $Result[0] DllCall('user32.dll', 'int', 'CloseDesktop', 'hwnd', $hDesktop[0]) EndIf Return $Result EndFunc ;==>_IsWorkstationLocked Func _Quit() Exit EndFunc ;==>_Quit Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites