Jump to content

Sending clicks to not focused windows


Newb
 Share

Recommended Posts

Hi, I was wondering if it was possible to send clicks to an application which is not focused.

Example. I want autoit to do a repetive task for me in a program like Excel, 3D Studio Max or a game or whatever you like, while I am watching a movie fullscreen or reading or playing something.

Mouseclick needs windows to be focused. I heard that ControlClick might be the solution, but I'm waiting for any advice by anyone more expert than me.

Basically, I think you got what I need, a program able to send clicks or keystrokes to a not focused program while I am doing something else. Any chanche to do this?

Thanks again

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

So those 2, do all the work in every software?

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

So those 2, do all the work in every software?

Not all. Use the 'AutoIt Window Info' tool, on the control you wish to automate. If 'AutoIt Window Info' returns data on the control, you should'nt have any problems using those 2 functions in your project.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

It seems i found what I needed.

Thats what I needed because I had the same problem he wrote that for. Great stuff there.

Last question.

If some more expert coder can explain me also briefly how that code works (no need instructions, just want to know how to write similar things, understand it, and learn to do stuff myself with dll's and so on). I do accept brief or longer explanations, mostly for the DllCall part, because I more or less got the first part.

Correct me if wrong:

Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
    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

    If $X = "" OR $Y = "" Then
       $MouseCoord = MouseGetPos()
       $X = $MouseCoord[0]
       $Y = $MouseCoord[1]
    EndIf

Here he defines actions with hex offsets registered in windows (never know this deep code, i just know that each of those 0x0002, 3 4 or so correspond to an action. So i guess 0x0002 is right button click hold down, 0x0204 is click down and so on (guessing from name he gave to it). Would like a clarification here too.

After with the If he fills mouse coords if use called function with those parameters empty with current mouse position.

Then? Just getting a little grasp on those dllcalls. I know they call some windows dll with some control functions over software, but I would like to get more in deep.

Thanks to all this awesome community. Merry Xmas to all!

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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