Sign in to follow this  
Followers 0
Venzak

Link Active/not active

4 posts in this topic

#1 ·  Posted (edited)

Is there is any way to write loop to check if link is active (you could click on it) sth like: If link is active click

Im using click by text. Maybe i could modify it somehow to check if link with my text is active?

$sMyString = "Build for level 15"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
    EndIf
Next

atm. im using refreshing _IEAction($oIE, "refresh") (to update link status im using refresh function) After every refresh it should check (or try to click on link with selected text) if link is active ---> click on it. If link is not active it should wait 2 minutes (im using Slepp(xxx) ) then refresh again and check if link is active. To make it random i use sth like these:

$timeMin = 1000
$timeMax = 36000
$sleepTime = Random($timeMin, $timeMax)
Sleep($sleepTime)

Is it the best way to make random checking ?

Anyone know how could i do it ? Thanks in advance :)

Edited by Venzak

Share this post


Link to post
Share on other sites



Is there is any way to write loop to check if link is active (you could click on it) sth like: If link is active click

Im using click by text. Maybe i could modify it somehow to check if link with my text is active?

You are already using _IEPropertyGet(), and you can test the IsDisabled property for the link object with:
$Status = _IEPropertyGet($oLink, "isdisabled")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I've changed the way of doing it but... i have another problem ;/

Full code:

#include <IE.au3>
#include <Constants.au3>
Global Const $planet = planetid, $ses = sessionnumber

$oIE = _IECreate("http://sXX.ogame.onet.pl/game/index.php?page=overview&session=$ses")
_IELoadWait ($oIE)
$sMyString = "Budynki"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks 
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop            
    EndIf
Next
_IELoadWait ($oIE)
_IENavigate($oIE,"http://sXX.ogame.onet.pl/game/index.php?page=b_building&session=$ses&modus=add&techid=2&planet=$planet")
Sleep(time needed)

It says: Missing separate operator in line 3

Could you cocrrect variables here because im not sure if im using them in correct way (i think i do)

Thanks in advance :)

Share this post


Link to post
Share on other sites

I've changed the way of doing it but... i have another problem ;/

Full code:

#include <IE.au3>
#include <Constants.au3>
Global Const $planet = planetid, $ses = sessionnumber

It says: Missing separate operator in line 3

Could you cocrrect variables here because im not sure if im using them in correct way (i think i do)

Thanks in advance :)

You are setting string values that are not enclosed in quotes:
Global Const $planet = "planetid", $ses = "sessionnumber"

If those are not supposed to be strings, you'll have to explain what "planetid" and "sessionnumber" are.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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