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

How to get unicode value of a selected char?

Participant ,
Feb 08, 2010 Feb 08, 2010

Copy link to clipboard

Copied

Hi All

How to get unicode value of a selected char?

TOPICS
Scripting

Views

1.2K

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 , Feb 08, 2010 Feb 08, 2010

The contents property of an InDesign object "Character" is a plain Unicode string. Accessing the individual characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

Therefore, the unicode value of a selected char is

app.selection[0].characters[0].contents.charCodeAt(0)

Votes

Translate

Translate
Community Expert ,
Feb 08, 2010 Feb 08, 2010

Copy link to clipboard

Copied

The contents property of an InDesign object "Character" is a plain Unicode string. Accessing the individual characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

Therefore, the unicode value of a selected char is

app.selection[0].characters[0].contents.charCodeAt(0)

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
Community Expert ,
Feb 08, 2010 Feb 08, 2010

Copy link to clipboard

Copied

AYS. HAKKIM wrote:

How to get unicode value of a selected char?

You will get answer quicker  - if you specify in which language you need help - JS, AS or VB?

robin

www.adobescripts.com

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
Contributor ,
Feb 08, 2010 Feb 08, 2010

Copy link to clipboard

Copied

Hi Hakkim,


It is very easy.Select the character & execute the below code:


For special characters: app.selection[0].contents;


For normal characters: app.selection[0].contents.charCodeAt(0);


Regards,

Ramkumar .P

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
Participant ,
Feb 08, 2010 Feb 08, 2010

Copy link to clipboard

Copied

LATEST

Many thanks to all

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