-
1. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 14, 2012 2:09 PM (in response to vincent 1982)Hi Vincent
Can you explain what you mean by hidden characters (the are quite a few possibilities)
-
2. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 14, 2012 2:30 PM (in response to vincent 1982)Regarding the character style override see if http://in-tools.com/article/scripts-blog/showing-text-formatting-overrides/
meets your needs
-
3. Re: Finding hidden characters and overriden styles
Vamitul Nov 15, 2012 12:52 AM (in response to Trevorׅ)and even more cool is Marc's script:
http://www.indiscripts.com/post/2012/05/the-hidden-way-to-highlight-style
-
4. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 15, 2012 1:02 AM (in response to Vamitul)Vamital,
Jives (or you) messed up your link so here it is again. (compare the style(s) at the end)
http://www.indiscripts.com/post/2012/05/the-hidden-way-to-highlight-styles
Marc's Basic version as refered to in the link to Harbs' is here
http://www.indiscripts.com/post/2010/05/show-local-formatting-in-indesign-cs4
Hope these work
Trevor
-
5. Re: Finding hidden characters and overriden styles
PeteBaumgartner Nov 16, 2012 10:27 AM (in response to Trevorׅ)Very neat !
But is there a quick way for ascript to scan all the text in a story for only those textRuns which override either a paragraph or character style -- without doing the entire compare all the attributes thing?
I don't want to see the results on the screen, but rather find them in a script.
Thanks !
-
6. Re: Finding hidden characters and overriden styles
[Jongware] Nov 16, 2012 12:42 PM (in response to PeteBaumgartner)You could try a custom Preflight profile. I think there is an item "local overrides" for that.
It should be pretty fast, but the hard part is going to be parsing the returned results :)
-
7. Re: Finding hidden characters and overriden styles
PeteBaumgartner Nov 16, 2012 1:14 PM (in response to [Jongware])Interesting idea. Thanks
-
8. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 18, 2012 2:47 PM (in response to PeteBaumgartner)Hi Pete,
I think I've come up with a nice technique here if I say so myself it can be utilized for umpteen properties. To find them very quickly
I actually think this is one of the best scripts I've written (by far no the most complicated but I think very efficient)
JONGWARE this time I think I got the textStyleRanges right!
What a pity that Vincent appears to have passed away, I definitely deserve some points for this one IMHO!
Regards to all and may Vincent RIP,
Trevor
// Script by Trevor to make an array quickly of Overridden Text Styles // http://forums.adobe.com/message/4853747#4853747 #target indesign app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "List Overridden Text Styles"); function main() { var doc = app.activeDocument, myOverRiddendTextStyleRanges = [], l, myOverRiddenStyleFlags = doc.stories.everyItem().textStyleRanges.everyItem().styleOverridden; var myTextStyleRanges = doc.stories.everyItem().textStyleRanges.everyItem().getElements(); l = myOverRiddenStyleFlags.length; while (l--) (myOverRiddenStyleFlags[l]) ? myOverRiddendTextStyleRanges.push(myTextStyleRanges[l]) : 0; // we now have an array of all the overridend Text Ranges // For the Sake of the Alert but not neaded otherwise l = myOverRiddendTextStyleRanges.length; var overRiddenContents = []; while (l--) overRiddenContents.push(myOverRiddendTextStyleRanges[l].contents); alert (overRiddenContents) }
-
9. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 18, 2012 11:02 PM (in response to Trevorׅ)~ Trevor ~ wrote:
I think I've come up with a nice technique here if I say so myself it can be utilized for umpteen properties. To find them very quickly
I actually think this is one of the best scripts I've written (by far no the most complicated but I think very efficient)
Blah, Blah, Blah
Drat, Drat, Drat!!! Darn! Egg on face!!!
I was sure that using
myOverRiddenStyleFlags = doc.stories.everyItem().textStyleRanges.everyItem().styleOverridden; while (l--) (myOverRiddenStyleFlags[l]) ? myOverRiddendTextStyleRanges.push(myTextStyleRanges[l]) : 0;
would be a lot quicker than using
while (l--) (myTextStyleRanges[l].styleOverridden) ? myOverRiddendTextStyleRanges.push(myTextStyleRanges[l]) : 0;
well it's not. It is actually slower.
On a nearly 600 page document with several thousand overrides the script took about 74 seconds to run (including making an array of the contents but not displaying it) when not using the flags and about 100 second when using them
So this is not one of the best scripts that I have written at all and my newly discovered technique is pretty rubbish.
Oh well, back to the drawing board.
Anyway here's the boring old script using the good old convectional methods.
// Script by Trevor to make an array quickly of Overridden Text Styles // http://forums.adobe.com/message/4853747#4853747 #target indesign app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "List Overridden Text Styles"); function main() { var startTime = new Date().getTime(); // removable if the time alert below is removed var doc = app.activeDocument, myOverRiddendTextStyleRanges = [], l, //myOverRiddenStyleFlags = doc.stories.everyItem().textStyleRanges.everyItem().styleOverridden; myTextStyleRanges = doc.stories.everyItem().textStyleRanges.everyItem().getElements(); l = myTextStyleRanges.length; while (l--) (myTextStyleRanges[l].styleOverridden) ? myOverRiddendTextStyleRanges.push(myTextStyleRanges[l]) : 0; // For the Sake of the Alert but not neaded otherwise l = myOverRiddendTextStyleRanges.length; var overRiddenContents = []; while (l--) overRiddenContents.push(myOverRiddendTextStyleRanges[l].contents); alert ("Script took "+(new Date().getTime()-startTime)/1000+" seconds"); // removable // alert (overRiddenContents) // if there are a very lot of overRiddenContents this line can be problematic that's why it's escaped. }
-
10. Re: Finding hidden characters and overriden styles
vincent 1982 Nov 19, 2012 12:44 AM (in response to vincent 1982)Hey hey,
I'm still very much alive . For some reason the login button was redirecting me to a 404 page instead of actually logging me in .
Thanks for the many replies. I can definitly use the script for the overriden textstyles. Thank you for this Trevor.
As for the hidden characters. I just want to find out is the document contains any hidden character. I dont need it to say which or where, just a true or a false.
Maybe i'm not reasoning correctly but as far as i know you need to check every character and check if its a hidden character or not. Is this the correct way?
And while i'm at it. I have one more for you guys, is there an easy way to get the dimensions of a page? I've looked through the API but couldnt find any easy way to find out (it's probably me thou). The way i'm doing it now is the following:
pageWidth = Math.ceil(currentPage.bounds[3] - currentPage.bounds[1]);
pageHeight = Math.ceil(currentPage.bounds[2] - currentPage.bounds[0]);
I have a feeling that this isn't the right way at all.
Finally i want to say thanks for the replies. Good to know there are other people that are making plugins and that i'm not on my own.
-
11. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 19, 2012 12:53 AM (in response to vincent 1982)Hi Vincent
Thrilled to here you are still with us.
I'm still not clear on what you are referring to be hidden characters.
Do you mean
1) Overflowing text which you can't see
2) Space like characters which you can't see
3) Hidden conditional text characters which you can't see
4) Some other type of thing that you can't see.
-
12. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 19, 2012 1:31 AM (in response to Trevorׅ)5) The hidden characters refered to in the view options as in these http://indesignsecrets.com/downloads/guide_specialchars-2012.pdf
P.s. I meant to say above
Thrilled to hear you are still with us.
-
13. Re: Finding hidden characters and overriden styles
vincent 1982 Nov 19, 2012 2:03 AM (in response to Trevorׅ)Seems there was a miscommunication about this, i dont have to check for this after all. Do you have any ideas about the page dimensions Trevor?
-
14. Re: Finding hidden characters and overriden styles
Trevorׅ Nov 19, 2012 2:15 AM (in response to vincent 1982)I would do it the way you do it, maybe without the ceil
Glad you got your answers
Please mark as correct
Trevor
-
15. Re: Finding hidden characters and overriden styles
vincent 1982 Nov 19, 2012 2:33 AM (in response to Trevorׅ)Will do, kind of new to this
-
16. Re: Finding hidden characters and overriden styles
[Jongware] Nov 19, 2012 2:52 AM (in response to vincent 1982)vincent 1982 wrote:
And while i'm at it. I have one more for you guys, is there an easy way to get the dimensions of a page? I've looked through the API but couldnt find any easy way to find out (it's probably me thou). The way i'm doing it now is the following:
pageWidth = Math.ceil(currentPage.bounds[3] - currentPage.bounds[1]);
pageHeight = Math.ceil(currentPage.bounds[2] - currentPage.bounds[0]);
I have a feeling that this isn't the right way at all.
It depends. If your page sizes may differ from one page to another, yours is a good way. If you are pretty sure all pages are the same size (or they should be), you could also use http://jongware.mit.edu/idcs6js/pc_DocumentPreference.html#pageHeight and #pageWidth. Theoretically, this should be the same values. The 'page bounds' are particularly useful when you are dealing with spreads.
-
17. Re: Finding hidden characters and overriden styles
vincent 1982 Dec 17, 2012 10:45 AM (in response to [Jongware])Back to the overridden characters thing. When using the textStyleRanges you can see if a certain style is overridden. But would it be possible to see which style is overridden? Wether it was a character style or a paragraph style? The reason i ask is that i have textStyleRanges in a document that has an appliedCharacterStyle aswell as a appliedParagraphStyle, but how can i know which of the 2 is the one that is overridden?