Jump to content

Recommended Posts

Posted (edited)

Hello

i want to do some few shortcut actions when some keys are pressed

however this doesnt work if i have any window open :[

so how do i do something like this in background?

MouseMove (,,)

MouseDown ()

MouseMove (,,)

MouseUp ()

hope someone can help

Edited by klukkluk
Posted (edited)

Hello

i want to do some few shortcut actions when some keys are pressed

however this doesnt work if i have any window open :[

so how do i do something like this in background?

MouseMove (,,)

MouseDown ()

MouseMove (,,)

MouseUp ()

hope someone can help

See help file for Mouse functions : MouseMove, MouseClick, MouseDown, MouseUp

and _IsPressed...

Be more precise, what action do you want to do ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted

what i got now is ControlClcik (windowtitle, left, x, y,)

but i cant write Controlclick (windowtitle, mousedownleft, x, y)

HelpFile :

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

I don't see the "text" and controlID part...

Use autoitWindowinfo tool for get them ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted

HelpFile :

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

I don't see the "text" and controlID part...

Use autoitWindowinfo tool for get them ! Posted Image

but my script moves the mouse to a postion and then holds down the left mouse button, then moves to another position and the realeses the left mousebutton, cant get controlclick to make that work :/

  • Moderators
Posted

klukkluk,

my script moves the mouse to a postion and then holds down the left mouse button, then moves to another position and the realeses the left mousebutton, cant get controlclick to make that work

Quite correct - but did you look at the Mouse commands in the Help file? :x

Perhaps not or MouseClickDrag might have seemed something to try! :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

but my script moves the mouse to a postion and then holds down the left mouse button, then moves to another position and the realeses the left mousebutton, cant get controlclick to make that work :/

There isnt a way I have found to do what you want, I have tried in the past, and failed.

I'm not suggesting it is impossible, rather trying to save you wasting time, I have searched the forums from top to bottom, quite some time back and come up blank.

I also tried _WinAPI_Mouse_Event() messages unsuccessfully.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

  • Moderators
Posted

JohnOne,

Did you see my post above? :x

MouseClickDrag does exactly that - here it is moving the GUI: :P

#include <GuiConstantsEx.au3>

$hGUI = GUICreate("Test", 300, 200)
GUISetState()

Sleep(1000)

$aPos = WinGetPos($hGUI)
MouseClickDrag("primary", $aPos[0] + 100, $aPos[1] + 10, $aPos[0] + 250, $aPos[1] + 250, 25)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Yes M23, I did see it, but I think the author if after something else (with mentioning background)

The way I understand it, as ControlClick is to MouseClick, the OP is would be wanting ControlClickDrag, kind of emulating MouseClickDrag, but without the Apparent moving of the mouse.

Although I have been known to interpret a question incorrectly in the past. :x

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

I believe that the OP wants to manipulate background windows with mouse movements without interfering with their foreground.

IE: Your computer will play minesweeper while you browse the internet on Google chrome.

I know how to automate multiple windows using http://cpnmouse.sourceforge.net/ and having multiple cursors, but as far as I know, you can only operate the mouse on one layer with autoit.

so in other words, it WILL inter fear with what you are already working with.

  • 1 year later...
Posted

I know this is a necropost, but here you go. Helped me a lot.

Func ControlClickDrag($wHandle, $Button="left", $X1="", $Y1="", $X2="", $Y2="")
   Local $MK_LBUTTON  = 0x0001
   Local $WM_LBUTTONDOWN  = 0x0201
   Local $WM_LBUTTONUP  = 0x0202
   Local $MK_RBUTTON  = 0x0002
   Local $WM_RBUTTONDOWN  = 0x0204
   Local $WM_RBUTTONUP  = 0x0205
   Local $WM_MOUSEMOVE  = 0x0200
   Local $i = 0

   Select
 Case $Button = "left"
$Button  = $MK_LBUTTON
$ButtonDown  = $WM_LBUTTONDOWN
$ButtonUp  = $WM_LBUTTONUP
 Case $Button = "right"
$Button  = $MK_RBUTTON
$ButtonDown  = $WM_RBUTTONDOWN
$ButtonUp  = $WM_RBUTTONUP
   EndSelect

   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X1, $Y1))
   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X2, $Y2))
EndFunc



Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
  • 4 years later...
Posted
On 28/4/2012 at 1:56 AM, TFransen said:

I know this is a necropost, but here you go. Helped me a lot.

 

 

Func ControlClickDrag($wHandle, $Button="left", $X1="", $Y1="", $X2="", $Y2="")
   Local $MK_LBUTTON  = 0x0001
   Local $WM_LBUTTONDOWN  = 0x0201
   Local $WM_LBUTTONUP  = 0x0202
   Local $MK_RBUTTON  = 0x0002
   Local $WM_RBUTTONDOWN  = 0x0204
   Local $WM_RBUTTONUP  = 0x0205
   Local $WM_MOUSEMOVE  = 0x0200
   Local $i = 0

   Select
 Case $Button = "left"
$Button  = $MK_LBUTTON
$ButtonDown  = $WM_LBUTTONDOWN
$ButtonUp  = $WM_LBUTTONUP
 Case $Button = "right"
$Button  = $MK_RBUTTON
$ButtonDown  = $WM_RBUTTONDOWN
$ButtonUp  = $WM_RBUTTONUP
   EndSelect

   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X1, $Y1))
   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X2, $Y2))
EndFunc



Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

I tried but it did not work

Posted

You necroposted a necropost to tell the user, who hasn't been here in 4 years, that it didn't work, but completely failed to say what didn't work. Also you didn't show what your script looks like so no one will be able to help you.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted
On 14/6/2016 at 9:39 AM, BrewManNH said:

Bạn necroposted một necropost để nói cho người dùng, người đã không được ở đây trong 4 năm, nó đã không làm việc, nhưng hoàn toàn không nói gì không làm việc. Ngoài ra bạn không hiển thị những gì kịch bản của bạn trông giống như vậy sẽ không có ai có thể giúp bạn.

I just want a func like ControlClickDrag

  • Developers
Posted
3 hours ago, ntprohd said:

I just want a func like ControlClickDrag

That doesn't tell us anything. What is it you want to do and what isn't working for you in the example posted in this thread?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

I tried to drag the mouse up and down while using
"Func ControlClickDrag" TightVNC Viewer window but it did not work, who can give me a complete example. thank you very much.

 

#include <SendMessage.au3>
#Include <WinAPI.au3>

Global $wHandle = "iPhone - TightVNC Viewer"

ControlClickDrag($wHandle,"left",100,500,100,80)

Func ControlClickDrag($wHandle, $Button="left", $X1="", $Y1="", $X2="", $Y2="")
   Local $MK_LBUTTON  = 0x0001
   Local $WM_LBUTTONDOWN  = 0x0201
   Local $WM_LBUTTONUP  = 0x0202
   Local $MK_RBUTTON  = 0x0002
   Local $WM_RBUTTONDOWN  = 0x0204
   Local $WM_RBUTTONUP  = 0x0205
   Local $WM_MOUSEMOVE  = 0x0200
   Local $i = 0

   Select
 Case $Button = "left"
$Button  = $MK_LBUTTON
$ButtonDown  = $WM_LBUTTONDOWN
$ButtonUp  = $WM_LBUTTONUP
 Case $Button = "right"
$Button  = $MK_RBUTTON
$ButtonDown  = $WM_RBUTTONDOWN
$ButtonUp  = $WM_RBUTTONUP
   EndSelect

   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X1, $Y1))
   DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X2, $Y2))
EndFunc

Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

 

Edited by ntprohd
  • Developers
Posted

Looks like you are using a window handle as control handle?
What does Au3Info tell you for the control you are trying to drag&Drop?
by the way: Doubt that this will work on a VNC sessions as that probably is very graphical, but not sure.

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
4 hours ago, Jos said:

Looks like you are using a window handle as control handle?
What does Au3Info tell you for the control you are trying to drag&Drop?
by the way: Doubt that this will work on a VNC sessions as that probably is very graphical, but not sure.

Jos 

Here is what I get from Au3Info

Untitled.png

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...