Copy link to clipboard
Copied
Here is my Problem:
A Text set in CS6 uses a different character for Line-Breaks as CC.
Now there is the idea to run a script in CC2019 to convert Forced-Line-Breaks in Paragraphs via GREP/regex.
This code works, but not for those Line-Breaks. I didn't figure out the character.
// regex_changeContentsOfWordOrString_RemainFormatting.jsx
// regards pixxxel schubser
/* var s = /(\r\n|\r|\n)/; */
/* var s = /\u000D/; */
/* var s = /\u000C/; */
/* var s = /^n/; */
var s = /\n/;
/* var s = /\u000A/; */
/* var s = /\u000D/; */
/* var replacer = "hello", result; */
/* var replacer = "bla", result; */
/* var replacer = "\r", result; */
var replacer = /\r/, result;
var atf = activeDocument.textFrames[0];
while (result = s.exec(atf.contents)) {
try {
aCon = atf.characters[result.index];
aCon.length = result[0].length;
aCon.contents = replacer;
} catch (e) {};
}
Which character is it?
And here is the download-link for the test-file:
BlocksatzCS6.ai
Changed Line-Endings
Salut !
var s = new RegExp(String.fromCharCode(3), "g");
var replacer = "\r", // or var replacer = "\n",
result;
var atf = activeDocument.textFrames[0];
while (result = s.exec(atf.contents)) {
try {
aCon = atf.characters[result.index];
aCon.length = result[0].length;
aCon.contents = replacer;
} catch (e) {};
}
de elleere LR
Copy link to clipboard
Copied
Salut !
var s = new RegExp(String.fromCharCode(3), "g");
var replacer = "\r", // or var replacer = "\n",
result;
var atf = activeDocument.textFrames[0];
while (result = s.exec(atf.contents)) {
try {
aCon = atf.characters[result.index];
aCon.length = result[0].length;
aCon.contents = replacer;
} catch (e) {};
}
de elleere LR
Copy link to clipboard
Copied
Thanks alot, this works!!!
Merci beaucoup de votre aider!!!
Copy link to clipboard
Copied
Great!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now