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

how tho check if selection is any kind of text:

Advisor ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

ok.. another question:

how tho check if selection is any kind of text:

    if (app.documents.length != 0 && app.selection.length != 0 &&

     (app.selection[0].constructor.name=="Text"||app.selection[0].constructor.name=="Paragraph"))

but sometimes selection is "textStyleRange", sometimes is "character" etc. is there any shortcut to check everything at once?

TOPICS
Scripting

Views

587

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

Advisor , Aug 26, 2012 Aug 26, 2012

I usually do something like this:

if ( app.documents.length && app.selection.length && app.selection [ 0 ].hasOwnProperty ( 'baseline' ) )

     alert ( "It's a text!" );

Hope that helps.

--

Marijan (tomaxxi)

http://tomaxxi.com

Votes

Translate

Translate
Advisor ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

I usually do something like this:

if ( app.documents.length && app.selection.length && app.selection [ 0 ].hasOwnProperty ( 'baseline' ) )

     alert ( "It's a text!" );

Hope that helps.

--

Marijan (tomaxxi)

http://tomaxxi.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
Advisor ,
Aug 27, 2012 Aug 27, 2012

Copy link to clipboard

Copied

LATEST

thanks. that's brilliant!

it works

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