sigil Posted September 15, 2011 Posted September 15, 2011 In IE, how can I collect the hyperlink from whatever object the mouse is over? I tried _iepropertyget($ieobj,"locationurl") but that just gave me the current page's URL. Sorry if this has been covered already--I searched the forum and didn't find anything.
wakillon Posted September 15, 2011 Posted September 15, 2011 (edited) Try this #include <IE.au3> $_statustextOld='' $oIE = _IECreate ( "http://www.autoitscript.com/forum/topic/132993-get-url-from-hyperlink-under-mouse-pointer/" ) While 1 $_statustext = _IEPropertyGet ( $oIE, "statustext" ) If $_statustext And $_statustext <> $_statustextOld Then If StringLeft ( $_statustext, 5 ) = 'http:' Then ConsoleWrite ( "$_statustext : " & $_statustext & @Crlf ) $_statustextOld = $_statustext EndIf WEnd Edited September 15, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
sigil Posted September 15, 2011 Author Posted September 15, 2011 Thanks, that solves it! I look forward to getting better acquainted with my new friend .statusText.
wakillon Posted September 16, 2011 Posted September 16, 2011 (edited) Thanks, that solves it! I look forward to getting better acquainted with my new friend .statusText. Ok, and you can try this way too : #include <IE.au3> $oIE = _IECreate ( "http://www.autoitscript.com/forum/" ) $hIE = _IEPropertyGet ( $oIE, "HWND" ) $o_linkOld = '' $uIEOld = '' While 1 Sleep ( 100 ) If Not WinExists ( $hIE ) Then ExitLoop $uIE = _IEPropertyGet ( $oIE, "locationurl" ) If $uIE And $uIE <> $uIEOld Then ConsoleWrite ( "+->-- New Url : " & $uIE & @Crlf ) _IELoadWait ( $oIE ) $oLinks = _IELinkGetCollection ( $oIE ) For $oLink in $oLinks $sLinkId = _IEPropertyGet ( $oLink, "uniqueid" ) _IEHeadInsertEventScript ( $oIE, $sLinkId, "onmouseover", "return false;" ) ObjEvent ( $oLink, "_OnMouseOver" ) Next $uIEOld = $uIE EndIf WEnd Func _OnMouseOver ( ) Local $o_link = @COM_EventObj If $o_link <> $o_linkOld Then If StringInStr ( $o_link.href, '//' ) Then ConsoleWrite ( $o_link.href & @Crlf ) $o_linkOld = $o_link EndIf EndFunc ;==> _OnMouseOver ( ) Edited September 16, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now