Jump to content

Recommended Posts

Hello I got this script works below and I want to do not move cursor on screen when action is performed.

Opt("MouseCoordMode", 1) ; cause it gets whole screen coords
     Local $x, $y
     Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0)
          If $search = 1 Then
             MouseMove($x, $y,0)
             MouseClick("right", $x, $y))
             MouseMove($xMiddle, $yMiddle,0)
             MouseClick("left", $xMiddle, $yMiddle)
          EndIf

I changed this above to this below and what happen is. It clicks right button and then left button but not move mouse to $x $y and then to $xMiddle $yMiddle.

Opt("MouseCoordMode", 1) ; cause it gets whole screen coords
     Local $x, $y
     Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0)
          If $search = 1 Then
             ControlClick("","",0,"secondary",1,$x,$y)
             ControlClick("","",0,"primary",1,$xMiddle,$yMiddle)
          EndIf

If needed I got handle in var $hwnd

Please tell me how parameters in ControlClick would like be

Link to post
Share on other sites
  • Moderators

@Miliardsto the whole point of ControlClick is to interact with the button without the need for the less-reliable MouseMove/MouseClick combo. It sounds as though it is working as you have it written, it clicks the buttons. If you need to move the mouse specifically to a position, you would still need to use the MouseMove line. But I would ask first why you need the mouse to be at that exact position.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By AntS
      Help! The mouse clicks I'm sending to a control on a dialog box produce no response.
      The dialog box in question handles advanced display properties. The tab page my script interacts with is created by Trident Microsystems. It allows the user to enhance or attenuate the screen's RGB values. (See image.) My script automates the process of changing these in order to adjust the screen's hue or, when the red, green and blue values are all the same, the brightness.
      Producing a script to change the brightness has been quite straightforward. I use ControlClick() to send a mouse click to one of the trackbars on the right of the tab page. By default, they're linked and so move as one. The difficulty I'm having however is in automating the process when the desired red, green and blue values aren't the same as each other.
      Ordinarily, there are three ways of doing this: 
      (1) clear the Link check box to unlink the three trackbars then either click on each trackbar or drag their sliders,
      (2) clear the Link tick-box then for each colour, click on the corresponding trackbar slider (to select it) then click on a point on the graph, and
      (3) click on the Load button to open an Open dialog box and load a preset (stored as a .gam file).
      However, when ControlClick() is used to clear the Link check box or to push the Load button, nothing happens. Making the dialog box the active window makes no difference.
      The AutoIt Window Info tool indicates that the Reload a Bitmap, Save, Load and Reset buttons, the Link check box and the graph are all the same control. (See other images.) In fact, it there are only four controls on the page: the tab page, which is an instance of a SysTabControl32 class, and the three trackbars, each of which is an instance of the TridentTrackBar class. (Am unsure whether the SysTabControl32 class is a Windows or third-party control.)
      What's the solution?
      Note that the MouseClick() function—as opposed to ControlClick()—does work, but having AutoIt commandeer the screen pointer isn't an acceptable solution.
      For the sake of completeness, here's the relevant code fragment for the Link check box. 
      ;unlink trackbars WinActivate("(Multiple Monitors)") ControlClick("(Multiple Monitors)", "", 12320, "left", 1, 211, 252)  



    • By TatsuJiN
      Hello. Is it possible to set the mouse move speed to a value between 1 and 2? 
      MouseMove(x, y, 1) is too quick but MouseMove(x, y, 2) is a bit too slow.
      Context:
      My son is playing a single player fishing game and he asked me for help. The faster the mouse cursor moves when casting his "fishing line", the further the fishing line goes. When MouseMove(x, y, 2)  is used, my son is able to move his cursor faster than autoit can. When MouseMove(x, y, 1) is used, the mouse cursor moves too quickly, and the game does not register the mouse move action. I would like to find that "sweet spot" where the mouse moves as quickly as possible, but slow enough to where the game can register that speed.
      I'd love to introduce my son to the power of scripting/programming to further peak his interest in it. Video games can act as a fun platform to do just that.
       
    • By Rskm
      Hi, recently i created a GUI for some calculations in AutoIT.  The GUI has 2 tabs and on the first tab, it has few inputboxes where i use to click with mouse and start entering the inputs. i recently made some changes in the position of these textboxes. I made this by changing the autoit code file instead of making changes in KODA. Now i cannot click inside these textboxes with mouse. However, i can use TAB key to cycle through/enter input in these input boxes. what could have made the inputboxes not responding to mouseclicks. thanks
    • By lunarlattice
      Hi All,
      I am trying to login into our application using AutoIT. When I launch the application a splash screen appears and the login screen goes behind it. At this point the script pauses and I loose control of everything. I have literally tried everything for the past two days but nothing has worked yet. Any suggestions would be appreciated.
      RunWait("\\mchsv411.siplaceworld.net\splmshare\int00\conf\start_apps\windows\start_nx110.bat en portal_client int00 tc112", "", @SW_MAXIMIZE)
      AutoItSetOption("SendKeyDelay", 200)
      Local $hWnd = WinWaitActive("Teamcenter Login")
      MouseClick("left", @DesktopWidth / 2, @DesktopHeight / 2)
      The splash screen has title "Teamcenter" and is static.
      I tried to click on the center to get control of login window.
      I have tried WinActivate, WinSetState, ControlCommand and a lot of other things.
    • By lonardd
      Hi,
      I have a very strange problem concerning MouseClick function.
      I need to start Control Panel, navigate it on the Display Section (Adjust screen resolution link), click on it, and from the next Dialog choose Intel Graphic tool tab and navigate into it when it opens. 
      I wasn't using MouseClick() at first when I tried to use Control IDs, but I was fed up with the Autoit Window Info poor and inaccurate info (It flickers and the moment I click on the control the control ID and class disappear) so I ended up choosing the easiest way.
      The code I'm posting worked OK until two weeks ago, the mouse clicks were accurately performed and the Script reached the end with no errors...and I was happy.
      All of a sudden, between one try and the other, I noticed the cursor not flying exactly where it was supposed to, namely to the Control Panel ->Display->Adjust screen resolution link   but it clicked some 30 pixels below and some 30 pixels to the left, choosing obviously and undesired function and from that point it screwed the whole thing up. And from that moment onward, it seems I can no longer regain the mouse to click on that sequence.
      Could it be because my Control Panel ->Display form moved slightly from one test to another and therefore I got that small offside?
      If you believe this is the reason, I should then re position the Control Panel ->Display window to 0,0 and recalculate all the clicks. 
      do you have a suggestion?
       
      Thanks a lot
      Dave
       
       
       
      RotateDisplays.au3
×
×
  • Create New...