Jump to content

help with a simple timed left click?


Recommended Posts

hey everyone, awesome forums

i was searching to see if anything im about to post has been discussed, but i didnt find anything usefull

im new to autoit and have never scripted anything with it.. :)

im trying to code a simple script which will, when mouse is hovered over an item in my diablo2 game...

it will left click once and sleep for 500ms

and continue this until script is paused again

it doesnt have to have a gui

the sleep time would need to be adjustable

paused on start, then when mouse is positioned, pause button pressed, script unpaused and it does its thing

exit button :(

can anyone help me out?

it would be much appreciated :D

Link to comment
Share on other sites

i was hoping to just have it even simpler and physically move the mouse over the item(in diablo 2) and leave it there then press the pause button :)

no need to pixle search

doin a little more research here..

sommin like this

hotkeys here

pause= "pause"

exit= "end"

have it start out global paused

if unpaused

While 1 = 1

single left click mouse

sleep(500ms)

Wend

if the exit button pushed

exit

lol i really dont know how to script but this is just sommin sorta how it would look????

i dunno

Edited by Silly
Link to comment
Share on other sites

How about:

HotKeySet("F8", "Toggle")
HotKeySet("ESC", "Terminate")
$active=0

While 1
    If $active = 1 Then MouseClick("primary")
    Sleep(500)
WEnd

Func Toggle()
    If $active = 1 Then
        $active = 0
    Else
        $active = 1
    EndIf
EndFunc

Func Terminate()
    Exit
EndFunc

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

How about:

HotKeySet("F8", "Toggle")
HotKeySet("ESC", "Terminate")
$active=0

While 1
    If $active = 1 Then MouseClick("primary")
    Sleep(500)
WEnd

Func Toggle()
    If $active = 1 Then
        $active = 0
    Else
        $active = 1
    EndIf
EndFunc

Func Terminate()
    Exit
EndFunc

hi, thanks for the reply

ok so i tried it as an .au3

it gives no errors when i run it

it doesnt click... :)

and it sits in the taskbar flashing with a red X

hovering over the flashing taskbar icon popuptext says its paused

pressing f8 doesnt "un pause it"

:(

Link to comment
Share on other sites

HotKeySet( "{F9}", "toggle_pause" )
HotKeySet( "{Esc}", "exit_now" )
HotKeySet( "{F10}", "decrease_delay" )
HotKeySet( "{F11}", "increase_delay" )

Global $state = 1
Global $delay = 500

While 1
    While $state <> 1
        MouseClick( "left" )
        Sleep( $delay )
    WEnd
    
    Sleep( 100 )
Wend

Func toggle_pause()
    $state = Abs( 1 - $state )
EndFunc

Func increase_delay()
    $delay += 100
EndFunc

Func decrease_delay()
    $delay -= 100
EndFunc

Func exit_now()
    Exit
EndFunc

Hope this is what u were lookign for, lemme know if u need nething else.

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Link to comment
Share on other sites

HotKeySet( "{F9}", "toggle_pause" )
HotKeySet( "{Esc}", "exit_now" )
HotKeySet( "{F10}", "decrease_delay" )
HotKeySet( "{F11}", "increase_delay" )

Global $state = 1
Global $delay = 500

While 1
    While $state <> 1
        MouseClick( "left" )
        Sleep( $delay )
    WEnd
    
    Sleep( 100 )
Wend

Func toggle_pause()
    $state = Abs( 1 - $state )
EndFunc

Func increase_delay()
    $delay += 100
EndFunc

Func decrease_delay()
    $delay -= 100
EndFunc

Func exit_now()
    Exit
EndFunc

Hope this is what u were lookign for, lemme know if u need nething else.

ok tried this one, and it clicks

but... when i try it increase/decrease the delay

i get the error...

Line 39 (file..)

$delay -= 100

$delay ^ ERROR

Error: Expected a "=" operator in assignment statement

edit

ok i got some sorta pause toggle notifier :)

Func toggle_pause()
    $state = Abs( 1 - $state )
    Sleep(100)
TrayTip ( "Attention", "Pause Toggled", 1 )
EndFunc
Edited by Silly
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...