Jump to content

Stoping Macro


Recommended Posts

I sm sorry for the dumb question and I can't figure out how to stop the macro once it starts. I have a simple but long macro.

Hi,

post it might help us, to help you.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

We would really need to see it to give you a good answer, but as a pointer (if you want to work it out for yourself) if you have a continuous loop involved in your script, then you need to plan a way to get out of the loop. Take a look at HotKeySet() in the help file, it may give you an idea or two.

[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

  • Moderators

I agree about the script, but doesn't seem like he cares enough to post it, so just in case someone else see's this when they are searching for answers, this might do the trick

Global $StopIt, $Pause
HotKeySet('{End}', 'StopMacroCompletely')
HotKeySet('{PgUp}', 'StartMacro')
HotKeySet('{Pause}', 'PauseMacroFromPoint')

While 1
    Sleep(100000)
WEnd

Func StartMacro()
    Local $count = 0
    $StopIt = Not $StopIt
    While $StopIt
        $count += 1;The tooltip and the $count += 1 are just here for visualization, replace with actual macro
        ToolTip($count, 0, 0)
        Sleep(10)
    WEnd
    ToolTip('')
EndFunc

Func StopMacroCompletely()
    $StopIt = Not $StopIt
EndFunc

Func PauseMacroFromPoint()
    $Pause = NOT $Pause
    While $Pause
        sleep(10)
    WEnd
EndFunc

Edit:

Or you could just use the same hotkey

Global $StopIt, $Pause
HotKeySet('{PgUp}', 'Start_And_Stop_Macro')
HotKeySet('{Pause}', 'PauseMacroFromPoint')

While 1
    Sleep(100000)
WEnd

Func Start_And_Stop_Macro()
    Local $count = 0
    $StopIt = Not $StopIt
    While $StopIt
        $count += 1;The tooltip and the $count += 1 are just here for visualization, replace with actual macro
        ToolTip($count, 0, 0)
        Sleep(10)
    WEnd
    ToolTip('')
EndFunc

Func PauseMacroFromPoint()
    $Pause = NOT $Pause
    While $Pause
        sleep(10)
    WEnd
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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