Forum Replies Created
-
AuthorPosts
-
Michel Allio for FRIdNGE
ParticipantHi,
Here, we talk about the last word of each line of the para following a sentence end as “. “, “? ” “! ” …
The grep code I gave means that a grep style applies a “no-break” to “this” word [\w-]+ and its space that follows!
… So, it’s totally impossible to have at the end of a line in a para a single word after, e.g. a dot: It will magically jump to the beginning of the next line!
Of course, all the words in that situation (after a dot) are targeting by the grep style but no importance (e.g. in the middle of a line).
(^/)
Michel Allio for FRIdNGE
ParticipantMichel Allio for FRIdNGE
ParticipantIf you wanna update “all” the TOCs, use this:
…
for (var i = 0; i < nTocStyles; i++) {
…(^/)
Michel Allio for FRIdNGE
ParticipantKai,
Totally right!
Personally, as you know, only one-line script for free!
(^/) ;-)
Michel Allio for FRIdNGE
ParticipantMasood,
Maybe you do ignore some things about Grep! Try before commenting! ;-)
I don’t beleive in God! … Only The Force!
(^/)
Michel Allio for FRIdNGE
ParticipantGrep style:
Grep code: [.?!;:…]\K[\w-]+ [to be eventually completed!]
Char style: no-break [to be included!](^/)
May 22, 2017 at 11:19 am in reply to: Using different colors for the same styles in chapters of a book #94802Michel Allio for FRIdNGE
ParticipantOne exception! — For Free! ;-)
Just modify the script depending of the book contents [color values/files number, each color values spec.]
The global color name is: “ChapterColor”.
Open the “book”, sync. it and finally launch this script:
var myBook = app.activeBook,
myBookContents = myBook.bookContents,
D = myBookContents.length,
//————————————————————————-
myColorValues = [
//—– DEFINE EACH CHAPTER COLOR [C,M,Y,B]
//—– For memory, between *: the doc name (“Blue”, “Magenta” …]
//—– In the book right order:
/*Blue*/ [50,0,0,0], // The 1rst file of the book
/*Magenta*/ [0,50,0,0], // The 2nd file of the book
/*Yellow*/ [0,0,80,0], // The 3rd file of the book
/*Green*/ [80,0,80,0], // The 4th file of the book
// …………………………………………………………………………………………………………
/*Red*/ [0,80,80,0]]; // The last file of the book
//————————————————————————-for (var d = 0; d < D; d++) {
var myFile = myBookContents[d].fullName.toString(),
myDoc = app.open(File(myFile)),
myColor = myDoc.colors.itemByName(“ChapterColor”);
myColor.colorValue = myColorValues[d];
myDoc.close(SaveOptions.YES);
}The script just modifies the values of the “ChapterColor” color in each doc and after having done it, saves and closes the file and continues with the next one!
(^/)
Michel Allio for FRIdNGE
ParticipantYeap! It will take time! 1 second! =D
Find: .{49}\K.
Replace by: $0… if you consider a space as a char!
If not, you’ll need more regex (3 if you consider all spaces as same ones) and more time! Maybe 2 op-seconds! =D
Find:
Replace ~jFind: .{49}\K.
Replace by: $0Find: ~j
Replace by:
(type a normal space)(^/)
Michel Allio for FRIdNGE
Participant??
On ne va pas avancer vite à ce train-là !! =D
Michel Allio for FRIdNGE
Participant??
Je pensais plutôt à : Pourquoi couper les lignes après le 50e caractère ! =D
(^/)
Michel Allio for FRIdNGE
ParticipantC’est quoi la finalité ?
(^/)
Michel Allio for FRIdNGE
ParticipantTo find the 51th char:
(?-s)^.{50}\K.
To find text after 51th char until the end of the para:
(?-s)^.{50}\K.+
(^/)
Michel Allio for FRIdNGE
ParticipantMay 14, 2017 at 6:39 am in reply to: Is there any way one can fit two lines of text within another line of text? #94639Michel Allio for FRIdNGE
ParticipantHi David, truly complex!
Think Simple: Grep styles!
A sample:
https://forums.adobe.com/thread/2265937
(^/)
May 14, 2017 at 5:46 am in reply to: Clear Overrides Throughout Document on Particular Object StyleObject #94638Michel Allio for FRIdNGE
ParticipantHi Kai,
1/ It’s your personal interpretation of what is “a line”! No worry for me! ;-)
2/ My code is totally readable! [about this point, I suggest you to take a look to the Great Master Marc Autret’s artwork!]. Especially, not sure adding or not parentheses everywhere would be more preferable! About this, Peter Kahrel wrote: “… many people […] write single lines in brackets […] but this is not needed …” relevant too about line returns!
3/ I’m more interested by a technical discussion about your mention “… if you work with pageItems.everyItem(), you will not get every items! …”: your script won’t find: items on master pages or locked/not visible layers, locked items [and maybe other cases!], not mine!(^/)
PS: Beyond writing its code, concentrate here such a script on 1 line was a joke! … but maybe you have less humour than me! ;-)
-
AuthorPosts
