Code not executing when stepping through code in ExtendScript Toolkit

Explorer ,
Dec 23, 2020 Dec 23, 2020

Copy link to clipboard

Copied

Background: Win10, Indesign 15.1.2 x64

(Disclaimer: yes, I know VS Code is the thing to use now... I'm still working on setting it up and my IT Dept controls installs/etc and so I'm waiting on them as well...so for the time being, I'm using the oldy, ESKT... and maybe this is related to my issue? Don't know)
In the current scenario, I'm targeting Indesign 2020... the script requires a selection, in this case a selection of tables...
In the past when I used a breakpoint and then the stepthrough down-arrow "Step into function call in the current line" and step through lines, it always seemed to execute anything and so I would monitor variable content in the Data Browser, but also see results of code executing in real time, in the open Indesign doc... (moving things, resizing, recoloring, etc).

 

Like this: 

var formatTable = myTables[0];
var columnToFormat = formatTable.columns[0];
columnToFormat.cells[4].fillColor = app.activeDocument.swatches.itemByName('3/8 - 254 225 25');

 

Well, lately I've observed this weird thing where it won't execute lines like the last one above, until after I hit the stop button after stepping into code and past breakpoint... OR if the above lines are in a for loop, it (3rd line above) won't execute until after going through the loop once, through the line again and then a few lines later, at what appears to be a random spot and at a line wholly unrelated, it will finally execute... and continuing stepping through the loop, every proceeding execution follows the same pattern... ie executing as if on some kind of delay... Everything else, like variable assignments, write to console, etc happen at the line they are supposed to as indicated in the Data Browser/Console...

What is going on? Makes no sense to me, and is rather confusing to me, a scripting beginner... My learning of this is greatly improved when things work logically and sequentially... but this is not doing that.

TOPICS
Scripting

Views

103

Likes

Translate

Translate

Report

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

correct answers 1 Correct Answer

Guide , Dec 24, 2020 Dec 24, 2020
The display is not always refreshed during script execution. Sometimes it helps to force a recompose.Using ESTK's console panel, execute the following line while stepping around.app.activeDocument.recompose()

Likes

Translate

Translate
Guide ,
Dec 24, 2020 Dec 24, 2020

Copy link to clipboard

Copied

The display is not always refreshed during script execution. Sometimes it helps to force a recompose.

Using ESTK's console panel, execute the following line while stepping around.

app.activeDocument.recompose()

 

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Dec 25, 2020 Dec 25, 2020

Copy link to clipboard

Copied

(Disclaimer: yes, I know VS Code is the thing to use now... I'm still working on setting it up)

 

I wouldn't bother if I were you. The ESTK works just fine on Windows (apart from a couple of ancient bugs which are just annoying, nothing really major). The ESTK is often confused with ExtendScript: the ESTK is a script editor in which you write scripts in ExtendScript (Adobe's version of JavaScript).

 

The main critisism levelled at ExtendScript is that its version of JavaScript is old and was never updated. But the VSCode ExtendScript plug-in doesn't change that at all, it uses the same ExtendScript.

 

Using the VSCode ExtendScript plug-in on Windows is an act of self-harm in my opinion.

 

Peter

Likes

Translate

Translate

Report

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
Explorer ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

LATEST

Thank you Dirk and Peter! for your helpful answers. 

I agree Peter; I had doubts because of other things I was reading and seeing people say, but wrestling with VScode did feel like self-harm sometimes :), but hearing your expert opinion makes me feel better. It's a great way to start a new year of scripting!

Likes

Translate

Translate

Report

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