Script Batch plot Problem

I use a scripting program for batch plotting. The problem I'm having is when running the script it comes across an open drawing in the batch; the script
doesn't know how to deal with this. The question WOULD YOU LIKE TO OPEN THE FILE READ-ONLY could be answered YES with the first line in the script and it would solve it but when it gets to an unopened drawing having YES as the first command stops it in its tracks.
Here's the script file I'm using
TileMode 0 -PLOT y
Oce TDS400 Roll 1.pc3 ISO A1 (841.00 x 594.00 MM) millimeters Landscape NO Extents FIT Center Yes A1.ctb Yes No No No No No Yes
I don't know much about LISP but maybe a bit of code at the start could solve it.
Thanks Mik
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Assuming you are in MDI mode, the following bit of code should open the drawing regardless of whether it's currently open or not.
(vlax-invoke-method (vlax-invoke-method (vlax-get (vlax-get-acad-object) "Documents") "Open" "X:\\MyPath\MyDrawing.dwg") "Activate")

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks for the quick reply. But it doesn't seem to work!

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Works here. What version of AutoCAD?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ADT 3.3 I think the problem is that the script running program concerns itself with opening the drawings, so by the time the code kicks in its already too late.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.