Finding hidden characters and overriden styles

Hello,
I'm struggling with the following things:
I need to check a document to see if it contains any hidden characters. Do i have to create a loop and check each of the characters? Because with a big document it is impossible to do. Or is there an easier way to do it?
2nd question is that i need to check if any of the character styles have been overriden, i have yet to find a way to do this so any help would be highlyappreciated.

~ 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.

Similar Messages

  • Find Hidden Characters-in downloaded file

    All,
    I have a file interface that downloading file to SANS server using open dataset. But recently we are getting some hidden characters in the file. These are getting from a long text.
    Now my requirement is to find these hidden characters and display in the screen and user can correct then go for download.
    Currently i am using Notepad++ or using this link for finding the hidden characters
    http://string.online-toolz.com/tools/string-functions.php
    Now user wanted to use the same functionality with in SAP using ABAP.
    Any input on this appreciated.

    Similar functionality can be achieved by JavaScript. You can pass the entire Text and create your function in JS to find out the Hidden Characters. If you are successful finding the JS which can do this job for you, you can use [JS Engine|http://help.sap.com/saphelp_nw04/helpdata/en/49/a8e3c8d59811d4b2e90050dadfb92b/frameset.htm] available in ABAP.
    Refer to [ABAP & JavaScript|http://help-abap.zevolving.com/2011/10/javascript-in-abap/] to see the simple JS usage.
    Regards,
    Naimesh Patel

  • AreaText find hidden characters

    Is it possible to find out if a AreaText contains text that is out of bounds?
    I want to make sure that NO text is invisible after creating a new AreaText and I dont want to make it bigger then absolutly needed
    Trying to find it in the Scripting Reference: Javascript, but without result.
    any tips?

    Hi Fubar,
    I didn't check for  a long time in javascript references, but i working on another project, and may be this can help you:
    explanation:
    first, i take the length of content text
    second, i duplicate text and create outline, this make items of all visible text, so if this length is different than content text, there are thus some hidden characters
    1) create a document with an area text with contents
    2) run this below
    #target illustrator
    try {
    var doc=app.activeDocument;
    var text=doc.textFrames[0];
    var tLen=text.contents.length; // total length
    var tSpaceB=text.contents.split(" ").length; // number of spaces in tBefore
    doc.layers.add();
    doc.layers[0].name='TEMP';
    text.duplicate (doc.layers.getByName('TEMP'),ElementPlacement.INSIDE ); // duplicate for vectorizing
    var tTemp=doc.layers.getByName('TEMP'); // name it
    var ctTempVec=tTemp.textFrames[0].createOutline(); //vectoriz
    var ctTLen=ctTempVec.pageItems.length-1; // actual length ( = tLen without spaces )
    tTemp.remove(); // remove TEMP
    if (ctTLen+tSpaceB==tLen){alert ("There are no hidden characters")} else {
    alert ("there are "+(tLen-(ctTLen+tSpaceB))+" hidden characters")}     
    } catch (e){alert (e)}
    ciao, art.chrome

  • Force show (not toggle) hidden characters and threads in script

    I have been working on a script to show all the extras (for the most part). I can turn on rulers and frame edges from the DOM, but can not Show Hidden Characters or Show Text Threads from the DOM. I've been working on using menuActions, but there two is a hitch. It seems that the menuActions are only available if the menu has been accessed during the current session? Not 100% on that. There is a good comment (#10) that touches on this a bit at Indiscripts :: How to Create your Own InDesign Menus.
    This method works, but again only if the menu has been previously accessed... so it's not reliable:
    // locale-independent (should work on non-english versions of InDesign)
    // Show Hidden Characters
    // FIX/TODO - Only seems to work if the Show/Hide Characters has been toggled within this session?!
    var showHiddenChars = app.menuActions.item("$ID/HideHiddenCharactersCmdStr"); //The 'hide' ID String only valid when characters are hidden
    var areCharsHidden = (showHiddenChars.isValid);
    if (areCharsHidden == true) {
        try {showHiddenChars.invoke()} catch (givenError){alert(givenError.toString())};
    else {
            //alert("Hidden characters are already shown!")
    I also have a less desirable version of Showing Hidden Characters, which relies on English name property of the Menu Action. It suffers from the same issue.
    //~     var acID = acID||
    //~             ((t=app.menuActions.item("$ID/ShowHiddenCharactersCmdStr")).isValid&&t.id)||
    //~             ((t=app.menuActions.item("$ID/HideHiddenCharactersCmdStr")).isValid&&t.id);
    //~     var showHiddenChars = app.menuActions.itemByID(acID);
    //~
    //~     //if the name property for the menuAction is currently "Hide Hidden Characters", the characters are hidden.
    //~     var areCharsHidden = (showHiddenChars.name == "Hide Hidden Characters");
    //~     if (areCharsHidden == true) {
    //~         try {showHiddenChars.invoke()} catch (givenError){};
    //~         }
    //~     else {
    //~         //alert("Hidden characters are already shown!")
    //~         }
    Any suggestion on how to force show characters (show threads works the same way) with out having to have had accessed a menu before hand?
    Thanks,
    Kevin

    When you have found a menu action you can remember its ID and use menuActions.itemByID() later on to retrieve it. Most action IDs are hard wired, bound to their implementing plugin. Of course there is an exception for dynamically allocated actions, e.g. script actions.
    My first attempt following you is to retrieve the action name - that should trigger the internal method to update the whole action state including checked, enabled (not applicable in this case). Of course it failed, would someone please file a bug? The translated versions of strings that you'd use for the comparison are available via app.translateKeyString().
    Btw you are using the wrong string - cmd strings are used for command history as seen in the undo menu. Menu strings usually have an ampersand character to indicate the underline / Alt+Key combo in Windows.
    $.writeln(app.menuActions.itemByID(0x1d301).name==app.translateKeyString("$ID/Show Hidden Characters"));
    $.writeln(app.menuActions.itemByID(0x1d301).name==app.translateKeyString("$ID/Hide Hidden Characters"));
    app.translateKeyString("$ID/Show Hidden Characters")
    Ergebnis: Verborgene Zeic&hen einblenden
    app.translateKeyString("$ID/Hide Hidden Characters")
    Ergebnis: &Verborgene Zeichen ausblenden
    // failed test
    $.writeln(app.menuActions.itemByID(0x1d301).name);
    app.menuActions.itemByID(0x1d301).invoke();
    $.writeln(app.menuActions.itemByID(0x1d301).name);
    // output should change after invoke
    Verborgene Zeichen ausblenden
    Verborgene Zeichen ausblenden
    As you found command strings, I also had a look at the undo history - it remained empty.
    $.writeln(app.activeDocument.undoHistory.length);
    Probably the setting is not persisted in the document any more, someone should have removed the command strings.
    Then I realized that the output of the previous lines around the invoke had changed as it was expected originally. And I had not touched the menu since restart … but I had activated the application.
    One can do that with scripting too - app.activate();
    A couple of restarts later this is definitely leading somewhere.
    Regarding the command, I also had a second look with a debug build of InDesign: the command is still executed, but there is a flag that binds its undo to the previous command - left as an exercise to verify.
    Hmm. It is stored in the persistent document preferences in a structure internally called kDocWorkspaceBoss / ITextOptions, thus should also be exposed for scripting. Back to scripting: set a breakpoint, browse thru tons of document sub-objects, and here we are:
    app.activeDocument.textPreferences.showInvisibles
    Happy programming,
    Dirk
    Edit: when comparing the strings, you also have to strip the extra ampersand.

  • Mackbook air can't find hidden network

    I've been digging  in the forums now and went over old threads that where too old so I decided to start a new one.
    I've  a MBA 13" and I have a wireless connection that is hidden with WPA2 -PSK with MAC filtering.
    I've seen some people suggest not having passwords and just leaving it hidden, which is just crazy as you an have sniffers that can find hidden networks and I'm not prepared to give out free wireless fibre.
    Has there been a solution to this? It would be nice if there was a tickbox that said "Can connect to hidden networks if saved in the list" as in dos box wireless settings.
    Others have suggested keychain, what is this?

    Have you tried clicking on the wi-fi icon on your top bar, and selecting "Join Other Network"? You will have to fill in all the info (network name, security info)
    Also, click the "Remember this network" box.
    ***Also make sure your router is allowing the MAC address of your MBA wireless adapter. (found in About this Mac, System Information-More Info-System Report under the Wi-Fi subheader of Network)

  • PC to Mac hidden characters

    Having problems displaying hidden characters and guides when opening a document created on a PC (CS3) on a Mac. Any tricks, suggestions?

    It has nothing to do with Windows/Mac. The document is likely in a
    preview mode.
    Bob

  • TS1362 My iTunes has stopped playing - it will not progress. I have updated iTunes, and can't figure out how to find any plug-ins - can't figure out how to find hidden files on the iMac Finder.

    How do I find hidden files on my iMac? My iTunes has stopped playing music and videos - the playbar does not progress, and it may be that there is a plug-in that is stopping it. How do I fix it?

    Well, it sort of solved my problem. Now every time I start a lecture with sound, there is no sound, but the slides advance. If I go back to iTunes and turn on a cd, it plays the sound. If I then go back to the lecture, the sound goes on. So each time I start a slide show with sound, I have to turn on iTunes. How can I fix this?

  • Can I choose a backup-font for missing characters in a style? Or is there a way to select pink areas

    I have to layout tons of UTF 8 data from a MySQL database.
    There is one problem. The designer picked a font that does not contain the Japanese characters. But there is much inline-Japanese in the text.
    So the imported text has many pink areas (characters not present in font).
    So I search for any of the following options:
    Is there a way to define a fall-back font (like webbrowsers do). If you view UTF in TextEdit (mac) or in the browser, all weird characters are displayed using Osaka. Is there a way to let Indesign replace pink squares with Osaka?
    Is there a way to SELECT all pink squares, and apply a character-style to them? That way I can create a characterstyle with the Osaka font
    Is there a way to have InDesign parse some sort of markup-elements in plain text? I could tweak the MySQL output with PHP to wrap all strange symbols in a markup-item like [japanese]blabla[/japanese]. If that would be converted to characterstyle "Japanese" on import, I would be helped a lot as well.
    The font hack: is there a way to load all available characters in the designfont into Osaka and replace those characters and make Osaka2? Or would that result in a mess?
    I think some automation to get a character style on the pink areas is the best, as that allows to tweak font height and baseline shift to match the other font.
    Does anybody know one of the four or maybe a fifth way to tackle my problem?

    Thanks for standing in for me, Peter - we were hosting the extended family, I did nothing but cook for hours.
    Is there a way to have InDesign parse some sort of markup-elements in plain text? I could tweak the MySQL output with PHP to wrap all strange symbols in a markup-item like [japanese]blabla[/japanese]. If that would be converted to characterstyle "Japanese" on import, I would be helped a lot as well.
    This is what I'd do, honestly.  It depends on your available output-from-DB formats, and what you're placing/importing into ID. But if you're placing raw text (?) then you can't simply use Type -> Find Font, so the GREP solutions offered here are good ones.
    I think some automation to get a character style on the pink areas is the best, as that allows to tweak font height and baseline shift to match the other font.
    Note that the "baseline" in Japanese is not the same place as the baseline in Latin-script. Japanese doesn't really have a baseline - they operate with a completely separate set of typographical conventions - but the effect is that you should not line up the bottom of your Japanese glyphs with the Latin-script baseline. Set some bilingual text in a good font (Kozuka Mincho Pro, it came with ID, you probably already have it installed) and take a look.
    it is very important that you have the correct glyphs or you risk changing the meanings or making the author look like an idiot. If you don't read Japanese you would be well advised to have the document checked by someone who does to be sure it reads OK before it goes into the wild.
    Chances that you'll make something completely illegible are minimal when handling Japanese, but there are a very large number of reasons why you can't just flow Japanese into English-language ID and expect it to work. There are permissible places to wrap Japanese, and places where it's not permissible. The paragraph composer you'd be using if you are using English-language ID will happily break Japanese in the wrong place. This is analagous to bad hyphenation, but looks far more idiotic to the Japanese readership than bad hyphenation looks to an English-language readership (who probably wouldn't notice bad hyphenation unlesss they happen to be a design-savvy readership). Look into using something like Japanese Indesign or World Tools Pro or the TransPacific Digital Japanese-composer template files.

  • [Mac 4.0.2] Show/Hide Hidden Characters

    Hello,
    Is it possible for my plugin to get notified when the end-user is switching Show/Hide Hidden Characters from InDesign's Type menu? And if the answer was YES then how could we do that would be the next question . . .
    Any pointer or direction to have this event watcher implemented smoothly would be very much appreciated indeed.
    Best regards
    Patrick Perroud

    Hi John,
    I modified my script and now I am getting error when I run it first time and when I run it again then it run fine.
    set the date_stamp to ((the current date) as string)
    tell application "Finder" to quit
    set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles" 
    if OnOff = "NO" or OnOff = "OFF" then
      set OnOff to "ON"
      tell application "Finder"
      display dialog "Show all hidden files in this Mac ?" & return & return & date_stamp buttons {"Show Hidden Files", "Cancel"} default button 2 with title "/MSN/" with icon 1
      end tell
    else
      set OnOff to "OFF"
      tell application "Finder"
      display dialog "Hide all hidden files in this Mac ?" & return & return & date_stamp buttons {"Hide Hidden Files", "Cancel"} default button 2 with title "/MSN/" with icon 1
      end tell
    end if
    do shell script "defaults write com.apple.finder AppleShowAllFiles " & OnOff
    delay 1 
    tell application "Finder" to launch

  • Show hidden characters shortcut causes crash

    I'm running CS4 on Mac OS 10.5.8 (Indesign 6.0.4 which I believe is the latest).
    Lately, InDesign has started crashing when I use command+opt+I (the shortcut for show hidden characters), which I do A LOT for text design purposes. It doesn't crash every single time I use the key combo, but it's gotten to about 50% of the time, so that I'm afraid to use it. I'm very shortcut oriented rather than menu oriented, so please don't suggest I just stop using the shortcut (that's what my IT guy would suggest). It took me forever to even remember what the command was called that I was doing -- I ended up finding it by accident.
    Has anyone else run into this? Does anyone have any advice/suggestions?
    Thanks!

    I would start by Quitting Indesing, removing (putting on Desktop in case you have custom settings saved there) the Indesign Prefs;
    /Users/YOUR HOME FOLDER/Library/Preferences (Indesign Folder & .plist) and also removing the Indesign Cache folder;
    /Users/YOUR HOME FOLDER/Library/Caches.

  • With GREP, is there a way to assign a character find/change to a p style?

    I'm looking for more ways to automate text styling in the magazine I produce. In InDesign, I can assign find/replace command strings in the Find/Change GREP window, but I've found no online source that tells me how to find/replace characters using GREP WITHIN a p style. It seems as if the latter GREP capability is limited to changing character styles and can't search and replace actual characters.
    Example: I have a list of recipe ingredients. I want to replace the quantity (one to three digits) at the beginning of each ingredient with a tab-digit(s)-tab combination. In Find/Change, I can enter "\d+\s" and replace with "\t$0\t" but I don't see a way to assign that capability to a p style. I want this find/change to occur automatically any time copy is added to text tagged with the Recipe Ingredients paragraph style, so I don't have to keep running a Find/Change each time we edit the page. One power user has told me it's not possible. Any insight or alternative solution would be much appreciated.

    Your power source has it right, GREP Styles can only apply character styles to the text it finds.
    And there is no easy way to have text replaced automatically -- you would still need to run a script, or press a hotkey or something.

  • Why doesn't copy and past style copy the borders?

    Why doesn't copy and past style copy the borders?  For some reason it copies the style of the characters or numbers themselves but not any border formatting.  Why is this?

    Alasdair,
    It would be speculation to try to guess what is going on with borders when using Copy Style and Paste Style, unless you know more about what is going on than I do. Sometimes border style is Copied and Pasted, sometimes it isn't. Based on my observations, it depends on the pattern of borders. I suppose that there could be an assignment of a shared border to one cell and not to the adjacent cell, so when copying the style you may or may not capture the border style based on which cell was selected during the Copy. I don't think it is possible to Copy/Paste a Style pattern, and I can't say why.
    I find that it's most efficient to create a table with the desired pattern of border styles and to Copy data and Paste and Match Style into the table. I suppose that you have noticed that when you Copy an entire table, you capture the Style of that table. So, copy the Styled table and then paste the data into it.
    Jerry

  • HT1848 I purchased alert tones in itunes and updated my itunes.  Now my alert tones do not show up, although if I were to go re-purchased those items, it says I already purchased them.  Where do I find those tones and how do I get them back into my phone?

    I purchased many alert tones in itunes and then updated my itunes.  Now my alert tones do not show up, although if I were to go re-purchase those items, itunes says I already purchased them.  Where do I find those tones and how do I get them back into my phone without having to repurchase????  This is so frustrating!  Please Help!

    1. iTunes won't offer cloud downloads for songs that it "thinks" are in your library, even if it "knows" the files are missing. If you've exhaustively searched for the missing files and there is no prospect of repair by restoring to them to their original locations, or connecting to new ones, then delete that tracks that display both the missing exclamation mark and are of media kind Purchased/Protected AAC audio file. Don't hide from iTunes in the cloud when asked, close iTunes, then reopen. You can download from the cloud links or iTunes Store > Quicklinks > Purchased > Music > Not on this computer > All songs > Download all.
    2. Why? Not sure, perhaps 3rd party tools or accidental key presses combined with previously hidden warning messages when trying to organize the library. There is a hint that using the feature to downsample media as it is synced to a device may also be involved, though I've not replicated it. Whatever the reason a backup would protect your media.
    tt2

  • How to show Greek characters in Italic style

    How to show Greek characters in Italic style
    Hi all, I'm tryng to resolve a problem with the Greek characters
    I need to display labels in two languages, english or greek inside my report.
    At the beginning of the report I have a placeholder with the xml code : *<?param@begin:p_language?>*, so I can understand inside my report if the user chose the Greek or English, and then I have many placeholders (labels) which have to be written in Greek or English.
    If the language chosen is English, I don't have any problem to show my labels bold or italic in every fonts
    Inside the placeholder I wrote the following code:
    *<?xdofx:if $p_language = 'Ελληνικά' then 'Οργανισμός' else if $p_language = 'Αγγλικά' then 'Organization' end if?>*
    I can chose font, style and bold/not bold directly from Word and when I run the report in pdf I see exactly what I chose.
    If the language chosen is Greek....I see always the label in Arial, NOT BOLD and NOT ITALIC...
    In order to see Greek characters BOLD:
    a) I added (under the ADMIN tab/Runtime Configuration/Font Mappings/ ) a font named Arial and I addeda target Font named Arialbd.ttf under the directory: D:\Oracle\Oracle_Homes\BIP_101341\jdk\jre\lib\fonts
    b) I changed the font (from word) to Arial
    Now, ONLY with tha ARIAL font I can see my labels in greek bold, but I can't still see them in italic style.....
    So, I tried to force these condition inside the placeholder with the following code:
    *<?if:$p_language = 'Ελληνικά'?><xsl:attribute xdofo:ctx="inlines" name="font">Times New Roman</xsl:attribute><xsl:attribute xdofo:ctx="inlines" name="font-style">Italic</xsl:attribute><xsl:attribute xdofo:ctx="inlines" name="color">red</xsl:attribute><xsl:attribute xdofo:ctx="inlines" name="font-weight">bold</xsl:attribute>Οργανισμός<?end if?>*
    ...but I continue to see the labels in Greek only bold, red but not in Italic Style......
    Also adding another font called Arialbi.ttf (Arial bold Italic)...I can't see my labels in Greek bold with Italic Style....
    Anybody had the same problem with another alphabet different from the latin one ???
    Any help will be appreciated
    Thanks in advance
    Alex

    Hi Chris,
    Thanks for your reply.However I still have some problems.
    I couldnt get jpdk 3.0.9.0.4 version the latest version that I
    got was jpdk 3.0.9.0.2.
    I tried the 3.0.9.0.2 version and it gave me the below error.
    Error-
    sun.io.MalformedInputException
         at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java,
    Compiled Code)
         at java.io.InputStreamReader.convertInto
    (InputStreamReader.java, Compiled Code)
         at java.io.InputStreamReader.fill
    (InputStreamReader.java, Compiled Code)
         at java.io.InputStreamReader.read
    (InputStreamReader.java, Compiled Code)..........
    Can you guide me regarding this ???
    Regards,
    Mandar.

  • How to find Special Characters in a table ?

    Hi,
    I have a problem, during a data upload by the client, some special characters were uploaded in the database.
    Sample data : " AC Power Cord Denmark "
    I want to find all records containing such special characters and update them.
    TOAD is able to display these characters but when i copy them onto the query... it doesnt work.
    Can we know which encoding is that ? or do something to take care of this ?
    Thanks in Advance.
    Message was edited by:
    Champ

    insert into t1 values ('joe$%"likes#$%#to*()ride%^$#his bike');
    1 rows inserted
    select * from t1;
    C1                                                                                                  
    joe$%"likes#$%#to*()ride%^$#his bike                                                                
    1 rows selected
    select translate(c1,'!@#$%^&*()"','          ') from t1;
    TRANSLATE(C1,'!@#$%^&*()"','')                                                                      
    joe  likes    to   ride    his bike                                                                 
    1 rows selected
    update t1 set c1 = translate(c1,'!@#$%^&*()"','          ');
    1 rows updated
    select * from t1;
    C1                                                                                                  
    joe  likes    to   ride    his bike                                                                 
    1 rows selectedI didn't notice your special special characters, but it still works:
    insert into t1 values ('joe likes his'||chr(22));
    select * from t1;
    select translate(c1,chr(22),' ') from t1;
    update t1 set c1 = translate(c1,chr(22),' ');
    select * from t1;
    Message was edited by:
    JoeC

Maybe you are looking for