🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting
Article #14

how to test if acrobat is already open, file exists

#14
From: matthew_stuehler
Date: Thu, 26 Aug 2004 01:50
33 lines
1728 bytes
All,

I'm trying to write a vbscript (or jscript) that is supposed to open Acrobat, open a file, and then merge a second file to the end of the first.

I've gotten the script to work; however, it fails if Acrobat (or Adobe Reader) is ALREADY open. So, is it possible to test whether the application is already open, and, if it is, get a handle to it?

Also, how do you test whether a file exists?

Here's an excerpt of my current script:

--- Begin code ----

Set objApp = CreateObject("Acroexch.app")
Set objAVDoc = CreateObject("AcroExch.AVDoc")
Path = "c:\doc1.pdf"
If (objAVDoc.Open(Path, Path)) Then
 Set objPDDoc = objAVDoc.GetPDDoc()
 Set objJSO = objPDDoc.GetJSObject
 Path = "c:\doc2.pdf"
 objJSO.insertPages objJSO.numPages-1, Path, 0, 1
end if
objApp.CloseAllDocs
Set objJSO = Nothing
Set objPDDoc = Nothing
Set objAVDoc = Nothing
Set objApp = Nothing

--- end code ----

Many thanks in advance!

Cheers to all,
Matt Stuehler
Technical Details
Message-ID: <3bb5a3dd.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!easynet-monga!easynet.net!demorgan.zen.co.uk!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Thread: 109719,bd39e7f5c26b8bd6,start
X-Google-Attributes: gid109719,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: matthew_stuehler@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!easynet-monga!easynet.net!demorgan.zen.co.uk!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting
Subject: how to test if acrobat is already open, file exists
Message-ID: <3bb5a3dd.-1@webx.la2eafNXanI>
Date: Wed, 25 Aug 2004 18:50:34 -0700
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit