Close Adobe Acrobat 4 (executed via batch) when file name not found

I have developed a solution where a PL/SQL Oracle API generates the file name of a PDF (inc. full file path) that requires printing (parameter 1) and then using the DBMS_SCHEDULER passes both that file name and a printer name (parameter 2) to the following batch file:

    "C:\Program Files (x86)\Adobe\Acrobat 4.0\Reader\AcroRd32.exe" /t %1 %2

However there are occurrences where the file name passed to the batch file does not exist. Because the file does not exist Adobe continues to run (in background). This stops the API from executing again, until someone ends the windows process manually, as the DBMS job is connected to the Adobe instance.

Unfortunately (unless there is a way in Oracle to check if the file exists in the directory) I cannot work around this issue on the Oracle side, therefore I need to tackle it on the Windows side.

Therefore is there any additional logic that I can add to the batch file or any other script that will validate the existence of the file and if the file does not exist then end the process. The solution must be efficient as the printing of the PDF files is time sensitive.

If anyone does have an Oracle side solution for this issue then I will happily supply the relevant code.

Thanks in advance.


Not launching Acrobat is easier than trying to close it. You can just check for the file existence in the batch file using the IF EXIST command:

@IF EXIST %1 (
    "C:\Program Files (x86)\Adobe\Acrobat 4.0\Reader\AcroRd32.exe" /t %1 %2
) ELSE (
    REM optionally report error?

There are ways to check for the file from Oracle, but this is probably simpler since you already have a batch file, unless you want to test and report the error earlier in the process.

Need Your Help

Which package required automatically installed one?

ubuntu dependencies debian apt

I'm using Ubuntu/Debian. There is an automatically installed package (let's call it mypack) I don't know why it is there. Using apt-get autoremove does not remove it, so there should be a manually

How do you use MyList.Contains(MyObject) when NHibernate populates MyList with Proxy Elements

c# .net nhibernate

I have an NHibernate many-to-many relationship. Before adding an item to the relationship I want to test whether the item already exists in the collection. My Add method looks like

Ordering with Linq to SQL c#.NET WCF

c# wcf linq-to-sql sql-order-by

I have a model called ProjectVersion which has the following properties:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.