Posts: 576
Threads: 97
Joined: Aug 2007
07-25-2018, 05:44 PM
(This post was last modified: 07-25-2018, 05:44 PM by QM_Expert.)
is it possible to use lef in two different locations at the same time?
see example below, it presses down, waits 3 seconds, and releases mouse
can this be done in multiple locations simultaneously? maybe with command other then lef? needs to press down on mouse wait 3 seconds, then release mouse.
Macro
Macro1
int w=win("Program Manager" "Progman")
lef+ 345 597 w 1 ;;list 'Desktop', list item 'SONJ MESH PRINT'
3
lef-
Posts: 12,092
Threads: 142
Joined: Dec 2002
Probably not. The target window would see it as a mouse drag operation.
Posts: 576
Threads: 97
Joined: Aug 2007
is there an alternate to lef that emulates mouse down and up using screen coordinates?
Posts: 12,092
Threads: 142
Joined: Dec 2002
Use PostMessage with WM_LBUTTONDOWN and WM_LBUTTONUP. Works not with all windows/controls. Documented in MSDN.
Posts: 576
Threads: 97
Joined: Aug 2007
07-25-2018, 08:49 PM
(This post was last modified: 07-25-2018, 09:03 PM by QM_Expert.)
Not sure if possible in virtual machine?
for context:
end goal; send click command in same exact location on multiple virtual machine instances simultaneously.
Posts: 12,092
Threads: 142
Joined: Dec 2002
Function
PostLeftClickMessage
;/
function w x y [flags] ;;flags: 1 down only, 2 up only, 4 activate window, 8 move mouse
;Posts message WM_LBUTTONDOWN and/or WM_LBUTTONUP to window w or its child control at that point.
;w - window or control.
;x, y - point coordinates in w client area.
;REMARKS
;It is an alternative to lef. With some windows works even if the window is not active.
;Works not with all windows/controls. Try flag 4 or/and 8.
;Does not wait until the window receives and processes the message.
;EXAMPLE
;int w=win("Notepad")
;PostLeftClickMessage(w 10 10)
if(w=0) end ERR_WINDOW
if(flags&4) act w
if(flags&8) mou x y w 1
int w1=child(x y w 8); err
if(w1) MapWindowPoints(w w1 +&x 1); w=w1
int lparam=MakeInt(x y)
if(flags&2=0) PostMessage w WM_LBUTTONDOWN MK_LBUTTON lparam
if(flags&1=0) PostMessage w WM_LBUTTONUP 0 lparam
Posts: 576
Threads: 97
Joined: Aug 2007
thank you very nice function
sadly, does not work in virtual machine window
Posts: 576
Threads: 97
Joined: Aug 2007
Any other possible solution for clicking inside virtual machine without using mouse?
Posts: 12,092
Threads: 142
Joined: Dec 2002
Run QM in virtual machine. I don't know more solutions.