Sign in to follow this  
Followers 0
Allochthonous

find a string and position cursor

6 posts in this topic

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



#2 ·  Posted (edited)

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

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

Did you examine it with the AutoIt Window Info Tool (AU3Info.exe) to see if the control was recognized?

:D


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

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

Can anybody offer some insight?

PK

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