Left click mouse trigger... can it be done?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
arobin4
Junior Coder
Posts: 33
Joined: Sat Apr 07, 2012 5:41 am

Left click mouse trigger... can it be done?

Post by arobin4 » Mon Dec 29, 2014 7:10 pm

Hello Forum:

I need my script to execute "some action" whenever I left-click my mouse button. It does not matter where I click. All that matters is that the left-click button was pressed. Is there a way to do that?

Thanks and Happy New Year in advance!

Aaron

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Left click mouse trigger... can it be done?

Post by JRL » Mon Dec 29, 2014 9:27 pm

Code: Select all

OnEvent>key_down,VK1,0,Click

Let>ClickFlag=0
Let>ClickCount=0

Label>Loop
Wait>0.01
If>ClickFlag>0
  Add>ClickFlag,1
  If>ClickFlag=4
    Let>ClickFlag=0
  EndIF
EndIf
Goto>Loop

SRT>Click
  If>ClickFlag>0
    Let>ClickFlag=1
  Else
    Let>ClickFlag=1
    Add>ClickCount,1
    //The next line would be replaced with the lines of code you want to run each click.
    Message>Click Count = %ClickCount%
  EndIf
END>Click

arobin4
Junior Coder
Posts: 33
Joined: Sat Apr 07, 2012 5:41 am

Re: Left click mouse trigger... can it be done?

Post by arobin4 » Mon Dec 29, 2014 10:28 pm

Awesome! Thanks JRL this is what I was looking for.
Have a Happy New Year.

Aaron

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts