Copy link to clipboard
Copied
I made an action to clear guides and call it from a script but in case there are no guides this error apears.
Is it possible to not show this error if there are no guides in the current document?
I did not find function doScript in Illustrator scripting guide.
I offer two solutions.
(function() {
if(app.documents.length <= 0) {return ;}
// solution 1: set app.userInteractionLevel to UserInteractionLevel.DONTDISPLAYALERTS
var oldInteractionLevel = app.userInteractionLevel ;
try {
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS ;
app.doScript('Clear Guide', 'Set Name') ;
...
Copy link to clipboard
Copied
I offer two solutions.
(function() {
if(app.documents.length <= 0) {return ;}
// solution 1: set app.userInteractionLevel to UserInteractionLevel.DONTDISPLAYALERTS
var oldInteractionLevel = app.userInteractionLevel ;
try {
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS ;
app.doScript('Clear Guide', 'Set Name') ;
} finally {
app.userInteractionLevel = oldInteractionLevel ;
}
// solution 2: executeMenuCommand
app.executeMenuCommand('clearguide') ;
})() ;