Copy link to clipboard
Copied
I have read that one can use AI for generating code, but I have next to none experience with coding. I am merely curious as whether anybody has tried this with FrameMaker?
Copy link to clipboard
Copied
I have used ChatGPT for generating XSLT code, but not ExtendScript.
Copy link to clipboard
Copied
There was a short discussion some time ago about generating a list of variables, so fiddled around with a prompt for that in ChatGPT. Doesn't seem to work though. And since I have no idea what I am doing, I can't trouble shoot it either. This is what it looks like:
var doc = app.ActiveDoc;
var variables = doc.GetVarFmtNames();
var varList = "";
for (var i = 0; i < variables.length; i++) {
varList += variables[i] + ": " + doc.GetNamedVarFmt(variables[i]).Contents + "\n";
}
alert(varList);
Copy link to clipboard
Copied
When it comes to FrameMaker ExtendScript, AI is dumb. Here is a smart solution:
#target framemaker
var varFmtList, doc, varFmt;
varFmtList = [];
doc = app.ActiveDoc;
varFmt = doc.FirstVarFmtInDoc;
while (varFmt.ObjectValid () === 1) {
varFmtList.push (varFmt.Name + ": " + varFmt.Fmt);
varFmt = varFmt.NextVarFmtInDoc;
}
alert (varFmtList.join ("\r"));