Jump to content

Simple Program Help


Recommended Posts

Hi, i have this script, all it does is:

Click a certain area on screen the move to another area and click multiple times.

ive tried using HotKeySet but cant seem to get it to work.

I want it so it clicks, moves, clicks the multiple times, but have a hotkey to stop the clicking then another one to start the clicking again.

anyone help??? Thanks

HotKeySet("+!d", "End")

MouseClick("left", 915, 161, 1);

MouseClick( "left", 738, 186, 300, 100);

Func End()

Exit 0

EndFunc

Link to comment
Share on other sites

You need a flag to "stop" or "resume" the script execution of these 3 line of code of the earlier loop:

HotKeySet("+!d", "End")
Dim $fStop = False
.
.
.

Func End()
    $fStop = Not $fStop

    While $fStop
        Sleep(20) ; A good habit.
    WEnd
EndFunc

The first time this function is entered the $fStop variable is set to true so it'll start loop and do nothing but sleep. The next time this function is entered $fStop is set again to False and so this loop won't get executed (same for the earlier loop that have started).

Link to comment
Share on other sites

Still cant seem to get it working. here is what i have:

HotKeySet("+!d", "End")
HotKeySet("+!g", "Go")
Dim $fStop = False
Func End()
    $fStop = Not $fStop

    While $fStop
        Sleep(20); A good habit.
    WEnd
EndFunc
Func Go()
While 1
        MouseMove(917,161,1);
        MouseClick("left");
        MouseMove(738,186,1);
        MouseClick( "left",738,186,300);
        Sleep(300); To not spike your processor.
    WEnd
EndFunc
Link to comment
Share on other sites

; O.K.
HotKeySet("+!d", "End")
HotKeySet("+!g", "Go")
HotKeySet("{ESC}", "_EXIT")

Dim $fStop = False
Go()



Func End()
    $fStop = Not $fStop
    ToolTip('"Not running"', 0, 0)
    While $fStop
        Sleep(20)
    WEnd
    ToolTip('"Running"', 0, 0)
EndFunc


Func Go()
    ToolTip('"Running"', 0, 0)
    While 1
        ;MouseMove(917,161,1)
        ;MouseClick("left")
        ;MouseMove(738,186,1)
        ;MouseClick( "left",738,186,300)
        
        Sleep(30)
    WEnd
EndFunc


Func _EXIT()
    Exit
EndFunc

It's ok, it'll get better as time passes. ;]

Link to comment
Share on other sites

HotKeySet("{F6}", "Toggle")
$i_toggle = 0
While 1
    Sleep(100) ; always a good idea so you dont max your cpu
    While $i_toggle
        ToolTip("Running")
    WEnd
    ToolTip("")
WEnd

Func Toggle()
    $i_toggle = Not $i_toggle
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

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