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

The object "Clear Guides" is not currently available.

Engaged ,
Oct 20, 2024 Oct 20, 2024

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
299
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

Enthusiast , 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') ;
...
Translate
Adobe
Enthusiast ,
Oct 20, 2024 Oct 20, 2024
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') ;
})() ;
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