Jump to content

Acrobat OLE Attach to open window


corgano
 Share

Recommended Posts

How do I attach to the active acrobat window and get it's javascript object? I know how to do this when i know the filename:

$oAcro = ObjCreate("acroexch.app")
$oPDF = ObjCreate("AcroExch.PDDoc")

$File = @ScriptDir&"\test.PDF"

$oPDF.Open($File)
$oJSpdf = $oPDF.getJSObject.app.opendoc($File)

But how would i do this if I didn't know $File? If I wanted to connect to the Active window instead?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

what I know I can get is the handle of the window and the process ID... Is there a way I can get the OLE object of a process by Process ID?

Say we used something more familiar, like IE. If there was an IE window already running, and we had it's process ID, could we get It's OLE object and automate it?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Found it! Acrobat has something to help us

$oAcro = ObjCreate("acroexch.app")  ;Create acrobat object
;~ $oPDF = ObjCreate("AcroExch.PDDoc")
Do
    sleep(300)
    $oPDF = $oAcro.GetActiveDoc.GetPDDoc
Until $oPDF <> ""
$oJSpdf = $oPDF.getJSObject

$File = $oJSpdf.path

If anyone needs help with acrobat,.I'm getting pretty good at using it. Sad part is some things only work with pro version

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

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

×
×
  • Create New...