Perhaps I am missing something obvious, but what does this mean: “Not use a ‘tab’ as delimiter but another space-type”?
I was getting a syntax error… I see how that our forum also changes the “-” to an en dash! That is strange. So line 14 and 15 were causing problems until I changed the code to this:
/*
_FRIdNGE-0662_Justif-Center.jsx
Script written by FRIdNGE, Michel Allio [26/10/2020]
See: https://creativepro.com/topic/hanging-indents-on-centered-text/ [Flavio Mini, 21/10/2020]
Object: Left-indent calculated on para first line parameters. Not use a “tab” as delimiter but another space-type.
*/
app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Justif-Center! …");
function main()
{
var mySel = app.selection[0].paragraphs[0],
myLeft = mySel.lines[0].insertionPoints[0].horizontalOffset - app.selection[0].parentTextFrames[0].geometricBounds[1];
myRight = app.selection[0].parentTextFrames[0].geometricBounds[3] - mySel.lines[0].insertionPoints[-2].horizontalOffset;
mySel.justification = Justification.LEFT_ALIGN;
mySel.leftIndent = myLeft;
mySel.rightIndent = myRight;
mySel.firstLineIndent = -myLeft + myRight;
}