Jump to content
Sign in to follow this  
Walls192

repeat every ten minutes

Recommended Posts

Walls192

Is there away I can repeat a certain bit of my script every ten minutes?

Share this post


Link to post
Share on other sites
Glyph

While 1
sleep(600000)
;dobitofscript
wend

Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites
weaponx

While 1
  sleep(600000)
;dobitofscript
  wend
This is fine if your command take zero time to run.

This will add 10 minutes onto end of the command.

If you need something to run specifically at 10, 20, 30, 40, 50 mins etc...

$stamp = TimerInit()
While 1
    ;MsgBox(0,"",Int(TimerDiff($stamp) / 1000) / 60 & " minutes" & @CRLF & Int(TimerDiff($stamp) / 1000) & " seconds")
    
    ;If last time stamp was greater than or equal to 10 minutes
    If ((TimerDiff($stamp) / 1000) / 60) >= 10 Then
        ;COMMANDS HERE
        
        $stamp = TimerInit()
    EndIf
WEnd
Edited by weaponx

Share this post


Link to post
Share on other sites
Walls192

This is fine if your command take zero time to run.

This will add 10 minutes onto end of the command.

If you need something to run specifically at 10, 20, 30, 40, 50 mins etc...

$stamp = TimerInit()
While 1
    ;MsgBox(0,"",Int(TimerDiff($stamp) / 1000) / 60 & " minutes" & @CRLF & Int(TimerDiff($stamp) / 1000) & " seconds")
    
    ;If last time stamp was greater than or equal to 10 minutes
    If ((TimerDiff($stamp) / 1000) / 60) >= 10 Then
        ;COMMANDS HERE
        
        $stamp = TimerInit()
    EndIf
WEnd
are there any other ways because when I use your way weaponx it gives me an error about the end if statement.

Share this post


Link to post
Share on other sites
weaponx

What is the error? I have tested this many times.

This version will display a msgbox every 15 seconds.

$stamp = TimerInit()
While 1
    ;MsgBox(0,"",Int(TimerDiff($stamp) / 1000) / 60 & " minutes" & @CRLF & Int(TimerDiff($stamp) / 1000) & " seconds")
    
    ;If last time stamp was greater than or equal to 15 seconds
    If ((TimerDiff($stamp) / 1000) / 60) >= .25 Then
        ;COMMANDS HERE
        MsgBox(0,"","It's been 15 seconds!!!")
        $stamp = TimerInit()
    EndIf
WEnd
Edited by weaponx

Share this post


Link to post
Share on other sites
Walls192

I don't think you understand me, This is my full code for my bux.to browser, I want the links to be checked and viewd every ten minutes

#Include <Constants.au3>
#include <IE.au3>
#include <Array.au3>
#include <File.au3>
#NoTrayIcon

; Random
Local $fileLineArray
Opt("TrayMenuMode",1)
$oIE = _IECreate("about:blank",0 ,0)

; Deletes to avoid errors
FileDelete("output.txt")
FileDelete("links.txt")

; Creates TrayItem
$startsitem  = TrayCreateItem("Start")
TrayCreateItem("")
$stopitem  = TrayCreateItem("Stop")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        
; Starts collecting adds
        Case $msg = $startsitem
            If @OSVersion = "WIN_NT4" or @OSVersion = "WIN_ME" or @OSVersion = "WIN_98" or @OSVersion = "WIN_95" then
                TraySetToolTip ("Bux.to Browser - Collecting ads")
            Else
                Traytip ("Bux.to Browser", "Collecting ads", 5)
            EndIf
            _IENavigate($oIE, "http://bux.to/surf.php")
Sleep(2000)
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
Global $Link_Array[$iNumLinks]
For $oLink In $oLinks
    If StringInStr($oLink.href,'view.php?ad=') Then
        _ArrayAdd($Link_Array,$oLink.href)
    EndIf
   
Next
_FileWriteFromArray("links.txt",$Link_Array,1)


$fil = "links.txt"
$fil = FileRead($fil)
$fil = StringSplit($fil, @CRLF)

For $i = $fil[0] To 1 Step - 1
    $tempstr = StringStripWS($fil[$i], 3)
    If $tempstr = "" Then
        _ArrayDelete($fil, $i)
    Else
        If $i = 1 Then ExitLoop
        For $n = $i - 1 To 1 Step - 1
            If $tempstr = $fil[$n] Then
                _ArrayDelete($fil, $i)
                ExitLoop
            EndIf
        Next
    EndIf
Next
$fil[0] = UBound($fil) - 1

If $fil[0] > 0 Then
    _FileWriteFromArray("output.txt", $fil, 1)
Else
    MsgBox(16, "Error", "No Links Found")
    ProcessClose("iexplore.exe")
    Exit
EndIf
sleep(8000)

FileDelete("links.txt")
$CountLines = _FileCountLines("output.txt")
MsgBox(64, "Bux.to Browser", "There are " & $CountLines & " availiable")


; Starts Browsing ads
If @OSVersion = "WIN_NT4" or @OSVersion = "WIN_ME" or @OSVersion = "WIN_98" or @OSVersion = "WIN_95" then
        TraySetToolTip ("Bux.to Browser - Browsing ads")
    Else
        Traytip ("Bux.to Browser", "Browsing ads", 5)
    EndIf
    
For $i = 1 To _FileCountLines("output.txt")
_IENavigate($oIE, FileReadLine("output.txt", $i))
_IELoadWait($oIE)
sleep(35000)
Next
        Case $msg = $stopitem
            ExitLoop
        Case $msg = $exititem
            Exit
    EndSelect
WEnd
Edited by Walls192

Share this post


Link to post
Share on other sites
weaponx

Do you want to run the whole script every 10 minutes or just the portion in your While 1 loop?

Share this post


Link to post
Share on other sites
Walls192

I want it so when you press start, every ten minutes it will do the start opration until stop is pressed

Edited by Walls192

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  

×