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
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 +'; ");
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
Copy link to clipboard
Copied
Mark -- You need the \x{....} format in Grep searches, so here you'd need \\x{2022}
Copy link to clipboard
Copied
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
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.....
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)
Copy link to clipboard
Copied
It's not working peter...
Kindly refer to the screenshot attached here
Thanks,
-Jo
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 ()?
Copy link to clipboard
Copied
Tried that also but nothing works peter is there any other way????
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 +'; ");
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:
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Thanks all,
Now my problem is solved..
Thanks,
-Jo