Suspend UI during script execution
Copy link to clipboard
Copied
Hi all,
Is there anyway to suspend Illustrator UI while a script executes?
Explore related tutorials & articles
Copy link to clipboard
Copied
This might not be what you want, but have you looked at userInteractionLevel?
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS
(The other UserInteractionLevel is .DISPLAYALERTS)
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
@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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.

