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

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

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

  • [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.

  • 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?

  • InDesign - Hidden Characters Corrupting Documents

    I post this message in the spirit of sharing information, hopefully to be of help others.
    I recently encountered a problem after distilling a document from InDesign which, as an Acrobat PDF, would not print - giving three successive error messages:
    1. The Document could not be printed.
    2. There were no pages selected to print.
    3. A drawing error occurred.
    Well, that covers about everything !
    After about an hour of patient diagnosis I discovered some erroneous characters had appeared in some bullet points and removal of these cured the problem.
    I found them only after copying and pasting the text into Word (using the paste as "text only" option) and copying and pasting it back into InDesign. The spurious characters then appeared as a red-highlighted squares and could be easily deleted.
    (Note: I had previously used the 'Show hidden characters' option in InDesign which did not reveal these little devils, neither did they 'appear' in the Word document)
    I believe the erroneous character is probably a result of formatting which was in the original Word document imported into InDesign and which could be a 'flag' for bullet formatting (in Word).
    The lessons I learned from this are:
    patiently isolating the section of the document led to the discovery of the problem
    be aware, in the future, of possible odd characters appearing (invisibly) from Word and corrupting InDesign documents.
    Hope this may be of assistance.
    I haven't given version numbers of my software since this is almost certainly not relevant - but the general principle is.
    I hope this may be of assistance.

    Thankyou for putting that on the record...

  • How can I find special characters in a string

    Hi,
    I have a small task where I have to find special characters in a given string, Can anyone suggest.......................

    What is your definition of a "special character", could you be a bit more specific?
    Do you simply want to find the position of a specific character in the string?
    Can it occur more than once and you want to find all occurences?
    What should happen if the special character does not exist?
    For programming purposes, all 256 possible 8 bit characters (x00-xFF) can be treated the same. Non-printing characters can be entered in \-codes or hex display if needed.
    LabVIEW Champion . Do more with less code and in less time .

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

  • Hidden Characters is not displayed properly

    Hi Friends,
    I am a user of Adobe Indesign CS4 (6.0.6). lately, I upgraded my MAC OS X to 10.6.4 version. I found out the Hidden Characters in Indesign becomed to be not displayed correctly. I captured a screenshot as below for reference. All Hidden Characters such as forced line break, table are displayed as rectangle box in total like below screenshot.
    But when i transfered to Mac OS X 10.4.11, all instances were fine.
    If anyone occurred this issue before, kindly please tell how to resolve it.
    Thanks in advance.
    L1on

    Typically I tend to advocate installing Mac OS X on a new hard drive and migrating the profile over. It's a huge timesaver and issues located to profiles are rare and generally easy to diagnose.
    This time around though I've had a couple of machines have runaway directory processes, which made me curse Bob for being right again.
    I'd still say it is a good idea beyond doing a fresh install to keep your last OS in a bootable format until you are wholly content with it. Migrating back a version of Mac OS X is not for the feint of heart. I had to do it do to printing and application incompatibility and it roached a good half day to get everything back on track on version back.

  • Hidden Characters Displaying Wrong

    So ever since I started using CS4 my InDesign will sometimes show my hidden characters improperly. There doesn't seem to be any consistency in when it happen. The only common thing I can think of is that it sometime happens after I open an Illustrator file, but not always. I have re-installed InDesign and I just reset my preference last week, but It still is happening. Anyone have any Ideas on what is going on and how to fix it?

    This is another example

  • TS1702 Find hidden apps

    Find hidden apps

    You will find them under "account" information and you can unhide your purchases from this page.
    Thanks!!

  • Type Show Hidden Characters doesn't display hidden chars, what to do?

    When I select Type > Show Hidden characters, the display does not change and the hidden characters stay hidden. Is there something additional that I need to do to see the hidden characters?

    Under View, change your Screen Mode to Normal. In any other mode, guides and hidden characters won't show.

  • "show hidden characters" is not working

    InDesign CC. Neither the show/hide grid nor the show/hide hidden characters works.

    Maybe you're in the wrong screen mode. Try View -> Screen Mode; invisibles like gridlines and hidden characters will appear in Normal, but IIRC not in Preview.

  • View code view options hidden characters problem

    When I turn on the Hidden characters I get extra tab symbols at the end of the line of code. These will somtimes lay on top of or beyond the paragraph symbol. I have tried using other font and font sizes and some do work better than others. It seems like the text in the code view dosn't respect the hidden characters at all and some times the cursor looks like it is one place but edits a character over one space. Any ideas on the best font and size to use and is there any one else experincing this and or a fix?

    Not sure I understand the issue you're having. 
    I'm using CS6 ver 12.2, build 6006 on Windows. 
    The font is Courier New 12pt.
    See screenshot.
    Nancy O.

Maybe you are looking for