cageman Posted October 28, 2019 Posted October 28, 2019 (edited) Hi, I am trying to send press shift down to an inactive window and afterwards left clicking the mouse. The window has no controls, hence i send a ControlClick without controls. ControlSend($hwdn, "", "", "{SHIFTDOWN}") Sleep(500) ControlClick($hwdn, "", "", "Left", 1, 401, 307) This sometimes works, sometimes doesn't, it seems to depend on the internal state of the window, i really don't know. What does fix it is activating the window manually, pressing shift shortly (sometimes takes a few tries, but typically 1) and then deactivating the window and executing the above code again. At some point it breaks again and i have to repeat the manual intervention (i know i could script activating the window, but i would like to do it in the background). Also, this works fine for other interactions, but the shift down seems to be something special. Sending text and what not works fine. Anyone has a clue what could be going on here? I have also been playing around with the _SendMessage function, but that doesn't seem to register the shift down event at all. Func WindowClick_ShiftDown_Plus($hwnd,$x,$y) Local $WM_MOUSEMOVE = 0x0200 Local $VK_LSHIFT = 0xA0 Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local Const $WM_KEYDOWN = 0x0100 Local Const $WM_KEYUP = 0x0101 _SendMessage($hWnd, $WM_KEYDOWN, $VK_LSHIFT, 0) Sleep(100) _SendMessage($hwnd, $WM_LBUTTONDOWN, $MK_LBUTTON, _WinAPI_MakeLong($x, $y)) Sleep(50) _SendMessage($hwnd, $WM_LBUTTONUP, $MK_LBUTTON, _WinAPI_MakeLong($x, $y)) Sleep(100) _SendMessage($hWnd, $WM_KEYUP, $VK_LSHIFT, 0) EndFunc Thanks for any help! Edited October 28, 2019 by cageman
Nine Posted October 28, 2019 Posted October 28, 2019 hmmm, what is the application you are trying to automate this way ? I am sure there is a better solution... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler 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
cageman Posted October 29, 2019 Author Posted October 29, 2019 (edited) 18 hours ago, Nine said: hmmm, what is the application you are trying to automate this way ? I am sure there is a better solution... internal application of a client, but its a shortcut in the application that cannot be changed, that is for sure. Edited October 29, 2019 by cageman
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