Jump to content

help about pause


Recommended Posts

My Script like:

CODE
Global $UnPaused

HotKeySet("{pause}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

hotkeyset("^1","aaa")

hotkeyset("^2","bbb")

While 1

Sleep(100)

ToolTip("Script is Paused",0,0)

WEnd

Func aaa()

#include "....1.au3"

endfunc

Func bbb()

#include "....2.au3"

endfunc

Func TogglePause()

$UnPaused = NOT $UnPaused

While $UnPaused

ToolTip("Sending...",0,0)

WEnd

EndFunc

Func Terminate()

Exit 0

EndFunc

when I press ctrl+1, script 1 run normally, but when I pause, script 1 quit, to run it again must press Ctrl+1

So how to pause script 1 or 2 and can run it again by press pause again??

Thanks

Edited by newbie01
Link to comment
Share on other sites

Why are you using #include to run the other scripts?

This is how it should be done, in my opinion ;]

HotKeySet('^1', 'aaa')

Func aaa()
    ; Call Script1
    Script1()
EndFunc

Func Script1
      ; What script 1 should do.
EndFuncoÝ÷ Ø­¶§Ýý²"Ù^²ËhºÇi¨§²×vÜjYb®*mÔíçâ®Ëlr¸©¶+Åç.¶)àr^Ýývf¤zǧ±ëhw%¹×¢¶)íè^i׫në]yø§x-ë®*mßÛ-jÉ"Èy§îËb¢v§uÆ¥)à×ë¢fi«­¢+ØìQ¡¥Ì¥ÌÍÉ¥ÁÐĹÔÌ((ìM½µ±½°ÙÉ¥±Ì(¥¹±Õµ½¹)Õ¹}5¥¸ ¤ìQ¡¥Ìչѥ½¸¹µ¡ÌѼչ¥ÅÕ¸(ìMÉ¥Áе¥¸½)¹Õ¹oÝ÷ Ø  ݶ§jëh×6#include "Script.au3"
HotKeySet('^1', 'aaa')
.
.
.
Func aaa()
    _Main()
EndFunc

Hope I'm making sense. ;=]

Link to comment
Share on other sites

As to your pause issue...

Don't you just have your Paused and UnPaused loops, messages and test reversed?

I think you're out-of-sync with the actual state of the key.

You'll come into the script in a running state and hit the main loop, so that should be your "running" loop, and the other loop would be the paused state.

Global $Paused
HotKeySet("{pause}", "TogglePause") 
HotKeySet("{ESC}", "Terminate") 
hotkeyset("^1","aaa")
hotkeyset("^2","bbb")

While 1 
    For $x = 1 to 999
        Sleep(1)
        ToolTip($x & " - Running",200,200)
    Next
WEnd 

Func aaa()
    $Paused = 0
    For $z = 1 to 100
    Beep(400,50)
    Next
Endfunc

Func bbb()
    $Paused = 0
    For $z = 1 to 100
    Beep(800,50)
    Next
Endfunc

Func TogglePause() 
    $Paused = NOT $Paused 
    While $Paused
        ToolTip($x & " - Paused",200,200)
    Wend
EndFunc 

Func Terminate() 
Exit 0 
EndFunc

Edit: reworked my explanation (a couple times!)

Edited by Spiff59
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...