Sign in to follow this  
Followers 0
LondonNDIB

Interact with PDF controls in IE?

5 posts in this topic

I'm trying to automate a process - interacting with the web based shipping software at my shipper's site.

I got most of the way... the very final step is it displays a webpage with two frames - the lower of which is a PDF document, so the adobe activex takes over and displays it.

I just want to print that.

I thought I could use something like:

#include <IE.au3>
$oIE = _IECreate ( "http://thepage.com" )
$oFrame = _IEFrameGetObjByName ( $oIE, "viewLabel" )
_IEAction ( $oFrame, "printdefault" )

But it says its an invalid object, so I guess frames can't be used.

Anything you can think of? Another option, if it is easier, is to SAVE the pdf, but again I can't seem to get that to work. It just wants to save the HTML of the frameset page.

Thanks.

LD

Share this post


Link to post
Share on other sites



I thought I figured out something using window controls:

ControlClick ( "Shipping label", "", "[CLASS:AVL_AVView; INSTANCE:26]", "left", 1, 25, 20 )

But its weird... I can SEE it click the button! But the resulting print dialogue doesn't come up!!! However, if I click it manually, it does! The button flashes like its been clicked, but nothing happens. Same with Save or any of the other controls - they react (look like a mouse clicked it) but nothing happens until I do it manually.

LD

Share this post


Link to post
Share on other sites

You'll need to continue with the ideas in your reply. IE.au3 acts on the browser DOM hosted inside IE. The PDF control is hosted inside IE in the same way that a document with the DOM is and does not offer the same object model, thus is not supported by IE.au3.

Dale

p.s. sorry, don't have an answer for your click problem


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Alright, thanks!

This works!

$mousepos = ControlGetPos ( "Shipping label", "", "[CLASS:AVL_AVView; INSTANCE:26]" )

Opt ( "MouseCoordMode", 0 )

MouseClick ( "left", $mousepos[0] + 25, $mousepos[1] + 40, 1, 0 )

Its a bit messy, and I wouldn't want to do this if it were meant for various systems - but because it is for automating my own task on my own machine, I'm happy with it.

LD

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@LondonNDIB

This gives you an PDF reader in a au3 Gui.

It might give you a start on getting it going.

#include <GUIConstants.au3>
#NoTrayIcon

;Vars
Dim $oMyError
Dim $File
Dim $Version


;Declare objects
$oPDF = ObjCreate("AcroPDF.PDF")
$File="C:\Reader.pdf"


$Version=$oPDF.GetVersions

;Main Gui
GuiCreate("PDF Object", 802, 590,(@DesktopWidth-802)/2, (@DesktopHeight-590)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUI_ActiveX = GUICtrlCreateObj ($oPDF, 10, 10 , 780 , 550)
GUICtrlSetStyle ( $GUI_ActiveX,  $WS_VISIBLE )
GUICtrlSetResizing ($GUI_ActiveX,$GUI_DOCKAUTO)     ; Auto Resize Object
    
    
GuiSetState()

MsgBox(0,"Show Versions",$Version)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
$oPDF = ""
$GUIActiveX = ""
Exit

;This is SvenP 's custom error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

Regards,

ptrex

Edited by ptrex

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