Jump to content
Sign in to follow this  
jacobraccuia

detect a link on a page

Recommended Posts

jacobraccuia

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

Share this post


Link to post
Share on other sites
PsaltyDS

Start by trying out the example scripts under each of the _IE* functions in the help file.

: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

Share this post


Link to post
Share on other sites
jacobraccuia

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jacobraccuia

I didn't know that. I will switch over to IE and see what I can get done and then post back!

Share this post


Link to post
Share on other sites
jacobraccuia

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jacobraccuia

Yes, thank you so much! I removed the first StringInStr command "tech DB search results" and just had the No Lease Found part, and it worked perfectly!

I don't really know what it means, but thank you!

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  

×