comparing string function for .jxs

Participant ,
Aug 12, 2020

Copy link to clipboard

Copied

Hey everyone,

 

I'm using indesign script which is ( .jsx )  and it's totally diffrent from (.js).  Anyhow, are there any alternative for [ includes() or and comparing string function??]. I've tried 

if ("somedata" in path)

but it passes every time even if it's not in! 

 

i want to compare between image pathes.

 

thanks all.

TOPICS
Activation billing and install, Bug, EPUB, Feature request, How to, Import and export, InCopy workflow, Performance, Print, Publish online, Scripting, SDK, Server developers, Sync and storage, Type

Views

123

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Aug 12, 2020
brianp311 Adobe Community Professional , Aug 12, 2020
Look at the String.indexOf and String.match methods here: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#String.html if (str1.indexOf("str2") >= 0 ) or  if (str1.match(/regularExpression/)

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Aug 12, 2020

Copy link to clipboard

Copied

Look at the String.indexOf and String.match methods here: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#String.html

if (str1.indexOf("str2") >= 0 ) 

or 

if (str1.match(/regularExpression/) 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
salshaw749 AUTHOR LATEST
Participant ,
Aug 13, 2020

Copy link to clipboard

Copied

Thanks! it worked for me!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Aug 12, 2020

Copy link to clipboard

Copied

Also:

Make sure you really have a string in your path variable and not a folder or a file object.

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more