Copy link to clipboard
Copied
Hey, I'm trying to remove a hard return I have in some of my script labels on an InDesign document, but keep getting the error. Each page has multiple layers each with a text item that contains the label.
Here's the script:
tell application "Adobe InDesign CC 2018"
tell document 1
set label of (every text frame whose label is "Filename
") to "Filename"
end tell
end tell
Thanks!
I get the same error if there are no text frames in the document with the "Filename" & return label—it worked the first time, but not when I ran it again. I think you need to catch that error:
tell application "Adobe InDesign CC 2018"
tell document 1
try
set label of (every text frame whose label is "Filename" & return) to "Filename"
end try
end tell
end tell
Copy link to clipboard
Copied
For writing the return character in the code type \r so the line should be
set label of (every text frame whose label is "Filename\r") to "Filename"
When you then execute the applescript editor does change \r to a new line but the code does work. Tested it on CC2020
-Manan
Copy link to clipboard
Copied
I get the same error if there are no text frames in the document with the "Filename" & return label—it worked the first time, but not when I ran it again. I think you need to catch that error:
tell application "Adobe InDesign CC 2018"
tell document 1
try
set label of (every text frame whose label is "Filename" & return) to "Filename"
end try
end tell
end tell
Copy link to clipboard
Copied
I always use "(return)" for a Carriage Return:
set label of (every text frame whose label is ("Filename" & (return))) to "Filename"
Also, I set the label of an item after typing it by using the Enter key (not the Return key).
Copy link to clipboard
Copied
The script works with either \r or & return, but only once—you need the try statement.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now