Jump to content

Easy If statment question


Recommended Posts

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?

Link to comment
Share on other sites

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.

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