Script renaming many styles in 5.5

Hi,
I'm a total newbie on this, and I have tried searching the web and this forum ...
I have a ton of documents with hundreds of styles (char, para, cell and object), swatches and layers.
At least the styles need to be renamed when documents are converted from CS3 to CS5.5.
The styles are grouped and also the groups need renaming.
When the new naming structure is in place I want to use a delimited file with oldStyle and newStyle, as well as oldGroup and newGroup as a source. Styles or groups not present should just be skipped, but it would be great if styles not in the replace list could be listed in a separate text file ...
It is not necessary to perform the action on batches of documents, only the open active would be great enough.
Javascript is preferred as I have to cater for both platforms.
I'm not good at any scripting language, so please don't be cryptic.
So if someone is sitting on a readymade solution ... of course I understand I ask for a lot
Cheers
deSkilled

This doesn't sound too difficult, but the solution will depend completely on the structure of your delimited file and of your style groups. Do any of the groups share names with any of the styles? Do any character styles, for instance, share names with any paragraph, cell or object styles, and, if so, will they get the same new name? Are there groups within groups? Will old style "header" in group "A" get a different new name than old style "header" in group "B"? These are the kinds of things you'll have to know before you can begin designing a solution.
Jeff

Similar Messages

  • It is possible to rename (many) styles with a consecutive number?

    It is possible to apply a number to the styles and replace their actual names in a publication?
    For example,
    Body text [to:]     1
    Quotes [to:]     2
    Footnotes [to:]     3
    TitleA [to:]     4
    etc.
    Thank you.

    > Just for the record: this may be scripted with a predefined list instead of numbers?
    Sure. If you provide a list of names, the script can assign the first name to the first style, etc. Add something like this (untested) at the top
    var names = ["jw", "marc", "loic", "peter", "peter 2", "peter 3"];
    and then use
    styles[i].name = names[i-2];
    You should take care the list of names is long enough to re-name *all* of your styles, or else the script will stop with an error.

  • How can I combine one font with many styles to show up as one font

    How can I combine one font with many styles to show up as one font? I have quite a few fonts, that instead of showing up as a single font with different font styles (bold, bolditalic, semibold, light....) each style shows up in the fonts dropdown menu as a separate font. Any way I can fix this?
    Another font question, is there any way to group my fonts in the dropdown menu according to different categories such as 'favorite san serif fonts', or 'script fonts'?

    So your saying if it wasn't set up that way be the font creator there is nothing I can do. That's a shame.
    Most of the fonts that do this were free fonts, such as Walkway.
    But I do have some fonts (hebrew fonts) that I purchased that do the same thing.

  • Renaming many files

    How would I rename many files (over 100 total) in a directory using
    a UNIX command or script.
    Example of my files:
    file1.word.1.word
    file2,word,2
    file3 word.3
    I want them to be named:
    File1_word_1_word
    File2_word_2
    File3_word_3
    My goal is to get rid of blanks,commas and periods and replace with underline bars for each file name.

    Hi:
    I had a lot of fun wrting this script. Hope you find it useful.
    Copy the following to a file name
    #!/bin/csh
    if(-d $1) then
    cd $1
    foreach i (*)
    set ii = `echo $i | sed s/\\\./_/g | sed s/\,/_/g | sed s/\ /_/g`
    mv "$i" $ii
    end
    else
    echo "USAGE: $0 directory"
    endif
    give permission to execute. Run it with the directory name as an argument. May be you can refine it further.
    It was fun! hope it helped.
    Angelo
    Sun Developer Support.

  • Can't figure out how to rename css style in mx

    Hello,
    I can't figure out how to rename css style in mx. I have the
    style selected in the proprety inspector. Is there supposed to be a
    rename option at the bottom of the same dropdown box? There is
    option to edit style and a few others in same dropdown box... but
    no rename option. Please be specific... I have looked it up on the
    internet... but still cant find the option.
    Thanks,
    PoJ

    Do a Find and Replace to find name1 and replace with name2.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "computerpain" <[email protected]> wrote in
    message
    news:ed43p3$m9h$[email protected]..
    > Hello,
    > I can't figure out how to rename css style in mx. I have
    the style
    > selected
    > in the proprety inspector. Is there supposed to be a
    rename option at the
    > bottom of the same dropdown box? There is option to edit
    style and a few
    > others in same dropdown box... but no rename option.
    Please be
    > specific... I
    > have looked it up on the internet... but still cant find
    the option.
    >
    > Thanks,
    > PoJ
    >

  • How do I rename many photos all at one time with one click?

    I have got many photos of a sery and want to rename it all with one click only (instead of clicking through it all in single actions and wasting time).
    How can I rename many pictures/photos all together with one click only? -
    1) I have OS X Yosemite
    2) Aperture
    3) Automator App
    to use for this purpose, but I do not see through with any of it.
    Detailed Support for 1) and 2) and 3)  please!
    jona li

    Here is an article on how to batch rename files in Yosemite using just the Finder. This is a new feature in Yosemite. See if this article helps you get your files renamed.

  • Report script rename

    Hi,
    Does the report script Rename function also work for an attribute dimension member?
    Thanks,
    Ram
    Edited by: user8774295 on Jun 1, 2012 8:26 AM

    i guess Yes
    {desired name"} "actualname"

  • CSS Questions :: Renaming Class Styles & Replacing Styles Globally

    1) Renaming Class Styles
    I have a large website that I redesigned over a year ago and now manage. I've been doing some housekeeping and attempting to rename some of the class styles I've applied to different parts of each page.
    Problem: When I change the name of a class style, the style no longer is applied to the text. I've tried this in both GoLive CS2 (8.01) and Dreamweaver CS3. It's the same with both. They both allow you to change the name, but then the text loses the connection to the class style.
    How can I rename the property (or style rule) without losing the connection to the text it is applied to? To go through and have to reassign the newly named styles to each section of each page would be an enormous undertaking.
    2) Replacing Styles Globally
    Is there an easy way to delete a style and chose a new one to take it's place globally?
    Thank you for any help you can offer!
    Linda

    Hi Nate,
    Thanks for the suggestions!
    > In CS2, The CSS tab on the left side of the site window is handy for that. For instance, if you want to change very instance of a class to a different name, find it in the classes list and rename from there, which should update any pages using the class, and update its name in any external CSS files. Really useful for global changes, but definitely one of those things worth making a back-up of the whole site first.
    For some reason when I do this it breaks the formatting style.
    > If you want to change any references to one class to references to another, go to the same place and just change the class name to the other class name (so, you'd temporarily have 2 items in the list with the same name). Then, if you refresh view, you'll see they've really been consolidated into references to the same class. If that makes sense.
    This does make sense.
    I'm still experimenting. I may need to resume this in the morning. I'll let you know how it goes.
    Linda

  • Need  Bookmark creation script for Paragraph style. Anybody can help me pl?

    Need  Bookmark creation script for Paragraph style. Anybody can help me pl?

    Hi hasvi,
    I wrote a similar script which creates a bookmark on each page in the "main" text frame at the begining of the frame (the 1st insertion point). Here I attached the script and a couple of sample documents: before and after. It's more complex than what you want but you can use it as a starting point. In fact, you have to find a certain paragraph style, loop through every found item and insert a bookmark, say, at the beginning of the found text.
    The dialog box
    Bookmarks added
    Regards,
    Kas

  • Scripting a layer style for each layer to make a depth pass from focus stacking information.

    I'm trying to generate a depth pass from rack focus. Basically where I've gotten to right now is importing the rack focus footage each frame from as an individual layer. Then running Auto Blend Layers and letting photoshop do it's magic to mask out each layer's out of focus information. This basically gives me a bunch of layers that tell me exactly where the camera's focus was at each frame in the shot. What I need to do now is Add a color overlay (maybe in the form of a layer style) that starts at 100% black and goes to 100% white stepping through each layer.
    Right now I have this, which is so very far away.
    try {
        var docName = app.activeDocument.name;  // save the app.activeDocument name before duplicate.
        var layerCount = app.documents[docName].layers.length; //figure out how many layers
        var colorStep = 255/layerCount; //figure out how big the step of grey is between each layer.
            for (i = 1; i <= layerCount; i++){
                my_layer = [docName].layer(i);
                my_layer.applyStyle (solidFill) //add the color overly layer style
                //color the overlay using the colorStep information and layer number
    What I want is an end result that looks like this.

    The only focus stacking I have done is with macro photography. Below is a script that adds the layer effects but the results with my macro samples did not turn out looking good. Maybe you will have better luck with the type of photography you are doing.
    function ftn1(r,g,b) {
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );
            ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc.putReference( charIDToTypeID('null'), ref );
            var effectsDesc = new ActionDescriptor();
            //effectsDesc.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 333.333333 );
                var colorfillDesc = new ActionDescriptor();
                colorfillDesc.putBoolean( charIDToTypeID('enab'), true );
                colorfillDesc.putEnumerated( charIDToTypeID('Md  '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );
                colorfillDesc.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );
                    var rgbcDesc = new ActionDescriptor();
                    rgbcDesc.putDouble( charIDToTypeID('Rd  '), r );
                    rgbcDesc.putDouble( charIDToTypeID('Grn '), g );
                    rgbcDesc.putDouble( charIDToTypeID('Bl  '), b );
                colorfillDesc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), rgbcDesc );
            effectsDesc.putObject( charIDToTypeID('SoFi'), charIDToTypeID('SoFi'), colorfillDesc );
        desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Lefx'), effectsDesc );
        executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
    try {
        // var docName = app.activeDocument.name;  // save the app.activeDocument name before duplicate.
        // var layerCount = app.documents[docName].layers.length; //figure out how many layers
        var docRef = app.activeDocument;
        var layerCount = docRef.artLayers.length;
        var colorStep = 255/layerCount; //figure out how big the step of grey is between each layer.
        var color = 255;
        for (i = 0; i <= layerCount; i++){
            docRef.activeLayer = docRef.artLayers[i];
            ftn1( color, color, color);
            color=color-colorStep;
    }catch(e){}

  • Python automation of iTunes to easily rename many tracks

    I wrote an IronPython script to easily rename tracks in iTunes. It works in IronPython with Python 2.7 compatibility. This saves me so much time and RSI-inducing effort that I want to share it here, in case it can help others. For example, I have a lot of classical music where the album is called "Beethoven Piano Sonatas" and each track name starts with something like: "Beethoven: Piano Sonata " and that's all I can see in my iPod display for each song. What I want these tracks to start with is something like "Sonata"
    To run the script, save the code below as a .py file, e.g., iRename.py. Start iTunes and select the tracks you want to rename. Then run a command in the following format:
    ipy iRename.py replacesave [bad text] [good text]
    Voila! The songs are renamed in iTunes!
    The Beethoven example above would be run like:
    ipy iRename.py replacesave "Beethoven: Piano Sonata " "Sonata "
    In addition to "replacesave" the script accepts the following other commands:
    replace - Simulates a rename but does not change anything in iTunes
    find - Shows all selected tracks matching the search text
    list - Shows all selected tracks
    The search ("bad") text is a regular expression, so you can take advantage of this syntax if you are familiar with it. For example, to insert the text "New " (withouth the quotes) at the start of each selected track, you can run:
    ipy iRename.py replacesave "^" "New "
    Also, to remove the search text, set the second ("good") text argument to "[null]" (without the quotes).
    ipy iRename.py replacesave "Beethoven: Piano " "[null]"
    This is not a production-level product but just a useful tool. Maybe you can leverage it into something much more polished yourself. USE AT YOUR OWN RISK. Obvious room for improvement would be to gracefully handle when:
    iTunes is not running
    no tracks have been selected
    user entered invalid arguments
    If you have Python with Windows extensions but not IronPython, comment out the blue lines and uncomment the brown lines; this has not been completely tested but is included here for reference, to show both ways of getting an iTunes application object.
    import sys
    from re import search, sub
    # Use this if you have IronPython
    from System import Activator, Type
    itunes = Activator.CreateInstance(Type.GetTypeFromProgID('iTunes.Application'))
    # Use this to run in normal Python instead of IronPython
    #itunes = win32com.client.Dispatch("iTunes.Application")
    #itunes = win32com.client.Dispatch("iTunes.Application")
    command = sys.argv[1]
    if command == "replace" or command == "replacesave":
       orig = sys.argv[2]
       repl = sys.argv[3]
       print "Replacing \"{0}\" with \"{1}\"".format(orig, repl)
       if repl == "[null]":
           repl = ""
    elif command == "find":
       orig = sys.argv[2]
       print "Finding \"{0}\"".format(orig)
    elif command == "list":
       print "List:"
    else:
       print "Invalid command: \"{0}\"".format(command)
       sys.exit(1)
    for track in itunes.SelectedTracks:
        if command == "list":
            print track.TrackNumber, track.Name
        elif command == "find" or command == "replace" or command == "replacesave":
            if search(orig, track.Name):
                if command == "replace" or command == "replacesave":
                    new_name = sub(orig, repl, track.Name)
                    print "\"{0}\"".format(new_name)
                if command == "replacesave":
                    track.Name = new_name

    Here is an update with a renumbering feature. It saves a lot of time to renumber many tracks, for example when you want to combine a multi-disc set under a single album name. Use the "renumber" (for practice) or "renumbersave" (to really renumber) commands.
    import sys
    command = sys.argv[1]
    from re import search, sub
    from System import Activator, Type
    itunes = Activator.CreateInstance(Type.GetTypeFromProgID('iTunes.Application'))
    #import win32com.client
    #itunes = win32com.client.Dispatch("iTunes.Application")
    if command == "replace" or command == "replacesave":
        orig = sys.argv[2]
        repl = sys.argv[3]
        print "Replacing \"{0}\" with \"{1}\"".format(orig, repl)
        if repl == "[null]":
             repl = ""
    elif command == "find":
        orig = sys.argv[2]
        print "Finding \"{0}\"".format(orig)
    elif command == "list":
        print "List:"
    elif command == "renumber" or command == "renumbersave":
        track_nr = int(sys.argv[2])
        print "Renumbering:"
    else:
        print "Invalid command: \"{0}\"".format(command)
        sys.exit(1)
    for track in itunes.SelectedTracks:
        if command == "list":
            print track.TrackNumber, track.Name
        elif command == "renumber" or command == "renumbersave":
            print "{0:03d} ==> {1:03d} {2}".format(track.TrackNumber, track_nr, track.Name)
            if command == "renumbersave":
                track.TrackNumber = track_nr
            track_nr += 1
        elif command == "find" or command == "replace" or command == "replacesave":
            if search(orig, track.Name):
                if command == "find":
                    print track.Name
                if command == "replace" or command == "replacesave":
                    new_name = sub(orig, repl, track.Name)
                    print "\"{0}\"".format(new_name)
                if command == "replacesave":
                    track.Name = new_name

  • FindChangeByList script to include Style Groups/sub Style Groups

    I've been using this function happily (with varying degrees of success & lots of trial and error) for a while now. I'm not a script writer, understand very little but manage to copy and paste, and hope for the best.
    This has served my wishes for the most part, but I have the need to apply a GREP search/replace to some text that needs to be styled with a paragraph style that lives inside a style group, inside another style group.
    Style group called 'Headings', inside which is a style group called 'News from Areas heads' inside which is a paragraph style called 'b head_red (News from areas)'
    I have picked up on helpful examples from others for applying a paragraph style that lives within one level of "Style Group", but don't know what the correct syntax to describe: a paragraph style within a folder, within a folder, within another folder might be?
    I did wonder if the choice of underscores and brackets in the paragraph style may not help.
    MTIA
    Steve

    Hi Jarek
    Unfortunately I don't have much scripting knowledge, but to answer your questions
    1. paraStyle real name is "b head_red (News from areas)"
        - "b head_red" is used elsewhere. Why didn't I keep it simple?
    2. Do your findWhat string work in UI (run manually)?
        - yes, when I use normal GREP find/change it works okay.
    3. Do your FindChangeByList.jsx work with some simplier example?
        - yes, I use it often. The .txt file I'm working on at the moment already contains about 10 text/glyph changes which work fine. I have had success in applying a 'paragraph style' that is within a 'style group'. But this is the first time I've tried to apply a 'paragraph style' that is in a 'style group', within a 'style group'.
    Steve

  • JS CS3 script form word styles to indesign styles

    I have search over the forums and can find a script the can change WORD styles (with a diskette sign) to Indesign paragraph styles (without the sign). Can any one help me on this?
    Thanks.

    Here I translated the script from Russian into English for you. BTW, it is based on a script written by Dave Saunders (thanks Dave for it) — I totally reworked it to my needs. You should replace paragraph style names, font names, find-search strings, etc. with your own stuff.
    Kasyan
    // Description: Script for InDesign CS3
    // Version 4
    // Removes local formatting of the text after importing it from Word transforming it into characters styles
    // Removes non CMYK colors
    // Removes imported styles
    // Adds non-breaking space before some abbreviations in text. For example: В, У, гг., млрд.
    // Removes superfluous. Finds-replaces some sequences of characters:  For example:"--" to "—"
    // Removes hyperlinks
    // Copyright © 2008 Kasyan Servetsky
    #target indesign
    if (app.documents.length == 0) {
         alert("Open a document and try again.", "Error", true);
    else {
         app.activate();
         var myDoc = app.activeDocument;
         if (myDoc.selection.length == 1) {
              if (myDoc.selection[0].constructor.name ==  "TextFrame") {
              var myTextFrame = myDoc.selection[0];
              else {
                   alert("Select a TEXT BOX.", "Error", true);
                   exit();
         else {
              alert("Select a single text block.", "Error", true);
              exit();
         if (!myDoc.saved) {
              alert("This document has never been saved. Save it and try again.", "Error", true);
              exit();
    //--------------------------------- Progressbar ---------------------------------
         var stop = 11;
         var w = new Window ( 'window', 'Preparing the file', undefined, {closeButton:false, maximizeButton:false, minimizeButton:false} );
         var pb = w.add ('progressbar', [0, 0, 350, 20], 0, stop);
         var txt = w.add('statictext', undefined, 'Starting the process');
         txt.alignment = "fill";
         w.show();
         pb.value = 1;
         var myTxtReplace;
         var myGrpReplace;
         myReplaceStuff();
         txt.text = "Finding-replacing text";
         myProblems = 0;
         myReplaceNonCMYK();
         pb.value = 2;
         txt.text = "Removing non CMYK colors";
         if (app.activeDocument.paragraphStyles.item("Body Text") == null) {
              pb.value = 3;
              txt.text = "Creating paragraph style \"Body Text\"";
              var paraStyle = myDoc.paragraphStyles.add( {     basedOn:"[No Paragraph Style]",
                                                                                                        name:"Body Text",
                                                                                                        alignToBaseline:true,
                                                                                                        firstLineIndent:2,
                                                                                                        leftIndent:0,
                                                                                                        rightIndent:0,
                                                                                                        spaceBefore:0,
                                                                                                        spaceAfter:0,
                                                                                                        justification:Justification.LEFT_JUSTIFIED,
                                                                                                        appliedFont:"TimesPalKasN\tRegular",
                                                                                                        pointSize:8.5,
                                                                                                        leading:10.6,
                                                                                                        kerningMethod:"Metrics",
                                                                                                        tracking:0,
                                                                                                        hyphenateCapitalizedWords:true,
                                                                                                        hyphenation:true,
                                                                                                        hyphenateBeforeLast:2,
                                                                                                        hyphenateAfterFirst:2,
                                                                                                        hyphenateWordsLongerThan:5,
                                                                                                        hyphenateLadderLimit:3,
                                                                                                        hyphenationZone:12.7,
                                                                                                        hyphenWeight:5,
                                                                                                        appliedLanguage:"Russian",
                                                                                                        fillColor:"Black"} );
         else {
              var paraStyle = myDoc.paragraphStyles.item("Body Text");
              pb.value = 3;
         removeImportedStyles();
         pb.value = 4;
         txt.text = "Removing imported styles";
         protectLocalStyling();
         pb.value = 5;
         txt.text = "Saving local formatting";
         myTextFrame.parentStory.texts.everyItem().paragraphs.everyItem().applyParagraphStyle(paraStyle, true);
         pb.value = 6;
         txt.text = "Applying paragraph style \"Body Text\"";
         removeInTables();
         pb.value = 7;
         txt.text = "Processing tables";
         myTextFrame.parentStory.texts.everyItem().paragraphs.everyItem().clearOverrides(OverrideType.all); // ***
         pb.value = 8;
         txt.text = "Removing local formatting";
         replaceTxt();
         pb.value = 9;
         txt.text = "Replacing text";
         replaceGrep();
         pb.value = 10;
         myRemoveHyperLinks();
         pb.value = 11;
         txt.text = "Removing hyperlinks";
         w.hide();
         if (myProblems == 0) {
              alert ("No problems were found.", "All done");
         else {
              alert ("Problems were found and corrected.", "All done");
    //************************************** Functions *******************************************************
    function protectLocalStyling() {
        var myStyles = ["Italic","Bold", "Bold Italic"];
        var myPosns = ["superscript","subscript"];
        var myPosnEnums = [Position.superscript, Position.subscript];
         var noCharStyle = myDoc.characterStyles[0];
        for (var j = myStyles.length - 1; j >= 0; j--) {
          var myCharStyle = myDoc.characterStyles.item(myStyles[j]);
          if (myCharStyle == null) {
            var myCharStyle = myDoc.characterStyles.add({name:myStyles[j], fontStyle:myStyles[j]});
              app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences.appliedCharacterStyle = noCharStyle;
              app.findTextPreferences.fontStyle = myStyles[j];
              app.changeTextPreferences.appliedCharacterStyle = myStyles[j];
              myTextFrame.parentStory.changeText();
        for (var j = myPosns.length - 1; j >= 0; j--) {
          var myPosCharStyle = myDoc.characterStyles.item(myPosns[j]);
          if (myPosCharStyle == null) {
            var myPosCharStyle = myDoc.characterStyles.add({name:myPosns[j], position:myPosnEnums[j]});
              app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences.appliedCharacterStyle = noCharStyle;
              app.findTextPreferences.position = Position[myPosns[j]];
              app.changeTextPreferences.appliedCharacterStyle = myPosns[j];
              myTextFrame.parentStory.changeText();
         app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    //  Removing non CMYK colors
    function myReplaceNonCMYK(){
         for(var myCounter = myDoc.colors.length; myCounter > 0; myCounter--){
              if (myDoc.colors[myCounter-1].name != "Registration" && myDoc.colors[myCounter-1].name != "Paper" && myDoc.colors[myCounter-1].name != "Cyan" && myDoc.colors[myCounter-1].name != "Magenta" && myDoc.colors[myCounter-1].name != "Yellow" && myDoc.colors[myCounter-1].name != "Black") {
                   if ((myDoc.colors[myCounter-1].space != ColorSpace.cmyk)  || (myDoc.colors[myCounter-1].model != ColorModel.process)){
                        myProblems = myProblems + 1;
                        myDoc.colors[myCounter-1].remove ("Black")
    // Removing imported styles
    function removeImportedStyles(){
         var paraStyle = myDoc.paragraphStyles.item("Body Text");
         var noneCharaStyle = myDoc.characterStyles.item("[None]");
         for(var myCounter = myDoc.paragraphStyles.length-1; myCounter >= 2; myCounter--){
              if (myDoc.paragraphStyles[myCounter].imported == true ) {
                   myDoc.paragraphStyles[myCounter].remove(paraStyle);
         for(var myCounter = myDoc.characterStyles.length-1; myCounter >= 2; myCounter--){
              if (myDoc.characterStyles[myCounter].imported == true) {
                   myDoc.characterStyles[myCounter].remove(noneCharaStyle);
    // Processing tables
    function removeInTables(){
         if (myTextFrame.parentStory.texts.everyItem().tables.length > 0) {
              if (myDoc.paragraphStyles.item("05. TABL_BODY") == null) {
                   myTableStyle = myDoc.paragraphStyles.add({name:"05. TABL_BODY", appliedFont:"HeliosKas\tCondensed Regular", pointSize:8, leading:8});
              else {myTableStyle = myDoc.paragraphStyles.item("05. TABL_BODY")}
         myTextFrame.parentStory.texts.everyItem().tables.everyItem().cells.everyItem().paragraphs.everyItem().applyParagraphStyle(myTableStyle, true);
         myTextFrame.parentStory.texts.everyItem().tables.everyItem().cells.everyItem().paragraphs.everyItem().clearOverrides(OverrideType.all);
    // Find-replace pairs
    function myReplaceStuff() {
         myTxtReplace =     [ // TEXT
                                            [" А ", " А^S"],
                                            [" В ", " В^S"],
                                            [" С ", " С^S"],
                                            [" К ", " К^S"],
                                            [" О ", " О^S"],
                                            [" У ", " У^S"],
                                            [" На ", " На^S"],
                                            [" По ", " По^S"],
                                            [" Из ", " Из^S"],
                                            ["г-н ", "г-н^S"],
                                            ["г-на ", "г-на^S"],
                                            ["г-ну ", "г-ну^S"],
                                            [" т", " ^Sт"],
                                            [" г.", " ^Sг."],
                                            [" гг.", " ^Sгг."],
                                            [" грн.", " ^Sгрн."],
                                            [" коп.", " ^Sкоп."],
                                            [" тыс", " ^Sтыс"],
                                            [" млн", " ^Sмлн"],
                                            [" млрд", " ^Sмлрд"],
                                            [" т.п.", " ^Sт.п."],
                                            [" т.д.", " ^Sт.д."],
                                            [" др.", " ^Sдр."],
                                            [" км", " ^Sкм"],
                                            ["см. стр.", "см.^Sстр."],
                                            [" ^p", "^p"],
                                            [" —", "^S—"],
                                            [" —", "^S—"],
                                            ["№ ", "№"],
                                            ["$ ", "$"],
                                            ["EUR ", "EUR"],
         myGrpReplace =     [ // GREP
                                            ["[~m~>~f~|~S~s~<~/~.~3~4~% ]{2,}", " "], // Multiple Space to Single Space
                                            ["--", "~_"] // Dash Dash to Em-dash
                                            // ["~b~b+", "\\r"], Multiple Return to Single Return
    function replaceTxt() {
         app.findTextPreferences = NothingEnum.nothing;
         app.changeTextPreferences = NothingEnum.nothing;
         app.findChangeTextOptions.wholeWord = false;
         app.findChangeTextOptions.caseSensitive = true;
         app.findChangeTextOptions.includeMasterPages = false;
         for (i = 0; i <  myTxtReplace.length; i++) {
              var myCurArray = myTxtReplace[i];
              app.findTextPreferences.findWhat = myCurArray[0];
              app.changeTextPreferences.changeTo = myCurArray[1];
              myTextFrame.parentStory.changeText();
         app.findTextPreferences = NothingEnum.nothing;
         app.changeTextPreferences = NothingEnum.nothing;
    function replaceGrep() {
         app.findGrepPreferences = NothingEnum.nothing;
         app.changeGrepPreferences = NothingEnum.nothing;
         for (i = 0; i <  myGrpReplace.length; i++) {
              var myCurArray = myGrpReplace[i];
              app.findGrepPreferences.findWhat = myCurArray[0];
              app.changeGrepPreferences.changeTo = myCurArray[1];
              myTextFrame.parentStory.changeGrep();
         app.findGrepPreferences = NothingEnum.nothing;
         app.changeGrepPreferences = NothingEnum.nothing;
    function myRemoveHyperLinks(){
         if (myDoc.hyperlinks.length > 0){
              for(var myCounter = myDoc.hyperlinks.length; myCounter > 0 ; myCounter--){
                   myProblems++;
                   myDoc.hyperlinks[myCounter - 1].remove();

  • Script out many stored procedures at once?

    I found lots of methods for individually scripting out stored procedures, but I'd like to know if there's a way to do many (like 100 or so) at once.
    Ideally, I'd like to execute something that would save all the procedures that start with 'dev_' to the file system somewhere, then delete the dev_ SP's from the database and leave the other SPs that actually get used.
    Is that possible in one step?  Does any one have a link or an idea?
    Thanks in advance!!

    Actually, I did slight modifications after that - here is a version that really scripts them:
    set nocount on
    DECLARE @Test TABLE (Id INT IDENTITY(1,1), Code varchar(max))
    INSERT INTO @Test (Code)
    SELECT 'IF object_ID(N''[' + schema_name(schema_id) + '].[' + Name + ']'') IS NOT NULL
    DROP PROCEDURE ['+ schema_name(schema_id) +' ].[' + Name + ']' + char(13) + char(10) + 'GO' +
    OBJECT_DEFINITION(OBJECT_ID) + char(13) +char(10) + 'GO' + char(13) + char(10)
    from sys.procedures
    where is_ms_shipped = 0
    DECLARE @lnCurrent int, @lnMax int
    DECLARE @LongName varchar(max)
    SELECT @lnMax = MAX(Id) FROM @Test
    SET @lnCurrent = 1
    WHILE @lnCurrent <= @lnMax
    BEGIN
    SELECT @LongName = Code FROM @Test WHERE Id = @lnCurrent
    WHILE @LongName <> ''
    BEGIN
    print LEFT(@LongName,8000)
    SET @LongName = SUBSTRING(@LongName, 8001, LEN(@LongName))
    END
    SET @lnCurrent = @lnCurrent + 1
    END
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth
    Naomi Nosonovsky, Sr. Programmer-Analyst
    My blog

  • Can automatic master application be scripted by paragraph style?

    Help! I've been trying to figure out how to do this for a few days now. I could have sworn I've seen this done somewhere, but I can't find any references now. Someone suggested that it might be scriptable, so...
    I'd like to conditionally select a specific master page template based on a paragraph style.
    For example, the first paragraph style on every chapter in my book is "Title (Chapter)." When that paragraph style shows up, I'd like InDesign to automatically apply the appropriate master page template to that page, but default back to the standard master for all following pages.
    Anyhow know how to do this?

    Hi
    There is a solution from freelance book design but is not gree. A more basic script can be found by google searching for ApplyMasterpageToStyleCS5.
    I hope it helps...

Maybe you are looking for