Sign in to follow this  
Followers 0
Nazo

Little problem with $Pause

5 posts in this topic

This program sending F11 button each 15s but i want this program to start paused with ToolTip like in code.

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")

while 1
Sleep(15000)
Send("{F11}")
wEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('P',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

I tried this and now it starts paused, but when i want to pause it i must waiting till loop end... i need code which will stop action and show me tooltip again when i paused it after unpausing ;)

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")

while 1
ToolTip('P',0,0)
Sleep(100)
wEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        ToolTip("")
        Sleep(15000)
        Send("{F11}")
    WEnd
    ToolTip('P',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This program sending F11 button each 15s but i want this program to start paused with ToolTip like in code.

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")

while 1
Sleep(15000)
Send("{F11}")
wEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('P',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

I tried this and now it starts paused, but when i want to pause it i must waiting till loop end... i need code which will stop action and show me tooltip again when i paused it after unpausing ;)

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")

while 1
ToolTip('P',0,0)
Sleep(100)
wEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        ToolTip("")
        Sleep(15000)
        Send("{F11}")
    WEnd
    ToolTip('P',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc
Here ya go:

Global $Paused = 1 ; Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")

while 1
    
    Sleep(20)
    While $Paused = 0
        ToolTip("Not very paused...", 0, 0)
        Sleep(15000)
    WEnd
ToolTip('P',0,0)
Sleep(100)

wEnd

Func TogglePause()
    
    If $Paused = 1 Then 
        $Paused = 0
    Else
        $Paused = 1
    EndIf
    
    
EndFunc

Func Terminate()
    Exit 0
EndFunc
Edited by Szhlopp

Share this post


Link to post
Share on other sites

I need to have possibility of multi pausing, this code which you wrote after unpausing doesn't want to pause again ;)


Share this post


Link to post
Share on other sites

I need to have possibility of multi pausing, this code which you wrote after unpausing doesn't want to pause again ;)

Errr...

Try this. This enables you to pause at ANY point=) No 15sec wait

Global $Paused = 1 ; Paused
Global $Time = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")
AdlibEnable("Addfunction", 500)
while 1
    
If $Paused = 1 Then
    ToolTip('P',0,0)
    Sleep(100)
EndIf

wEnd

Func TogglePause()
    
    If $Paused = 1 Then 
        $Paused = 0
        ToolTip("")
    Else
        $Paused = 1
    EndIf
    
    
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func Addfunction()
    
    If $Paused = 0 Then
        
        $Time += 500
        If $Time = 15000 Then 
            ; Do something here. Send("{F11}")
            TrayTip("NOT paused", "=)", 1)
            $Time = 0
        EndIf
    EndIf
    

    EndFunc

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Now it works but while clicking is active it using CPU a looot so something is still wrong ;/

edit

------------------------------------------------------------------------------

problem solved by adding sleep after "while 1" oO

tnx for your help ;)

Edited by Nazo

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