Jump to content

Help please!


Recommended Posts

$DWLUMBER = _IEAttach("Lumber Mill")

$DWSTARTLUMBER = "We need some spare people around here"

$oLinks = _IELinkGetCollection($DWLUMBER)

For $oLink in $oLinks

$sLinkText = _IEPropertyGet($oLink, "innerText")

If StringInStr($sLinkText, $DWSTARTLUMBER) Then

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

Could anyone please tell me whats does this line mean?

For $oLink in $oLinks

and what is $oLink in $oLinks?

cause sometimes i try to make another same loop on the same script and change $oLink in $oLinks to another name like $oAink in $oAinks and

it pops up error saying this

For $oLink in $oLinks

For $oLink in $oLinks^ ERROR

Error: Variable must be of type "Object".

Edited by ajdicky
Link to comment
Share on other sites

You need error checking after _IEAttach to ensure that it is successful.

$DWLUMBER = _IEAttach("Lumber Mill")
If @ERROR Then
MsgBox(0,"","Failed to attach to Internet Explorer window")
Exit
EndIf

$DWSTARTLUMBER = "We need some spare people around here"

$oLinks = _IELinkGetCollection($DWLUMBER)
If @ERROR Then
MsgBox(0,"","Failed to attach to retrieve link collection")
Exit
EndIf

For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $DWSTARTLUMBER) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next
Edited by weaponx
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...