Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Insert special characters by script

Explorer ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

Hi,

i'm trying to insert that special character within an Applescript script (see below the capture of the menu item — sorry for the french labels, i don't know how it translate in english):

Capture d’écran 2021-08-09 à 12.13.36.png

 I can't find it in the Applescript dictionary.

I could change tabs in that special character with a search and replace afterwards in my script, but i would prefer coding it directly in the script if possible.

TOPICS
Scripting

Views

106

Likes

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

Adobe Community Professional , Aug 09, 2021 Aug 09, 2021
Also if you want to get the id for other special characters, insert the character, select it, and run this: tell application "Adobe InDesign 2021" set x to selection as Unicode text display dialog id of x end tell

Likes

Translate

Translate
Explorer ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

I found the answer in that old but still relevant pdf. The way to express that special character is with an enumeration item called "right indent tab".

 

I was unable to find the relevant enumeration list in the InDesign Applescript dictionary (via the Script Debugger app): the items are in the dictionary, but not the enumeration list, so if you don't know the item name, bad luck 🙂

 

At least in Appelscript (i don't know if ,the logicnis the same in JS), i found that you must insert that sort of special character in its own "set insertion point x" line. If you mix the special character with other strings ("text1" & right indent tab & "text2"), the string "right indent tab" will be inserted instead of the special character.

tell application "Adobe InDesign 2021"
    tell document 1
        set insertion point -1 of parentStory to "prefix"
        set insertion point -1 of parentStory to right indent tab
        set insertion point -1 of parentStory to "suffix" & return
    end tell
end tell

 

Likes

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
Adobe Community Professional ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

You could also try getting the right tab indent’s ID and storing it in a variable.  So this seems to work:

 

 

 

 

set rti to string id {8}
tell application "Adobe InDesign 2021"
	tell document 1
		set insertion point -1 of parentStory to "prefix" & rti & "suffix" & return
	end tell
end tell

 

 

 

Likes

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
Explorer ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

much better, thanks @rob day 

Likes

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
Explorer ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

@rob day i replied too soon, i still have a question: where do you get the right tab indent’s ID?

Likes

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
Adobe Community Professional ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

Also if you want to get the id for other special characters, insert the character, select it, and run this:

 

 

 

tell application "Adobe InDesign 2021"
	set x to selection as Unicode text
	display dialog id of x
end tell

 

 

Likes

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
Explorer ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

you're too fast, thanks 🙂

Likes

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
Participant ,
Aug 13, 2021 Aug 13, 2021

Copy link to clipboard

Copied

Hi:

 

As always, Rob has the answer! I would just like to add as an FYI that: 

- Many special characters can be handled reliably with a single unicode id, such as the Right Indent Tab above. However, you might have a situation which a single character might not suffice or be reliable. In that case, another method  is to use Adobe Tagged Text files: export and import a file such as this: 

 

<UNICODE-MAC>
<vsn:15.1>
<pstyle:header><cstyle:header>Continued from Page <cpnt:Previous><cpnt:><cstyle:>

 

 

Likes

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
Participant ,
Aug 13, 2021 Aug 13, 2021

Copy link to clipboard

Copied

LATEST

FYI Vincent, adding that I often use BBEdit to do this, and other text editors have ways to get these IDs. Just remember that other apps may use these special characters for other things. For example,  Quark could use ID 8 for something else.

Likes

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