Jump to content

Recommended Posts

Posted

Hi

I need to get the link contained in the text of an internet explorer tab, in the tab I need to get this url, it's a pdf file.

But the address and filename are generated dynamically. I've tried some features and nothing is working ...

Follow the code below ...

#include <IE.au3>

;WinActivate("[CLASS:Notepad]", "")

$_IeTabUrls = _GetIeTabs ( )

$_K = 0
For $_I = 1 To UBound ( $_IeTabUrls ) -1
    If $_IeTabUrls[$_I][0] <> $_IeTabUrls[$_I-1][0] Then
        $_K+=1
        ;ConsoleWrite ( $_K & '° IE Window Hwnd : ' & $_IeTabUrls[$_I][0] & @CRLF )
    EndIf
    ;ConsoleWrite ( '+ IE Tab Object LocationUrl : ' & $_IeTabUrls[$_I][1].LocationUrl & @CRLF )
    ;ConsoleWrite ( '+ IE Tab Object Title : ' & _IEPropertyGet($_IeTabUrls[$_I][1], "title") & @CRLF )
    If _IEPropertyGet($_IeTabUrls[$_I][1], "title") = "BVP Next" Then
       $oIEB = $_IeTabUrls[$_I][1]
    EndIf
    ;If _IEPropertyGet($_IeTabUrls[$_I][1], "title") = "FRM TESTE" Then
    ;   $oIEP = $_IeTabUrls[$_I][1]
    ;EndIf
Next

$oIEB.document.parentwindow.execScript("$('#divImpressoraRemota').remove();")
$oIEB.document.parentwindow.execScript("$('div .ui-dialog-buttonset button .ui-button-text').each(function(index, elm) { if (elm.innerHTML == 'Imprimir') { elm.click(); } });")

;Sleep(3000)
;Local $scriptCode = " var url = RetornarURLCompleta('Reports/Relatorio/RelPropostaFisica'); alert(url); "
;$scriptCode &= " var teste = Custom_IncluirTokenChamada({ CD_PROPOSTA: 0, TIPO: '', CD_PRODUTO: codigoProduto }); alert(teste); "
;$oIEB.document.parentwindow.execScript("alert(codigoProduto);")
$oIEB.document.parentwindow.execScript("window.open('http://www.google.com','Proposta');")
Sleep(1000)
$oIEB.document.parentwindow.execScript("$('#Apolice').click();")


isObj($oIEB)
$oIEB = _IEAttach ("", "Proposta", 2)

$_IeTabUrls = _GetIeTabs ( )
$_KX = 0
For $_I = 1 To UBound ( $_IeTabUrls ) -1
    If $_IeTabUrls[$_I][0] <> $_IeTabUrls[$_I-1][0] Then
        $_KX+=1
   EndIf
   ConsoleWrite ( '+ IE Tab Object LocationUrl : ' & $_IeTabUrls[$_I][1].LocationUrl & @CRLF )
   ConsoleWrite ( '+ IE Tab Object Title : ' & _IEPropertyGet($_IeTabUrls[$_I][1], "title") & @CRLF )
Next

Func _GetIeTabs ( )
    Local $i = 1, $_WinList = WinList ( '[CLASS:IEFrame]' )
    Dim $_ArrayInfos[100][2]
    While 1
        $oIE = _IEAttach ( '', 'instance', $i )
        If @error = $_IEStatus_NoMatch Then ExitLoop
        For $_I = 1 To UBound ( $_WinList ) -1
            If '0x' & Hex ( $oIE.Hwnd ) = $_WinList[$_I][1] Then
                $_ArrayInfos[$i][0] = $_WinList[$_I][1] ; hwnd
                $_ArrayInfos[$i][1] = $oIE ; tab ie obj
            EndIf
        Next
        $i += 1
     WEnd
    ReDim $_ArrayInfos[$i][2]
    $_ArrayInfos[0][1] = UBound ( $_ArrayInfos ) -1
    Return $_ArrayInfos
 EndFunc ;==> _GetIeTabs ( )

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...