Mouse Dragging by Winbatch Script
Keywords: mouse drag script
Question:
I have a 3270 emulator consol program that I can capture screen areas manully with a mouse and then copy to clipboard. But Iam unable
to do this in a script..with mouseclick @LCLICK with modifier @LBUTTON and then mousemove..it does not drag a section of the
screen to highlight it for clipboard capture..using keyboard to capture an area is not enabled....this small problem is driving me crazy!...is
there a workaround so that when mousemoves , the left button stays down and drags the area?
Any help would be mightly appreciated.
Answer:
You might be in luck. I did a quick hack to drag the taskbar around, and I used a mouse api function...
Just give this routine (x1, y1) and (x2, y2) (I hope you can find those)
:MouseMove
;all longs
;Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long,
ByVal cButtons As Long, ByVal dwExtraInfo As Long)
;I used mouse_event since the documentation says SendInput requires NT or win98
mouse_eventC = 2 ; ' Event contains mouse event record
MOUSE_MOVED = 1
MOUSEEVENTF_ABSOLUTE = 32768 ;&H8000 ' absolute move
MOUSEEVENTF_LEFTDOWN = 2 ;' left button down
MOUSEEVENTF_LEFTUP = 4 ;' left button up
MOUSEEVENTF_MIDDLEDOWN = 32 ;&H20 ' middle button down
MOUSEEVENTF_MIDDLEUP = 64 ;&H40 ' middle button up
MOUSEEVENTF_MOVE = 1 ;' mouse move
MOUSEEVENTF_RIGHTDOWN = 8 ; ' right button down
MOUSEEVENTF_RIGHTUP = 16 ;&H10 ' right button up
dwData = 0
dwExtraInfo = 0
dllhnd2 = (StrCat(DirWindows(1),"user32.dll"))
dwFlags = MouseEventF_Move | MouseEventF_Absolute
result = DllCall(dllhnd2, long:"mouse_event", Long:dwFlags, Long:x1, Long:y1, Long:dwData, Long:dwExtraInfo)
;message("test", "")
dwFlags = MouseEventF_Move | MouseEventF_LeftDown | MouseEventF_Absolute
result = DllCall(dllhnd2, long:"mouse_event", Long:dwFlags, Long:x2, Long:y2, Long:dwData, Long:dwExtraInfo)
;message("test2", "")
dwFlags = MouseEventF_LeftUp
result = DllCall(dllhnd2, long:"mouse_event", Long:dwFlags, Long:x2, Long:y2, Long:dwData, Long:dwExtraInfo)
RETURN
Article ID: W14627
Filename: Mouse Dragging by Script.txt