Jump to content

I have a script - which i wanna put a 1hr timer on


 Share

Recommended Posts

Hi there,

I am trying to add a 1hr timer for this script to run max - Right now it runs forever, but i would like for it to only run for 1 hour then close. Any help would be much appreciated!!

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

$answer = MsgBox(1, "Confirm", "This script will push Space for 1 hour")

If $answer = 2 Then

Exit

EndIf

While 1

ControlSend ("APPLICATION", "", "", "{SPACE}")

Sleep(Random(30000,180000))

WEnd

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

Link to comment
Share on other sites

Hi,

Here is a 10 second script to learn from

; start time count
$time = TimerInit()

; use adlib to check if time is exceeded
AdlibEnable('_adlib', 1000)

; keep the script running
While 1
    Sleep(1000)
    TrayTip('Time', Int(TimerDiff($time)/1000), 20)
WEnd

Exit

Func _adlib()
    ; check if time is exceeded
    If TimerDiff($time) > 10000 Then
        Exit
    EndIf
EndFunc

;)

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