Jump to content

left mouse click initiated key press


Recommended Posts

Hello there,

I've just recently came around to AutoIt. I'm trying to get a macro going that will keep pressing a designated key as long as I hold down the left mouse button.

Here's the code I've got

#Include <Misc.au3>
While 1
If _IsPressed("01") Then
  Do
   Send("Z")
  Until not _IsPressed("01")
EndIf
WEnd

Now all that works perfect, but only in autoit editor. If I try that in notepad for example, the macro will run, but the Z key will not be pressed ( checked with a simple tooltip addon).

Initially I wanted the macro to keep repeating the left mouse click itself as long as I held it down (like the good old autofire on some gamepads), but that just caused the macro to stop after 1 cycle, so I moved on.

Any ideas?

Edited by SomethingAwful
Link to comment
Share on other sites

well this is the auto clicker,

i suggest you try it in the script editor first, you will see it working, but be very carefull what you click on the desktop, just beasted out my comp to crash by opening too many coppies of something i accidently clicked on!

also add a longer sleep in (where its ; out, if its too fast or too high load)

will carry on trying the "Z" thing, but i think thats got something to do with notepad not the script.

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
 
#Include <Misc.au3>
While 1
$end = 1
 
while _IsPressed(01)
;mousedown("left")
mouseup("left")
mousedown("left")
;sleep(10)
tooltip("clicking",0,0)
   ;Send("Z")
    wend
  tooltip("",0,0)
WEnd
 
Func TogglePause()
  $Paused = NOT $Paused
  While $Paused
    sleep(100)
    ToolTip('Script is "Paused"',0,0)
  WEnd
  ToolTip("")
EndFunc

Edit:

if you put the z back in that code it works in office word, so im guessing its notepad? but no idea tbh.

Edited by sebgg
GC - Program to rapidly manipulate DNA SequencesRotaMol - Program to measure Protein Size
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...