Sign in to follow this  
Followers 0
LiLShinta

Pause script

10 posts in this topic

i have script working...what code should i attach to my hotkey to pause the woking function??

$HK = "{F9}"

HotKeySet($HK, "pause")

; i have function start() and its is currently working...

Func pause()

;what should be my code here to terminate or pause the function start???

endfunc

I also have these codes...

Switch @HotKeyPressed
        Case $HK3
            $Ini1 = $Init + 1
            IniWrite($ConfigFile, "Main Prefs", "bpm", $Ini1)
        Case $HK4
            $Ini1 = $Init - 1
            IniWrite($ConfigFile, "Main Prefs", "bpm", $Ini1)
EndSwitch

my target there is to run my function start() with corresponding changes with $Ini1...I like it to be, everytime the $HK3 is pressed, the value of $Ini1 will increase by 1... help me please...

Share this post


Link to post
Share on other sites



Global $Paused

HotKeySet("{delete}","pause")
Func pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd

EndFunc


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here's a quick example how to pause/unpause your script with a hotkey:

HotKeySet("{F9}","pause")
Global $bool=False
while 1
    sleep(100)
WEnd


Func pause()
    $bool=Not $bool
    while $bool
        sleep(10)
        ConsoleWrite("Paused!"&@CRLF)
    WEnd
EndFunc

Edit: Wow, cool d4rk and I thought almost exactly the same :D

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

how bout that... if i will terminate the working script to start it again with changed value of $Ini1??

Share this post


Link to post
Share on other sites

how bout that... if i will terminate the working script to start it again with changed value of $Ini1??

Use InputBox() function.

Share this post


Link to post
Share on other sites

nope, i mean i would like to start the whole script again without exiting...

Share this post


Link to post
Share on other sites

nope, i mean i would like to start the whole script again without exiting...

Test pausing my example with F9, then press F9 again and be amazed :D

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

yup i got it... but how about this one??

I also have these codes...

Switch @HotKeyPressed
        Case $HK3
            $Ini1 = $Init + 1
            IniWrite($ConfigFile, "Main Prefs", "bpm", $Ini1)
        Case $HK4
            $Ini1 = $Init - 1
            IniWrite($ConfigFile, "Main Prefs", "bpm", $Ini1)
EndSwitch

my target there is to run my function start() with corresponding changes with $Ini1...I like it to be, everytime the $HK3 is pressed, the value of $Ini1 will increase by 1... help me please...

Share this post


Link to post
Share on other sites

did you declare the $Ini1 at first ?

$Ini1=0
...

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

nope but i did declare $init as default value of 101..

Global $init = IniRead($ConfigFile, "Main Prefs", "bpm", 101)

isnt it right?

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