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

Another execution glitch

Engaged ,
Oct 28, 2024 Oct 28, 2024

I'm surprised at the number of glitches that occur when running ExtendScript. Here's another one: 

 

    ...
    app.executeMenuCommand('deselectall');
    alert(doc.selection.length); // not 0

    while (doc.selection.length !== 0) {
        app.executeMenuCommand('deselectall');
    }
    // at this point the app freezes
    alert(doc.selection.length); // not reached
    ...

 

Opinions, advice?
TOPICS
Scripting
295
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

correct answers 1 Correct answer

Community Expert , Oct 28, 2024 Oct 28, 2024

@andyf65867865 - It is working as expected, but at times the application does not get updated.

Try using the 

app.redraw();

after

 app.executeMenuCommand('deselectall');

like

app.executeMenuCommand('deselectall');
app.redraw();

 

Please note , the redraw is also very slow. Generally we try to minimize dealings with the DOM as much as possible to avoid slow-downs.

Translate
Adobe
Community Expert ,
Oct 28, 2024 Oct 28, 2024

@andyf65867865 - It is working as expected, but at times the application does not get updated.

Try using the 

app.redraw();

after

 app.executeMenuCommand('deselectall');

like

app.executeMenuCommand('deselectall');
app.redraw();

 

Please note , the redraw is also very slow. Generally we try to minimize dealings with the DOM as much as possible to avoid slow-downs.

Best regards
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
Engaged ,
Oct 28, 2024 Oct 28, 2024
LATEST

@Charu Rajput in my example I tried to use redraw() after each `deselectall` and used a test alert inside `while` - and this alert was shown, it turns out that one redraw is not enough

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