Jump to content

ControlClick in Adobe Acrobat Reader plugin


EMF
 Share

Recommended Posts

All right, I've fought this with for a few hours now, and I'm coming here to ask.

Background: The browser has a window with a generated PDF in the Adobe Acrobat plugin. I need to save that PDF to a file for later transfer.

Notes: Disabling the PDF plugin to the browser is not an option.

Issue: ControlClick returns "success", but I don't get the "Save As" window.

Here's the code I'm using.

ShellExecute("http://devbox/test.pdf")

; Get handle to prove that the window's opened
$whndPDF=""
while ($whndPDF=="")
    $whndPDF=ControlGetHandle ( "test.pdf", "", "[CLASS:AVL_AVView; INSTANCE:21]")
    sleep(1000)
WEnd
MsgBox(0,"ControlGetHandle",$whndPDF & @error,3)  ; This gives me a successful hexcode for the control...

; Try to save the PDF
ControlFocus("test.pdf", "AVToolBarEasel", "AVL_AVView21")

; This returns 1, saying it successfully returned, but there's no "Save As" window.
$Check=ControlClick("test.pdf", "AVToolBarEasel", "[CLASS:AVL_AVView; INSTANCE:21]", "primary", 1, 64, 20 ) 
MsgBox(0,"ControlClick",$Check,3)  

; Tried this, too, in case it couldn't handle the "advanced" class convention... no dice.
;$Check=ControlClick("test.pdf", "AVToolBarEasel", "AVL_AVView21", "primary", 1, 64, 20 ) 
;MsgBox(0,"ControlClick",$Check,3)

And here's the WindowInfo output:

>>>> Window <<<<
Title:  test.pdf (application/pdf Object) - Mozilla Firefox
Class:  MozillaUIWindowClass
Position:   7, 71
Size:   1280, 862
Style:  0x14CF0000
ExStyle:    0x00000100
Handle: 0x000A0918

>>>> Control <<<<
Class:  AVL_AVView
Instance:   21
ClassnameNN:    AVL_AVView21
Advanced (Class):   [CLASS:AVL_AVView; INSTANCE:21]
ID: 
Text:   AVToolBarEasel
Position:   0, 111
Size:   1264, 38
ControlClick Coords:    64, 20
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x000408EE

Help?

Link to comment
Share on other sites

You are trying to do a controlclick in Firefox. look for ff.au3. It will do what you need.

My apologies; my devbox defaults to Firefox, but the end-user script is going to have to run on IE. Here's the AutoIT window output for the IE window:

>>>> Window <<<<
Title:  http://devbox/test.pdf - Windows Internet Explorer
Class:  IEFrame
Position:   36, 168
Size:   1022, 708
Style:  0x16CF0000
ExStyle:    0x00000100
Handle: 0x000E07DC

>>>> Control <<<<
Class:  AVL_AVView
Instance:   21
ClassnameNN:    AVL_AVView21
Advanced (Class):   [CLASS:AVL_AVView; INSTANCE:21]
ID: 
Text:   AVToolBarEasel
Position:   0, 119
Size:   1006, 38
ControlClick Coords:    59, 15
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x00010AB6

And the slightly updated .au3 code to deal with the difference in the title bar:

; Get handle to prove that the window's opened
$whndPDF=""
while ($whndPDF=="")
    $whndPDF=ControlGetHandle ( "http://devbox/test.pdf", "", "[CLASS:AVL_AVView; INSTANCE:21]")
    sleep(1000)
WEnd
MsgBox(0,"ControlGetHandle",$whndPDF & @error,3)  ; This gives me a successful hexcode for the control...

; Try to save the PDF
ControlFocus("http://devbox/test.pdf", "AVToolBarEasel", "AVL_AVView21")

; This returns 1, saying it successfully returned, but there's no "Save As" window.
$Check=ControlClick("http://devbox/test.pdf", "AVToolBarEasel", "[CLASS:AVL_AVView; INSTANCE:21]", "primary", 1, 64, 20 )
MsgBox(0,"ControlClick",$Check,3)

I am using IE.au3 for the "larger" script, as opposed to just the chunk that doesn't seem to be working. I will go look at ff.au3 in case it lights up any bulbs, but any nudge towards what I'm looking for will be helpful.

Edited by EMF
Link to comment
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
 Share

  • Recently Browsing   0 members

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