Sign in to follow this  
Followers 0
newbie01

help about pause

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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. ;=]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0