Sign in to follow this  
Followers 0
pileot

Easy If statment question

4 posts in this topic

So i want somthing to trigger more than once.... An if statment seemed to be the obvious choice...

heres my whole script, because chances are thats whats gonna be asked for anyways...

#include <IE.au3>
$email = ""
$pass = ""

$oIE = _IECreate("https://login.facebook.com/login.php")
$timer = TimerInit()
Do
    if timerdiff($timer) = (1000*60*5) then;try to make this happen every 5 mins
    login('*******','******"');format: email, password
    Onlinecheck();check for online friends
    EndIf
    
    if timerdiff($timer) = (1000*60*60) then;try to make this happen every 60 mins
    login('*******','******"');format: email, password
;different functions to be added later

if 
until 1 = 2
    

func Login($email,$pass);log out if logged in, log in under specified username
    _IELinkClickByText ($oIE, "logout")
    _ieloadwait($oIE)
    $oForm = _IEFormGetCollection ($oIE, 0)
    $oEmail = _IEFormElementGetObjByName ($oForm, "email")
    _IEFormElementSetValue ($oEmail, $email)
    $oPass = _IEFormElementGetObjByName ($oForm, "pass")
    _IEFormElementSetValue ($oPass, $pass)
    _IEFormSubmit ($oForm)
    _ieloadwait($oIE)
EndFunc

func Onlinecheck()
    _IENavigate($oIE, "http://www.facebook.com/friends/?online")
    _ieloadwait($oIE)
    if stringinstr($oIE,"name1") Then;add options for more names later
        msgbox(0,"","Friends are online!",60)
    endif
EndFunc

my question is thus

i want to have some events happen every 5 mins, other every hour...

If timerdiff($timer) = 5 mins or 10 mins or 15 mins or.... takes forever to write... is there a better way of doing this?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Just add a For loop to it.

For $x = 0 to 11
if timerdiff($timer) = (1000*60*(($x + 1) * 5)) then;try to make this happen every 5 mins
    login('*******','******"');format: email, password
    Onlinecheck();check for online friends
    EndIf

Next

I think that should do it.

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

but i want some stuff to happen like every 5 mins, and other stuff to happen every 20 or so mins... im confused as to the best way to do that

Share this post


Link to post
Share on other sites

That's multi timer. Search for GaryFrost's timer.

Note: The timer isn't available under the current stable version but available via the beta version (can be found under Developer's Chat)

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