cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Batch processing - removing entities from xml files and flatten the files

rodney_o_german
5-Regular Member

Batch processing - removing entities from xml files and flatten the files

Here is my script

 

set Arbortext="C:\Program Files (X86) \PTC\Arbortext Editor\bin\x86\editor.exe"

for %%i in (*.xml) do (

"C:\Program Files (X86) \PTC\Arbortext Editor\bin\x86\editor.exe" -c -b "doc_flatten all undeclare" %%i

)

 

I cant get the changes to save to each file.  Any help appreciated.

8 REPLIES 8

In this case you should use the doc_save command and in fact this takes a parameter to allow it to flatten entities too. So, you may either call doc_flatten and doc_save or only doc_save. http://support.ptc.com/help/arbortext/r8.0.0.0/en/index.html#page/Program/acl_ref/help14996.html

Example code:

doc_save(0, 0x2C000)

How do you call 2 functions in same batch process?  if you could provide 2 samples.  one with doc_save alone and one with both.  Thanks.

If you use the all-in-one doc_save method then you don't need to worry about double function calls. The following is untested but should in theory work:

 

set Arbortext="C:\Program Files (X86) \PTC\Arbortext Editor\bin\x86\editor.exe"

for %%i in (*.xml) do (

"C:\Program Files (X86) \PTC\Arbortext Editor\bin\x86\editor.exe" -c -b "doc_save(0, 0x2C000)" %%i

)

This is  the only parameter I could get to work.  And it only saves the file.  It doesn't flatten.      

 

 -c -b "doc_save(0)" %%i)

 

When I put any value after 0 it just runs with no save.  No change to file.

 

I have tried 

(0, 0x2C000)

(0,0x2C000)

(0 0x2C000)

(00x2C000)

 

This worked.  But it only saves xml to xml.

 

-c "doc_save(0,0x0020)" %%i)

 

 

If you want to try both commands side by side then separating with a semicolon (;) should do the job.

I need to be clear.  Nothing is working as far as seeing any changes to the file and having it saved.  The batch only passing the command and the files process and nothing is saved.  The doc_save will save the file with no editing or changes to the file.  The flatten argument does not work in a bat file.  If I open arbortext and put in the command line the "doc_flatten all undeclared" it works for that one file.

"write -flatten both" works for that one file. 

"doc_save" is not a command.  Its a function.  I cannot get it to work on individual files.

 

But with all that said.  I am trying to batch process the doc_flatten and also get the files to save in a batch.  I still cant get that to happen. 

closest I have gotten with no file save.

-c -b "doc_flatten all undeclare" %%i

 

 

Holding my fingers crossed but I may have found it.

-c "doc_flatten all undeclare";save %%i

 

 

Top Tags