CS3: need script to replace spaces with underscores in the paragraph and character style names

Help! I am very new to scripting.

I managed to find and tweak existing javascripts to search through all my paragraph styles to disable hyphenation and off balance the jagged lines, but I need help with this one.

I work on Mac OS 10.4.11 using Indesign CS3.

I need a script that will search all my paragraph and character styles in my open Active document and replace spaces by underscores.

Can someone help me with this? It would be greatly appreciated!

1. I don't know, but I think you can use all the regular GREP inside this function codes. Do not use the quotation marks around of the expression, use slashes! (Why? Just a curiosity of Javascript... maybe a hack that goes back to the gray mist of JS development...)

This work should - but rather the code above, this is not tested:

.. Replace (/ [-\ / ()-. _] + / g. '_');

The GOLD group inbetween the brackets contain all the characters you want to replace with an underscore: the hyphen (this has to be the first character in the group, else it will be interpreted as a range of characters from each side!), space, slash (this one is 'special' inside the function replace JavaScript, so I think he needs to escape with a backslash)! in parentheses, a period (not sure if it should escape - into ordinary GREP, it's the wildcard character for any character, but maybe he loses his magic within a group of GOLD) and finally... the underscore character. Why?

Well, this replacement string comes with a free bonus. Note the sign after the installment of GOLD +. This means that a whole sequence of these characters is replaced by a simple underscore: "it's / a - / test" will become "This_is_a_test". Adding the underscore line itself to the string of research means that it will also find the whole chain 'space space (stroke underscore)' in 'This style (_)' and, oh magic!, replace it immediately with a single underscore.

Just FYI, the tiny "g" after the closing slash is abbreviation of 'global', i.e. at the global level, replacing in this string. replace the default values for a replacement only (why? see above...), and adding the 'g' ensures he keeps replacing until it is not find matches more.

2 see point 1.

3. uh, yes it's true, but you will need to check very carefully if nothing inside one of these basic models is substituted. You can apply a base style and add substitutions to make look like a subtitle, but that isn't making it a. And to the next paragraph, you can apply a base style and add substitutions to make it look like a paragraph of plain text (etc.). It's a signature of witness to bad formatting...

Tags: InDesign

Similar Questions

  • Help about the paragraph and character styles scriptting

    Hi all

    I'm working on a project with many files, I change change on all styles of paragraph with multiple processes

    for ex, change the font for all styles of paragraph on all open documents

              var docs = app.documents;  
                     
              for (var d = docs.length-1; d >= 0; d--) {  
                      var doc=docs[d]; 
                      
    var pstyles = doc.allParagraphStyles;  
    for (var a = 1; a < pstyles.length; a++) {    
                              if (pstyles[a].appliedFont.name=="Arial\tBold")    
                                   pstyles[a].appliedFont = "Arial\tBold Italic";    
                         }
                     }
    

    but I found a text inside frames (the locked position) my find/replace a not to apply to this topic

    so, is there anyway to do this process for all chassis from locked position?

    or at least make the lock of the United Nations to all open documents, but I can only do this for the active doc

    app.activeDocument.pageItems.everyItem (.locked = false)

    Another thing, I tried to change it on all styles of character on the files and I wrote the code with my little knowledge script but it seems does not, any hint please?

              var docs = app.documents;  
                     
              for (var d = docs.length-1; d >= 0; d--) {  
                      var doc=docs[d]; 
                      
    var cstyles = doc.allCharacterStyles;  
    for (var a = 1; a < cstyles.length; a++) {    
                              if (cstyles[a].appliedFont.name=="Arial\tBold")    
                                   cstyles[a].appliedFont = "Arial\tBold Italic";  
                         }
    }
             }  
    

    Thanks in advance

    Maybe your consolidated text block... Try this

    docs var = app.documents.

    for (var docs.length - 1; d = d > = 0; d-) {}

    var doc = docs [d];

    var pgItems = doc.allPageItems;

    for (var a = 0;< pgitems.length;="" a++)="">

    If (pgItems [a] instanceof TextFrame) {}

    While (doc.groups.length > 0)

    doc.groups.everyItem () .ungroup ();

    pgItems [a] .locked = false;      }

    }

    }

  • When generating layers it replaces spaces with underscores

    Hi all

    I'm working currently with RH8 and when I am saving projects and give the name, let's say "my file.chm" it replaces the space with an underscore, and the name became "my_file.chm." Is it possible to do something about it?

    Thank you

    I think what I said means that you can't generate with spaces.

    Bug? He did this for several versions and I think it's important if you're creating merged CHM Help.

    Submit a request for a bug or a feature change request according to your point of view.

    Please follow this link.

    http://www.Adobe.com/cfusion/mmForm/index.cfm?name=wishform&product=38

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Layers of files: replace spaces by underscores

    How can I update the script to replace spaces with underscores to export? I guess I have to add a line somehwere between 183-195, but I don't know what it should be. Thanks in advance.

    [On line 1032, insert a backslash and a space immediately before the characters '] / g'.

    Also to insert a space in the equivalent location of the comment for completeness.

    The result will look like this:

  • [JS InDesign CS3] Style groups, Caprice in colors! (or: how to make the styles of paragraph and character off groups style?)

    Sorry for this question (and my terrible English, incidentally), I'm a javascript noob and I know when I reached my limits.

    Well, I'm taking a set of paragraph and character style groups styles, they are placed in hundreds of InDesign documents (which cannot be regarded as a book). As much as I've tried (thanks to the invaluable help of previous messages in this forum), I was able to move a style to a group and change its position within the group, inside root-level, or between the groups. But it is not matter how I try, I don't know which move reference should I try in case I want to take each style outside the style group and place them after their original level group, folder style [Root].

    I tried:

    var doc=app.activeDocument;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Here I am, trying to move a style outside the folder that contains it, and failing miserably.
              pStylesInGroup[j].move (LocationOptions.after, pGroups[i]);
         }
    }
    

    He did not, the script has sent an invalid parameter value in the reference field, so I can't use the folder of the group itself as reference.

    Tried (obviously false) alternatives, such as the first available style using as reference. So my second script was

    var doc=app.activeDocument;
    var pStyles=doc.allParagraphStyles;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Now I try placing the styles after the [Basic Paragraph], that is, the second paragraph style in the document style list 
              pStylesInGroup[j].move (LocationOptions.after, pStyles[1]);
         }
    }
    
    

    It did not work either, another invalid parameter in the reference field. Similar results with my other attempts (I even tried "[Root]" as literal with similar luck).

    So my question is: what command (or script, in case my approach is quite wrong) should I use to accomplish my goal?

    Thanks in advance to those who decide to spend more than a minute thinking about my humble worries and my apologies for some of your lines of code Ripper shamelessly for my purposes.

    Well, tried a few things and I really weird results!

    1. you can move a style within its group.

    2. you can move a style to one group "to" the other, but it will appear "inside" of this style. I got my style of test as a subdivision of [standard paragraph], using index #1. By the index 0 # InDesign ([no paragraph Style]) crashed.

    3. you can duplicate the style, but then you get a copy of the same group. Still no luck.

    4 finally! What is the parent of a paragraph style?

    Document | Request | ParagraphStyleGroup

    'Application' is easy - it's when you do a global style. So, what's the difference between 'Document' and 'paragraphStyleGroup '? Single - well, when you get finally he...

    pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    

    move the style out of the Group and at the end of the list in the document. I don't think it's possible to move directly to a specific position in the main style list - you first need to move a group, then move it around in its own list.

    Fortunately, he returns his new position as a definition once again, if necessary, you can use

    newStyle = pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    newStyle.move (LocationOptions.AFTER, pStyles[1]);
    

    -I haven't really tried this possibility, but it should work.

  • With the help of FindChangeList.jsx - can't find text AND character style?

    I have been using the "FindChangeList.jsx" script in CS5 and it works well for what I need, except for one thing: ideally I want to pick up a piece of text with a certain style of applied character. Is it possible to do something like

    Text {findWhat: 'some text', appliedCharacterStyle: 'character style name'}

    I tried the above, but it is basically ignored the character style and found all of the text corresponding to the sentence (unknown what character style has been applied). Any ideas?

    Thank you very much. HJ

    Problem solved-, I made two mistakes. First of all, the style is a paragraph not one style style character, and secondly, it has been grouped into a folder. So I moved out of the folder and changed the code to ' appliedParagraphStyle: ' (and everything worked fine.:).

    Thank you. HJ

  • I was told that CC versions of Photoshop, InDesign and Illustrator are available with support right to left languages flawlessly.  Please order ME CC working with languages of the West and the Middle East.  My problem is no one that I spoke

    I was told that CC versions of Photoshop, InDesign and Illustrator are available with support right to left languages flawlessly.  Please order ME CC working with languages of the West and the Middle East.  My problem, it sucks, I talked to Adobe can tell me how to order the ME version.  I went around and for a week with them and have gotten nowhere.  I can't believe I'm the first person to ask for this version of CC and hope someone on the forum can point me in the right direction.  One last question - does anyone know how to reach support and talk to a real person?  Thank you.

    Hello

    You will need to contact support by calling/chat for this request.

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    Kind regards

    Sheena

  • Hi I have just signed up for the Apple's music and I forgot to cancel my game from itunes (it is no longer needed) who crossed just automatically - how to cancel the game and can get a refund?

    Hi I have just signed up for the Apple's music and I forgot to cancel my game from itunes (it is no longer needed) who crossed just automatically - how to cancel the game and can get a refund?

    To stop renewing, login to your account (for example by tapping your id settings > iTunes & App Store on your iPad, or by clicking on your name / icon to the top right of the iTunes on iTunes on your computer screen), and go to the iTunes in the cloud Section - see to halfway down this page: subscribe to iTunes game - Apple Support

    In terms of refund, try to contact iTunes Support and see if this will change (purchases are considered final), either via http://reportaproblem.apple.com or http://www.apple.com/support/itunes/contact/

  • I need to install Silverlight, but when I download the installer and run it, it tell me that 'your operating system does not support the 64-bit version of Silverlight.

    Silverlight installation problems

    I need to install Silverlight, but when I download the installer and run it, it tell me that 'your operating system does not support the 64-bit version of Silverlight. I have Vista Ultimate, a 64-bit system.  Help, please.

    Hello

    It's the operating system Vista Installation Forum.

    Microsoft has set up Forums to specifically to questions of Silverlight.

    They should be able to help you there.

    http://forums.Silverlight.NET/

    See you soon.

  • Have error code 0 x 80070020 then that he was trying to run backup... tried with security off the coast and still the same error message... solution?

    Have error code 0 x 80070020 then that he was trying to run backup... tried with security off the coast and still the same error message... solution?

    Hello

    make backups on an external hard drive or DVD

    see if this information helps you

    How to make a backup of your data (all Vista versions)

    http://www.vista4beginners.com/how-to-backup-your-data

    How to restore your files

    http://www.vista4beginners.com/how-to-restore-files

    the 1st link below is how do the backup complete pc (Vista, full and professional company)

    http://www.bleepingcomputer.com/tutorials/tutorial145.html

    and that is how do to recover the backup complete pc

    http://www.bleepingcomputer.com/tutorials/tutorial144.html

    and here is the information of microsoft in restoring a system image backup

    http://Windows.Microsoft.com/en-us/Windows-Vista/restore-your-computer-from-a-system-image-backup

    If you have problems with the repost of process above in forum microsoft link that is specific to the backup below questions

    "This forum supports questions for the default backup utility in Windows Vista, Server 2008 and beyond."

    http://social.technet.Microsoft.com/forums/en-us/WindowsBackup/threads

  • Is there a way I can trigger my characters triggers in the world? I want to listen to with him in the obs and be able to do while ingame triggers

    Is there a way I can trigger my characters triggers in the world? I want to listen to with him in the obs and be able to do while ingame triggers

    Thus, control triggers in CH all streaming a game via OBS (like having your character in the corner and your fullscreen game)? To control triggers CH I believe that enforcement must be active, so I couldn't choose another app/game on PC and press keys to trigger (if I CH running and switch to Photoshop, for example, keyboard triggers will not currently work). But I have not personally tried something like this yet - there must be some sort of solution (2 computers?). I know that we're working on more ways to feed and export your character alive in future versions, so ideally this workflow can be easier on the road.

  • How to set a fixed length scheme, composed of several documents of different types, with details of the header and footer in points 22 and 23, namely having 10 for 20 for detail header and 30 for the footer

    How to set a fixed length scheme, composed of several documents of different types, with details of the header and footer in points 22 and 23, namely having 10 for header, 20 for retail and 30 for the footer.

    Here is the sample file

    DDWTYBILL13092502572 1000000112\\NHLSFS\ORACLE\ORACLE\BILLING\VERIFY\ 2013/09/25 01:19:08 BILLEND

    DDWTYBILL13092502572 2000000212PRIVATE PRIVATE STY5572142 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731543 Suspect 91TB? (AC) EMPIEEM A2 Z03.0 05-AUG-201305-AUG-201324-SEP Z03.9 - 2013FEND 113,60 TYGERBERG HOSPITAL Ward

    DDWTYBILL13092502572 2000000312PRIVATE PRIVATE STY5572149 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731548 empyema GMP A2 Z03.9 05-AUG-201305-AUG-201324-SEP Z03.9 - 2013FEND 113,60 TYGERBERG HOSPITAL Ward

    DDWTYBILL13092502572 2000000412PRIVATE PRIVATE STY5572351 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731584 Suspect 91TB? EMPIEEM? CA Ward HOSPITAL TYGERBERG Z03.0 Z03.9 A2 05-AUG-201305-AUG-201324-SEP-2013FEND 113,60

    DDWTYBILL13092502572 2000000512PRIVATE PRIVATE STY5572352 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731585 Suspect 91TB? EMPIEEM? CA Ward HOSPITAL TYGERBERG Z03.0 Z03.9 A2 05-AUG-201305-AUG-201324-SEP-2013FEND 113,60

    DDWTYBILL13092502572 2000000612MAJOR MAJOR STY5577530 010700 INV 12ZTYG000009 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS ZOZI, S, SIYAMBONGA 27 March 2010 TYG D3 DR MARCELIN 5602181 113799662 TB731663 lymphadenitis Ward D3 TYGERBERG HOSPITAL I88.9 Z03.9 07-AUG-201307-AUG-201324-SEP H1 - 2013MEND 58,52

    DDWTYBILL13092502572 2000000712MAJOR STY5577537 MAJOR 010700 INV 12ZTYG000009 06-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS DLAMINI, N, SIMON TYG 9 October 1976 F1 DR WZESE 5602181 135524676 TB731666 Suspect Ward TB F1 TYGERBERG HOSPITAL Z03.0 Z03.9 H1 07-AUG-201314-AUG-201324-SEP - 2013MEND 58,52

    DDWTYBILL13092502572 30003034120000003032END

    You can create a nXSD the use of the Native Format generator and advanced search attribute is used to read values to a specific position and use it as the choice. You can find an example here

    http://docs.Oracle.com/CD/E11036_01/integrate.1013/b28994/NFB.htm#BGBBAJFD

  • Need to get all the text of the particular applied character style

    Can someone help me I need to get all the texts of the particular applied character style

    app.findTextPreferences.appliedCharacterStyle = 'style1 Character. "

    app.findTextPreferences.appliedCharacterStyle = 'style1 Character. "

    var mf = app.activeDocument.findText ();

    var myText = ";

    for (var i = 0; i)<>

    myText is myText + mf [i] .silence;.

    }

    Alert (MyText);

  • need to reduce space between chips in the lists and the left margin. Help

    Anyone know how to reduce the space between the bullets and the left margin?  the indentation is just too.

    Thank you

    These values are not good for me in FF, on yoru page.  Maybe try:

    UL {}

    padding-left: 16px

    }

    Here's how:

    Replace:

    
    
    with:
    
    
    
    OR
    
    simply select the list in Design View, then select teh 
      tag on the Tag Selector Bar at the bottom ofthe Design Window. Then in the CSS Window, click the + icon at the bottom of that window.The CSS window will open. Choose "Advanced" and be sure it says #healthvideoContent ul in the field there and then choose to create this selector in a new style sheet or in "This Document Only", click OK and then choose"Box" in left column, untick the "Same for all" box and enter 16 in the padding-left field. whew.... -- E. Michael Brandt www.divahtml.comwww.divahtml.com/products/scripts_dreamweaver_extensions.phpStandards-compliant scripts and Dreamweaver Extensions www.valleywebdesigns.com/vwd_Vdw.aspJustSo PictureWindowJustSo PhotoAlbum, et alia --
  • My Pavilion g6 battery needs to be replaced. I would get the long battery life longer.

    I currently have a laptop MU06 battery.  I need to buy a new battery.  It does not last very long more.  Can I replace it with a battery with more cells to prolong life?

    Hello

    The following list shows you an overview:

    http://www.shopping.HP.com/shopping/PDF/HP_NB_Battery_Compatibility_Chart.PDF

    and Yes, for machines of the G6, there are TWO types of batteries: (normal) 6-cell and 9-cell.

    Kind regards.

Maybe you are looking for

  • Adobe Flash Player not installed

    I installed Adobe Flash Player, Shockwave Flash, V17.0.0.188 several times trying to update my plugin since the evolution of Windows 10 about a month ago. I don't get an error message, but when I return to mozilla plugin check, it shows that I need t

  • LRT214 + LAPACPRO1750: Configure to allow VNC connections.

    Greetings: Background: I'm working on a small network that uses a bunch of macintosh computers. They have a comcast business portal, which they have LRT214 connected as well as a DMZ if the firewall is down and all traffic goes to the LRT214. Macs to

  • Emulator blackBerry problem

    Hello I installed the Netbeans 6.8. I installed the Blackberry JDE 4.7.0 By using the following link http://http://Java-work.blogspot.com/2010/03/integrating-BlackBerry-emulator-with.html My problem here is that the Netbeans 6.8 had added the emulato

  • Deploy a UC520 in a 2003 network

    I have configured the UC520 and it works like a stand-alone charm. But now I wan't to deploy in our network where a windows 2003 server acts dhcp. I've read countless discussions on this forum but I do not know how to disable dhcp in the CPU and use

  • update of table with similar registration information using the same key

    Version: 11.1.0.7.0We have large table probably 30 M records-test code table followscreate table people)person_id number,first name varchar2 (50).middle_name varchar2 (50).last_name varchar2 (50));insert into persons (person_id, first_name, last_name