Jump to content

detect a link on a page


Recommended Posts

I have created a wonderful program to help my company out at work.

One part of it goes to a website and types in an IP address. Occasionally there is information that is needed to grab. Sometimes there isn't.

I originally had a message box pop up w/ an if then.

If there was information you would click yes, and it would take the information. If there wasn't you click no and it does something else.

I want to automate this! Either by detecting a link on the page, or comparing page sizes. I have no idea where to start. Any ideas?

thanks!

Jacob

Link to comment
Share on other sites

I see that this can get me some information regarding the page, although nothing seems specific to detecting links, etc. And even if it detects the link, how do I make it choose what to do?

Edit: not to mention I would rather not use IE...

Edited by jacobraccuia
Link to comment
Share on other sites

You already tried _IELinkGetCollection(), _IEAction(), _IEPropertyGet($oLink, "innerText"), etc.?

If it didn't work, post what you tried for more help.

:mellow:

Edit: I would rather not use IE too, but that is the browser that exposes a COM interface to AutoIt. Firefox, Safari, Chrome, etc. don't expose an interface AutoIt can use.

:(

Edited by PsaltyDS
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
Link to comment
Share on other sites

So this link thing is very cool. I don't know how to set it up with an If then though.

If "link 0" exists, I want it to continue

If not, then I want it to follow instructions.

Essentially, if the link is present, it goes. If the link isn't present, it stays. Thanks, i hope you can help, cause I have no idea!

One idea I had was

$sText = _IEBodyReadText ($oIE)

If $stext = ????

Then

Exit

If the page says "Tech DB Search

Results for (random IP here)

No Lease Found"

I need it to Exit, but I don't know to set that equation

Thanks!

Edited by jacobraccuia
Link to comment
Share on other sites

On that basic level:

$sText = _IEBodyReadText ($oIE)
If StringInStr($sText, "Tech DB Search Results for") And StringInStr($sText, "No Lease Found") Then
    
    ; ... do stuff
    
EndIf

With more experience in the IE.au3 UDF you can just get the text of that one element instead of the whole page to check. For the kind of geekiness that attracts women, you can replace StringInStr() with StringRegExp(), etc.

:mellow:

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