Skip to main content
Participating Frequently
July 23, 2018
Answered

AppleScript turn off layer with quote mark in layer name

  • July 23, 2018
  • 2 replies
  • 914 views

I'm having lots of trouble because my layer name has a quote mark in it:

0.5" TAPE STRIP

This is my part of the script below:

try

  tell active document

  set visible of layer "XXXX" to false

  end tell

  end try

Any idea how I can turn this layer off? I have hundreds of customer suppled files.

This topic has been closed for replies.
Correct answer Kevin Parrott

Hi

You will need to escape (back slash) the special character, which is the extra quote

so something like this will work    "0.5\" TAPE STRIP"

tell application "Adobe InDesign CC 2018"

    activate

    set myDocument to active document

    tell myDocument

        if exists layer "0.5\" TAPE STRIP" then set visible of layer "0.5\" TAPE STRIP" to false

    end tell

end tell

2 replies

Kevin ParrottCorrect answer
Inspiring
July 23, 2018

Hi

You will need to escape (back slash) the special character, which is the extra quote

so something like this will work    "0.5\" TAPE STRIP"

tell application "Adobe InDesign CC 2018"

    activate

    set myDocument to active document

    tell myDocument

        if exists layer "0.5\" TAPE STRIP" then set visible of layer "0.5\" TAPE STRIP" to false

    end tell

end tell

Participating Frequently
July 24, 2018

Thanks Kevin - That worked Perfect!

Community Expert
July 23, 2018

Hi Kermit,

don't know if tripple fencing* will help with AppleScript:

try

  tell active document

    set visible of layer '''0.5" TAPE STRIP''' to false

  end tell

end try

* That three times ' before and three times ' after the string.

Regards,

Uwe

Participating Frequently
July 23, 2018

The didn't work for me - still go the error, "Expected expression, property or key form, etc. but found unknown token."

I thought maybe I could do something like this:

set visible of layer whose name contains "TAPE" to false

but nothing happens when I run the script.