hessebou Posted July 29, 2019 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?
Moderators JLogan3o13 Posted July 29, 2019 Moderators 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!
Seminko Posted July 29, 2019 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?
Nine Posted July 29, 2019 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... “They did not know it was impossible, so they did it” ― Mark Twain Reveal hidden contents Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Zedna Posted July 30, 2019 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now