Code to be evaluated! [016] Tabs Position! …
Hi All,
The deal is simple:
You select text with tabs and run the script below! You just need to enter the new font size!

The script seems to work! The position of the tabs is recalculated, depending on the new font size, here 16 pts => 8 pts!

… If I want to go back (no undo!): 8 pts => 16 pts and run the script again:

No idea to correct this! Thanks for help! ![]()
var w = new Window ('dialog {alignChildren: "top"}', 'New Tabs position! …');
w.alignChildren = "right";
var group1 = w.add ('group');
group1.add ('statictext {text: "New Font Size:"}');
var UIy = group1.add ("edittext", undefined, 0);
UIy.characters = 5;
UIy.minimumSize.width = 60;
UIy.maximumSize.width = 60;
UIy.active = true;
var buttons = w.add ('group {alignment: "center"}');
buttons.add ('button {text: "OK"}');
buttons.add ('button {text: "Cancel"}');
var group2 = w.add ('group');
group2.add ('statictext {text: "(by Michel Allio, March 2017)"}');
if ( w.show () == 1 ) var y = Number (UIy.text);
else exit();
app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "New Tabs position! …");
function main()
{
var mySel = app.selection[0],
myStops = mySel.tabStops,
S = myStops.length,
x = mySel.pointSize;
mySel.pointSize = y;
for ( var s = 0 ; s < S; s++ ) myStops
.position = myStops.position/x*y;}
(^/)