Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Has anybody had any experience developing extendscripts for FrameMaker using chatgpt (or similar AI)

Community Expert ,
Jul 24, 2023 Jul 24, 2023

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?


Bjørn Smalbro - FrameMaker.dk
246
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2023 Jul 24, 2023

I have used ChatGPT for generating XSLT code, but not ExtendScript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2023 Jul 24, 2023

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);


Bjørn Smalbro - FrameMaker.dk
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2023 Jul 24, 2023
LATEST

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"));
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines