Jump to content
Sign in to follow this  
Allochthonous

find a string and position cursor

Recommended Posts

Allochthonous

I need to be able to find a string in a window ("http") and position my cursor on top of it so that i can send Crtl-A to capture an entire URL.

Can this be done?

PK

Share this post


Link to post
Share on other sites
PsaltyDS

Read up on the _IE* functions of the IE.au3 UDF. Once you can identify the DOM element that contains what you want, get the text with something simple like:

$sText = $oElement.innerText

Or maybe:

$sURL = $oLink.href

This demo opens the AutoIt home page and gets the URL from the "graphics and wallpapers" link in the text:

#include <IE.au3>

$sURL = "http://www.autoitscript.com"
$oIE = _IECreate($sURL)
$colLinks = _IELinkGetCollection($oIE)
For $oLink In $colLinks
    If StringInStr($oLink.innerText, "graphics and wallpapers") Then
        $sHref = $oLink.href
        MsgBox(64, "Result", "The 'graphics and wallpapers' link points to:  " & $sHref)
        ExitLoop
    EndIf
Next

:D

Edit: Added demo.

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
Allochthonous

Actually, the string i am looking for and want to center on (so i can capture it) is not in an IE window. It is in an email like application. The string is an URL and starts with "http."

I want to capture it and launch it automatically in IE.

PK

Share this post


Link to post
Share on other sites
Allochthonous

Yeah, but I will be honest, I am fairly new to AutoIt and don't really know what I am looking at. I know how to get to a control if it is clearly named, but this control information I don't understand so well. I have attached a screenshot.

The Window info tool can see the text I am looking for, i know that. I just need to figure out how to get to that control (or text) so I can capture it.

Right now i am using a MouseClick command at coordinates in the window. It works, but seems sloppy.

pk

post-53927-12658960146529_thumb.jpg

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.