Sign in to follow this  
Followers 0
zombie007

Retrieve text under mouse in website

8 posts in this topic

Hi all,

It could be possible that this question has been asked before. Though I couldn't find it :) ...

In a web page I have different lines of text (if needed I can make them a hyperlink!) referring to different files om my internal HD. I want to hover over the text and retrieve its content once I press a mouse button (no matter what, left or right!!). Once this is done I can access the right file.

Any suggestion from you guys? I will really appreciate it.

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should illustrate a concept you can use if you make them hyperlinks:

#include <IE.au3>
$oIE = _IECreate("www.google.com")
While 1
    $var = _IEPropertyGet($oIE, "statustext")
    If @error Then Exit
    ToolTip ($var, 0, 0)
    Sleep (100)
WEnd

Now just pair that up with _IsPressed and you should be able to get what you want.

Edited by exodius

Share this post


Link to post
Share on other sites

Thanks exodius,

This will surely help to achieve what I'm intending to do.

Share this post


Link to post
Share on other sites

This should illustrate a concept you can use if you make them hyperlinks:

#include <IE.au3>
$oIE = _IECreate("www.google.com")
While 1
    $var = _IEPropertyGet($oIE, "statustext")
    If @error Then Exit
    ToolTip ($var, 0, 0)
    Sleep (100)
WEnd

Now just pair that up with _IsPressed and you should be able to get what you want.

I came across this post and it does exactly what I want but I also need to get the hyperlink info while hovering over links in html documents. The above example works great for a web page on the internet. Just hover over a hyperlink and a tooltip pops up showing the link info. Is there any way to do the same thing for an html document?

Share this post


Link to post
Share on other sites

I came across this post and it does exactly what I want but I also need to get the hyperlink info while hovering over links in html documents. The above example works great for a web page on the internet. Just hover over a hyperlink and a tooltip pops up showing the link info. Is there any way to do the same thing for an html document?

#include <IE.au3>
$oIE = _IECreate("file:///C:/sample.htm")
While 1
    $var = _IEPropertyGet($oIE, "statustext")
    If @error Then Exit
    ToolTip ($var, 0, 0)
    Sleep (100)
WEnd

Share this post


Link to post
Share on other sites

#include <IE.au3>
$oIE = _IECreate("file:///C:/sample.htm")
While 1
    $var = _IEPropertyGet($oIE, "statustext")
    If @error Then Exit
    ToolTip ($var, 0, 0)
    Sleep (100)
WEnd

Thanks for the reply. I have that working now but I need to be able to do the same thing with IE embedded. Here is my example script modified from the help file. Can you make the statustext show in a tooltip in this example?

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

GUICreate("Embedded Web control Test", 640, 580, _

(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)

$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)

$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)

$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)

$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate ($oIE, "www.google.com")

; Waiting for user to close the window

While 1

$msg = GUIGetMsg()

$var = _IEPropertyGet($oIE, "statustext")

If @error Then Exit

ToolTip ($var, 0, 0)

Sleep (100)

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $GUI_Button_Home

_IENavigate ($oIE, "http://www.autoitscript.com")

Case $msg = $GUI_Button_Back

_IEAction ($oIE, "back")

Case $msg = $GUI_Button_Forward

_IEAction ($oIE, "forward")

Case $msg = $GUI_Button_Stop

_IEAction ($oIE, "stop")

EndSelect

WEnd

GUIDelete()

Exit

Share this post


Link to post
Share on other sites

Here is that script properly edited I hope (not sure how to get it to show in the forum like it does in Scite).

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

GUICreate("Embedded Web control Test", 640, 580, _

(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)

$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)

$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)

$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)

$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate ($oIE, "www.google.com")

; Waiting for user to close the window

While 1

$msg = GUIGetMsg()

$var = _IEPropertyGet($oIE, "statustext")

If @error Then Exit

ToolTip ($var, 0, 0)

Sleep (100)

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $GUI_Button_Home

_IENavigate ($oIE, "http://www.autoitscript.com")

Case $msg = $GUI_Button_Back

_IEAction ($oIE, "back")

Case $msg = $GUI_Button_Forward

_IEAction ($oIE, "forward")

Case $msg = $GUI_Button_Stop

_IEAction ($oIE, "stop")

EndSelect

WEnd

GUIDelete()

Exit

Share this post


Link to post
Share on other sites

Here is that script properly edited I hope (not sure how to get it to show in the forum like it does in Scite).

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

GUICreate("Embedded Web control Test", 640, 580, _

(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)

$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)

$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)

$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)

$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate ($oIE, "www.google.com")

; Waiting for user to close the window

While 1

$msg = GUIGetMsg()

$var = _IEPropertyGet($oIE, "statustext")

If @error Then Exit

ToolTip ($var, 0, 0)

Sleep (100)

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $GUI_Button_Home

_IENavigate ($oIE, "http://www.autoitscript.com")

Case $msg = $GUI_Button_Back

_IEAction ($oIE, "back")

Case $msg = $GUI_Button_Forward

_IEAction ($oIE, "forward")

Case $msg = $GUI_Button_Stop

_IEAction ($oIE, "stop")

EndSelect

WEnd

GUIDelete()

Exit

I found another solution. As I read the help file on the embedding commands I was using it said that IE embedded loses some properties, one of the being status text. I thought I researched this thoroughly before posting. Sorry. I am now embedding the whole program in a window using the winapi setparent command and it works perfectly. I also found a script online to get rid of the title bar so it looks like part of the parent window. THanks to all of you out there who have great scripting ideas for those who want to look for them!

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