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.

Answers


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

Running Node.js Server using User Level Root

javascript node.js apache localhost server

Basic question but not sure where to turn to start figuring this out.

Android Webview Simulator versus Device within PopupWindow

android android-emulator android-webview popupwindow

I am attempting to contain a WebView within a PopupWindow. The WebView is to display Wikipedia pages.

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.