Jump to content

TimerInit


 Share

Recommended Posts

hi all i'm having trouble with the TimerInit i'm trying to set a timer to set of $oIE.refresh i have a combo with preset times a example would be if i choose 30 sec in the combo this would set of $oIE.refresh Every

30 secs i'm not sure we can do this the help book has a few timer refs in it but nothing i'm looking to do

any ideas on how i can do this ? or send me down the right path

thank you

michael

Func  combootwo()
sleep($Combo2)
$oIE.refresh
EndFunc
Link to comment
Share on other sites

You might want to look at AdLibEnable(), which runs a specified function at a specified interval.

; Declare $oIE as global
Global $oIE = ObjCreate(...)

; Somehow get the refresh delay
; Multiply by 1,000 for seconds
Local $Delay = ...

; Instruct AutoIt to run some function every X milliseconds
AdLibEnable('RefreshPage', $Delay)

; That function will run while the script is in memory
While 1
    Sleep(0x7FFFFFFFF)
   ; Or do other things
WEnd

Func RefreshPage()
    $oIE.Refresh()
EndFunc
Link to comment
Share on other sites

  • Moderators

Are you doing another function, and you want to stop somewhere in that function, and go to "Refresh" Function? You're code doesn't say much.

You could use Adlib or TimerInit()

AdlibEnable("combootwo", 30000)

Func Main()
; Doing stuff
EndFunc

Func  combootwo()
sleep($Combo2)
$oIE.refresh
EndFunc

Is way I'm interpreting your question.

Dim $Timer

Func Main()
$TIMER = TimerInit()
While 1
 ;Do Stuff
    If TimerDiff($Timer) / 1000 >= 30 Then
        combootwo()
        $TIMER = TimerInit()
    EndIf
Wend
EndFunc

Func  combootwo()
sleep($Combo2)
$oIE.refresh
EndFunc

Is another way I'm interpreting your question.

Hope it helps...

Edit

Ha... you type faster than me LxP!!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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