Jump to content

Toggle for left mouse clicking


Wraithmere
 Share

Recommended Posts

Hi all,

First post! Am trying to automate a repetitive task. When using creating blend, speckle and other effects in Photoshop and similar I'm often left clicking hundreds of times. I want to automate this by having the left mouse button click as fast as possible when held down.

The script below works but left clicking is not yet being toggled by mousedown (left). I've tried various methods of acheiving that but none have worked.

WARNING - running this script as it is can result in uncontrollable left clicking!

Script to date...

HotKeySet("^+s","_Start")

HotKeySet("^+p","_Pause")

HotKeySet("^+e","_Terminate")

;Determine if user has swapped right and left mouse buttons

$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

; It's okay to NOT check the success of the RegRead operation

If $k = 1 Then

$primary = "right"

Else;normal (also case if could not read registry key)

$primary = "left"

EndIf

While 1

Sleep(200)

WEnd

Exit

Func _Start()

While 1

MouseClick($primary)

WEnd

EndFunc

Func _Pause()

While 1

Sleep(200)

WEnd

EndFunc

Func _Terminate()

Exit

EndFunc

Link to comment
Share on other sites

Hi all,

First post! Am trying to automate a repetitive task. When using creating blend, speckle and other effects in Photoshop and similar I'm often left clicking hundreds of times. I want to automate this by having the left mouse button click as fast as possible when held down.

The script below works but left clicking is not yet being toggled by mousedown (left). I've tried various methods of acheiving that but none have worked.

WARNING - running this script as it is can result in uncontrollable left clicking!

Script to date...

HotKeySet("^+s","_Start")

HotKeySet("^+p","_Pause")

HotKeySet("^+e","_Terminate")

;Determine if user has swapped right and left mouse buttons

$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

; It's okay to NOT check the success of the RegRead operation

If $k = 1 Then

$primary = "right"

Else;normal (also case if could not read registry key)

$primary = "left"

EndIf

While 1

Sleep(200)

WEnd

Exit

Func _Start()

While 1

MouseClick($primary)

WEnd

EndFunc

Func _Pause()

While 1

Sleep(200)

WEnd

EndFunc

Func _Terminate()

Exit

EndFunc

There is nothing really wrong, with you code. Great job! :) Some problems I forsee could be exiting the click loop... I might work up a quick example of how i would do it later, and Ctrl+Shift+S is probably being used already as a hotkey. Try changing it to see if it works ;)
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...