Jump to content

Clicker Script.


Recommended Posts

Oke, heres my script

#NoTrayIcon
HotKeySet("{PGUP}", "_LeftClick")
HotKeySet("{PGDN}", "_RightClick")

While 1
    Sleep(1000)
WEnd

Func _LeftClick()
    MouseClick("Left")
EndFunc

Func _RightClick()
    MouseClick("Right")
EndFunc

The thing is, If I hold down the button, its the hotkey, so it repeats, so, it doesnt let me drag, i cant move windows, scroll, etc. Anyway to fix this? The reason im using hotkeys, is, I also need it to "trap" the pg up & pg down, so, they dont to their usual functions. Thanks.

And, If anyones wondering, why im doing this script. Its because clicking makes alot of noise at night.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Umm I dont really know much about auto it, but ill give it a shot.

>Somtheing like this (concept)<

#NoTrayIcon
HotKeySet("{PGUP}", "_LeftClick_Up")
HotKeySet("{PGDN}", "_LeftClick_Down")
HotKeySet("{HOME}", "_RightClick_Up")
HotKeySet("{END}", "_RightClick_Down")


While 1
    Sleep(1000)
WEnd

Func _LeftClick_up()
    MouseUp("Left")
EndFunc

Func _LeftClick_Down()
    MouseDown("Left")
EndFunc

Func _RightClick_Up()
    MouseUp("Right")
EndFunc

Func _RightClick_Down()
    MouseDown("Right")
EndFunc

EDIT: Typo

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Ok, heres another idea, wont work but might give you an idea.

#NoTrayIcon
;HotKeySet("{PGUP}", "_LeftClick_Up")
HotKeySet("{PGDN}", "_LeftClick");_Down") ----MABY TOGGLE----
;HotKeySet("{HOME}", "_RightClick_Up")
HotKeySet("{END}", "_RightClick");_Down") ----MABY TOGGLE----


While 1
    If $Left = 1
        MouseDown("left")
    Else
        MouseUp("Left")
    If $Right = 1
        MouseDown("Right")
    Else
        MouseUP("Right")
    Sleep(10)
WEnd

Func _LeftClick()
Global $Left = 1
EndFunc

Func _RightClick()
Global $Right = 1
EndFunc

#comments-start
Func _LeftClick_up()
    MouseUp("Left")
EndFunc

Func _LeftClick_Down()
    MouseDown("Left")
EndFunc

Func _RightClick_Up()
    MouseUp("Right")
EndFunc

Func _RightClick_Down()
    MouseDown("Right")
EndFunc
#Coments-end

EDIT: Typo

EDIT2: added comment

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Yeah, I know it wont work, it was just an idea to get you going, try and like, press once and makes variable 1 press again and makes it 0 or somthing, Im gonna go for a bit, will post if I get an idea.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Dont want it to drag, What im aiming for, is the exact same thing a mouse does. Except, instead of the 2 mouse buttons, it will be pg up and pg dn

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Is there a way to tell if a key is being presses? If so I think I got you a script.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

But, I cant use _IsPressed, Because, it doesnt "trap" the key. Unless youve got a script that makes it trap the key?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Well there are a few bugs, but really not in mood to look for way to fix, hope this works for you

#Include <C:/program files/autoit3/beta/include/Misc.au3>
#NoTrayIcon
#comments-start
HotKeySet("{PGUP}", "_LeftClick_Up")
HotKeySet("{PGDN}", "_LeftClick");_Down") ----MABY TOGGLE----
HotKeySet("{HOME}", "_RightClick_Up")
HotKeySet("{END}", "_RightClick");_Down") ----MABY TOGGLE----
#comments-end

While 1
    #comments-start
    If $Left = 1
        MouseDown("left")
    Else
        MouseUp("Left")
    If $Right = 1
        MouseDown("Right")
    Else
        MouseUP("Right")
    #comments-end
    If _IsPressed(21) Then;Page UP
        MouseClickDrag ("Left")
    EndIf
    If _IsPressed(22) Then;Page Down
        MouseClickDrag ("Right")
    EndIf
    Sleep(10)
WEnd
#comments-start
Func _LeftClick()
Global $Left = 1
EndFunc

Func _RightClick()
Global $Right = 1
EndFunc

Func _LeftClick_up()
    MouseUp("Left")
EndFunc

Func _LeftClick_Down()
    MouseDown("Left")
EndFunc

Func _RightClick_Up()
    MouseUp("Right")
EndFunc

Func _RightClick_Down()
    MouseDown("Right")
EndFunc
#Coments-end

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Then use this, it "should" act like a regular mouse (after errors are fixed {altho it would likely double click})

#Include <C:/program files/autoit3/beta/include/Misc.au3>
#NoTrayIcon
#comments-start
HotKeySet("{PGUP}", "_LeftClick_Up")
HotKeySet("{PGDN}", "_LeftClick");_Down") ----MABY TOGGLE----
HotKeySet("{HOME}", "_RightClick_Up")
HotKeySet("{END}", "_RightClick");_Down") ----MABY TOGGLE----
#comments-end

While 1
    #comments-start
    If $Left = 1
        MouseDown("left")
    Else
        MouseUp("Left")
    If $Right = 1
        MouseDown("Right")
    Else
        MouseUP("Right")
    #comments-end
    If _IsPressed(21) Then;Page UP
                MouseClick("Left")
        MouseClickDrag ("Left")
    EndIf
    If _IsPressed(22) Then;Page Down
                MouseClick("Left")
        MouseClickDrag ("Right")
    EndIf
    Sleep(10)
WEnd
#comments-start
Func _LeftClick()
Global $Left = 1
EndFunc

Func _RightClick()
Global $Right = 1
EndFunc

Func _LeftClick_up()
    MouseUp("Left")
EndFunc

Func _LeftClick_Down()
    MouseDown("Left")
EndFunc

Func _RightClick_Up()
    MouseUp("Right")
EndFunc

Func _RightClick_Down()
    MouseDown("Right")
EndFunc
#Coments-end

EDIT: or another idea, make it mousedown on one _IFPressed() and then mouseup on the next_IFPressed()

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

_.`*_-_OFF_TOPIC_-_*`._

Just now read my guestbook, AzKay. Thanks for the first post

_.`*_-_ON_TOPIC_-_*`_

I read somewhere there was a udf to handle different functions with 1 hotkey. You could make it if the hotley was pressed twice in succession, it could drag to.. do the draging.

Link to comment
Share on other sites

#NoTrayIcon
#include<misc.au3>

Dim $right_state, $left_state, $user32 = DllOpen( 'user32')

HotKeySet( '{PGUP}', '_LeftClick')
HotKeySet( '{PGDN}', '_RightClick')
;HotKeySet( '{somekey}', 'quit')

While 1
    If $left_state And Not _IsPressed( 21, $user32) Then
        MouseUp( 'left')
        $left_state = False
    EndIf
    
    If $right_state And Not _IsPressed( 22, $user32) Then
        MouseUp( 'right')
        $right_state = False
    EndIf
    
    Sleep(100)
WEnd

Func _LeftClick()
    If $left_state Then Return
    MouseDown( 'left')
    $left_state = True
EndFunc

Func _RightClick()
    If $right_state Then Return
    MouseDown( 'right')
    $right_state = True
EndFunc

Func quit()
    Exit
EndFunc

Func  OnAutoItExit()
    DllClose( $user32)
EndFunc

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...