I am new to this so please be patient.
Below is a macro I created. I have added statements to explain what is happening throughout and It works fine if I load a CGM into isodraw and then run the macro.
The problem comes when I call the macro from the batch process tool. That's where it crashes and burns. I have also tried running this from the command line but the same thing happens.
It is pretty clear to me that closing the document is causing the batch tool to go down. So if anyone knows some extra code I could use to just loop within my macro the number of times, equivalent to the number of CGM in my source directory I think it would do the trick.
Any ideas would be appreciated.
One other question: is there a line of code I can use to lock and unlock certain layers?
#Save original document number as string.
DEFINE doc AS string
doc = 'ICN-' + activeDoc.name
#SELECT THE WHOLE DRAWING
MESSAGE "the file's full name is: " + doc
##########works up until here using batch programme###################
#Closes source document
#hard coded to open official Project Pageframe
activeDoc.name = doc
ACTIVATE LAYER "Standard layer"
#Delete existing blank ERM and ICN numbers
Select if Text contains 'ERM'
Select if Text contains 'AAAAAA'
PASTE Selection SAME_POSITION
DEFINE path AS string
path = 'C:\Batchout\'
#MESSAGE "File will be saved as: " path + name + extension
Save path + doc
#Format for running from command line and saving as base iso format
#IsoDraw71.exe -batch -s"C:\Batchin" -d"C:\Batchout" -f0 -m"test"
Only partial answers here unfortunately.
In regards to a method to have the macro cycle through...seemed like I had a better way of doing this before, but here is a screwed up approach since I can't remember
Sounds like overkill but at the moment that's what comes to mind.
In regards to layer locking, no one line code that I'm aware to lock all but one. You'll need to loop over the layers.
Define i as Integer
Define CurrentLayer as Layer
Define LayerName as String
i = ActiveDoc.LayerCount
CurrentLayer = ActiveDoc.Layers[i]
While (Exists(CurrentLayer) = True)
LayerName = CurrentLayer.Name
ActiveDoc.Layers[LayerName].Exportable = False
ActiveDoc.Layers[LayerName].Printable = False
CurrentLayer = CurrentLayer.PreviousSibling
This macro has not been tested but the intent is turn exportability and printing off for each layer. Mod for you purposes. In order to turn one layer on (or off), just add a check of the LayerName to skip what you design. If you'll use this a lot, set it up as a submacro, add a global variable for the layer you want to turn on/off. You can then set the variable and call the submacro whenever needed.