Hi ethanb10986590, I really apologize for the delay in answering this because I may have the solution. I'm not sure how I missed the thread.
Despite what the documentation says, I think this line is wrong:
CallClient("Structure Generator", "GenerateDoc");
Try this instead:
CallClient("Structure Generator", "StructureDoc");
The manual has been wrong forever and if someone hadn't told me via a forum like this, I would have never known. Who could? Anyway, that should help. Although note that I didn't examine any other part of your code in detail.
Thanks for the reply. I changed that line, and the script still failed to produce any output. I commented out the CallClient("Structure Generator", "OutputDocName " + name); line as well thinking there was an issue with saving the document, but frame-maker doesn't seem to ever even generate a new document.
Do you have any links to other places where someone has discussed this. The only other one I found was another unresolved post on this forum. Structure documents method
Ah, found the problem. I noticed this earlier but didn't think it mattered, apparently it does. The other arguments must be all upper case. Like this:
CallClient("Structure Generator", "INPUTDOCID " + doc.id); CallClient("Structure Generator", "RULEDOCID " + CT.id); CallClient("Structure Generator", "OUTPUTDOCNAME " + name); CallClient("Structure Generator", "StructureDoc");
I tested it and it works for me. FWIW, I think this is a shoddy feature of an otherwise very slick API client.
The commands do not need to be uppercase. I tested the script and it works fine. My guess about why it does not work for Ethan is that the result file name is not a full and valid path name. It might also be that the permissions to write into the folder are not set correctly. Just add an alert with the result name to make sure your regular expression does not mess up the file name.
As Russ mentioned, this piece of code is fine except for the API which always returns the code for SUCCESS, no matter what happens. Russ' implementation in all his plug-ins is much better. I am using those return codes all the time.
Well, interestingly enough Jang seems to be right. For some reason, the code did not work initially for me. So I changed the case and it did work. Now I change it back and it continues to work. The files open hidden and the new, converted file is written to the same directory as the originals, as test.fm.
If OutputDocName is not there, you should get a new, unsaved file. So this was a proper troubleshooting step.
I'm not sure what else to say, Ethan. I've run this operation many times in the past and your code works for me. Did you replicate the steps manually just to make sure that the conversion table will actually work?
I got the code to work. Using the "StuctureDoc" call works regardless of whether the other commands are uppercase of not. Not quite sure why it didnt work initially, but it is good now.
Thank you Russ and Jang