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

Suspend UI during script execution

Explorer ,
Aug 15, 2020 Aug 15, 2020

Hi all,

Is there anyway to suspend Illustrator UI while a script executes? 

TOPICS
Scripting
789
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
Adobe
Community Expert ,
Aug 16, 2020 Aug 16, 2020

This might not be what you want, but have you looked at userInteractionLevel?

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS

 

(The other UserInteractionLevel is .DISPLAYALERTS)

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
Explorer ,
Aug 16, 2020 Aug 16, 2020

Yes I have looked at this, I believe this is only for popup alerts. 

 

For example I have a script right now that currently goes through and selects different objects one at a time, makes the edit and moves on to the next object until complete. Illustrator currently renders the preview to highlight the selection, the same as when the user is manually selecting the object. My thought process is that if illustrator does not have to update the preview at the same time as running the script then it may help script performance.

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 ,
Aug 16, 2020 Aug 16, 2020

rutgers_camden, is that normal behaviour (that "Illustrator currently renders the preview to highlight the selection, the same as when the user is manually selecting the object")? In my scripts the UI doesn't seem to be updated during a script unless I explicitly call app.redraw(). Are you calling redraw?

 

CarlosCanto, that's interesting! I've never thought to do that to speed up a script, again, because I've never noticed the UI updating during execution.

 

On the contrary, I've sometimes inserted app.redraw() to give a visual update or to provide several undos vs one undo for the whole script action.

 

As a side note: in my experience, setting the selection is bizarrely *slow*. For example, a script that deletes every 2nd pageItem will be way faster than a script that selects every 2nd pageItem. Have you guys found that? So, rutgers_camden is there a way you could get your script working without the selecting part?

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 ,
Aug 16, 2020 Aug 16, 2020

@m1b absolutely, selecting triggers at least selected element redraw (if not the whole screen). As well as panels redraw. So it's best not to select anything or force redraw(), only use when absolutely necessary.

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 ,
Aug 16, 2020 Aug 16, 2020

I don't think it's possible, but you're right, redrawing the screen takes a toll on performance.

 

as a workaround, at the beginning of my scripts I turn Preview Off. Working in Outline mode is way more efficient.

 

The UI also gets constantly redrawn, so if you can work at Full Screen (no toolbars or panels) that also helps.

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 ,
Aug 17, 2020 Aug 17, 2020

Thanks Carlos for this information. 🙂

I have not yet tested. But I will try to set screenMode before the automation script and when process completes we can set the screen mode back to normal.

Just adding more information to do this via script

if(app.documents.length > 0){
    app.activeDocument.views[0].screenMode = ScreenMode.FULLSCREEN
}

 I hope this helps in CEP panels as well.

 

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
Community Expert ,
Aug 17, 2020 Aug 17, 2020
LATEST

you're welcome, 

ScreenMode.FULLSCREEN

 used to be rock solid in previous versions. Lately it has given me mixed results, it not always work. At least setting Preview off still works, that's the real time saver.

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