Skip to main content
1-Visitor
January 12, 2011
Solved

Batch Process with Macro to Change Name

  • January 12, 2011
  • 2 replies
  • 8493 views

Hello,

I have a strange problem that I didnt think I would encounter. I am using the Batch Process with a Macro to convert files. One of the things in this macro is to change the active document name to the contents of a variable:

activeDoc.name = strICN

Unfortunately when running the macro using the batch process it doesnt change the name - it keeps the original file name and seems to ignore this command. If I run the Macro within Isodraw it then changes it, and I can then save this manually - however I would prefer to avoid doing this 250 times.

The only thing I can think of is that when using the batch process the file is not an ''active' document so the command will not work (just guessing here), if this is the case how do I change the file name when using the batch process? or is their a command that changes the filename whether it is active or not?

Many thanks for your assistance.

Alan

    Best answer by TimSharp

    Just a thought.

    What about adding a save command in your macro? You could save it with your new filename in the macro. The batch process would still save the file again with the original filename, so you'd have some files to remove, but you should then have your updated files.

    2 replies

    1-Visitor
    January 12, 2011

    Does your macro actually load the drawings into Isodraw as it works? If so, I would have thought that activeDoc was valid once a drawing is loaded. If not, I think you are right that activeDoc isn't being created for the files you're working on, so maybe the document object would do it, rather than activedoc?

    acs_alan1-VisitorAuthor
    1-Visitor
    January 12, 2011

    I assume that the Batch Process does open the document to apply the macro, but maybe it isnt classed as an active document as it doesnt open it in the sense that we would manually open a file and theirfore it isnt an active document. But I dont fully understand what the Batch Process actually does behind the scenes - i cannot find this information in the reference material.

    When I manually open the file inside isodraw and execute the macro it works perfectly, changing the name of the document, and because it doesnt work using the batch process this makes me think that when the macro is being applied via the batch process, the file is not considered an active document.

    I will give your suggestion a try - thanks.

    1-Visitor
    January 12, 2011

    I've never tried this with the IML but in my previous life as a CAD macro programmer, current document commands in a batch process would only work if the documents (drawings) were physically loaded at the time the current document commands were run.

    Does your batch process actually load files into Isodraw? i.e. do you see them being loaded, then removed and the next one loaded etc?

    acs_alan1-VisitorAuthor
    1-Visitor
    January 12, 2011

    Thanks for all the direction and suggestions, I will implement this first thing in the morning - my head is battered and I am going home.

    Much appreciation to you both.

    Alan