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

The object "Clear Guides" is not currently available.

Contributor ,
Oct 20, 2024 Oct 20, 2024

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?  

sd.png

 

I did not find function doScript in Illustrator scripting guide.

 

TOPICS
Scripting

Views

180

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

Community Expert , Oct 20, 2024 Oct 20, 2024

I offer two solutions.

 

  1. Set app.userInteractionLevel to UserInteractionLevel.DONTDISPLAYALERTS before executing the action
  2. Use executeMenuCommand instead of the action
(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') ;
...

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

LATEST

I offer two solutions.

 

  1. Set app.userInteractionLevel to UserInteractionLevel.DONTDISPLAYALERTS before executing the action
  2. Use executeMenuCommand instead of the action
(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') ;
})() ;

Votes

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