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.


MAC Unique Code Issue

Contributor ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Hi Everyone,

 

I tried to replace the bulletin content using unicode but the space after the unicode was not getting deducted... I'm using mac with bigsir os.

What to do with this?????

//bulletin unicode with space 
scriptCode.Append(" app.findTextPreferences.findWhat = '\\u2022    '; ");  //not working
scriptCode.Append(" app.changeTextPreferences.changeTo ='\\u2022 '; ");
scriptCode.Append(" app.activeDocument.changeText();")

//bulletin unicode without space
scriptCode.Append(" app.findTextPreferences.findWhat = '\\u2022'; ");  //working
scriptCode.Append(" app.changeTextPreferences.changeTo ='\\u2022'; ");
scriptCode.Append(" app.activeDocument.changeText();")

by,

-Jo

TOPICS
Bug, Scripting, SDK

Views

137

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 , Nov 15, 2021 Nov 15, 2021
Use \\x{2022}, not \\u2022 And use just one space after the code. " +" means 'one or more spaces'. So: scriptCode.Append(" app.findGrepPreferences.findWhat = '\\x{2022}\\K +'; ");

Likes

Translate

Translate
Enthusiast ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Hi Jo, if I understand you right, please try this:

app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.properties = ({ findWhat: '\u2022 ' });
app.changeGrepPreferences.properties = ({ changeTo: '\u2022' });
app.activeDocument.changeGrep();

- Mark 

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Mark -- You need the \x{....} format in Grep searches, so here you'd need \\x{2022}

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
Enthusiast ,
Nov 21, 2021 Nov 21, 2021

Copy link to clipboard

Copied

LATEST

Thanks Peter, I've a lot to learn about indesign grep, but in this case I just used a literal extendscript string—no escaped backslash. It worked for me on Mac, by the way, but apparently not for Jo, so maybe we can't specify literal extendscript string with unicode on Windows? No need to answer. You're answer is far better. Thanks again.

- Mark

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
Contributor ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Hi mlb,

 

I tried your solution but it doesn't work is there any other way to fix it....

What i'm trying to do is to find the "\\u2022    " followed by four space and to replace it as "\\u2022 " followed by one space........

For windows what i have done here is working there but in mac it was not working.....

jothipriya_0-1636976757211.png

 

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Your code works only if \u2022 is followed by four or more spaces. A Grep replacement in this case is much more flexible than a Text replament:

 

 

scriptCode.Append(" app.findTextPreferences.findWhat = '\\x{2022} \\K +'; ");  //not working
scriptCode.Append(" app.changeTextPreferences.changeTo = ''; ");
scriptCode.Append(" app.activeDocument.changeText();")

 

 

This reads as 'look for multiple apces preceded by a bulletpoint+space and delete those spaces'.

P.

 

(edit: Mark beat me to it)

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
Contributor ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

It's not working peter...

Kindly refer to the screenshot attached here

 

jothipriya_0-1636975308436.pngjothipriya_1-1636975330769.png

 

Thanks,

-Jo

 

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Sorry, findTextPreferences should be findGrepPreferences. And changeTextPreferences should be changeGrepPreferences.

 

By the way, out of curiosity, why do you use scriptCode.Append ()? 

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
Contributor ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Tried that also but nothing works peter is there any other way????

jothipriya_0-1636980853929.png

 

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Use \\x{2022}, not \\u2022

And use just one space after the code. " +" means 'one or more spaces'. So:

scriptCode.Append(" app.findGrepPreferences.findWhat = '\\x{2022}\\K +'; ");

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

FWIW: That's the syntax for Text Find/Replace:

 

 

app.findTextPreferences.findWhat = "<2022>";

 

 

You can see that in the UI as well:

FindTextUniCodeCodePoint.PNG

 

 

Regards,
Uwe Laubender

( ACP )

 

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
Contributor ,
Nov 16, 2021 Nov 16, 2021

Copy link to clipboard

Copied

Thanks all,

 

Now my problem is solved..

 

Thanks,

-Jo

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