Replacing based on style

Hello,
I have a series of documents in which a number of stylesheets are based on "Basic Paragraph". I want to change them all to be based on No Paragraph Style. The script below targets the correct folder (Fonts, within General), but there is something wrong with my syntax in the loop (line 15).
Thanks in advance for any help with this.
Tim
var myDoc = app.activeDocument;
var theseStyles = myDoc.paragraphStyleGroups.itemByName ("General");
var targetStyles = theseStyles.paragraphStyleGroups.itemByName("Fonts");
var numberStyles = targetStyles.allParagraphStyles.length;
alert(numberStyles);
for  (var i = 0; i<numberStyles; i++){
    var currentStyle = targetStyles.allParagraphStyles[i];
    if (currentStyle.basedOn = "Basic Paragraph"){
        currentStyle.basedOn = "No Paragraph Style";

Thanks Chinnadk - that works now. But am i right in thinking that you have replicated my original mistake, and the first line should read:
if (currentStyle.basedOn == myDoc.paragraphStyles.item("[Basic Paragraph]")){
ie. two equals signs to test truth, rather than one to assign value.

Similar Messages

  • How to specify different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position?

    Hello,
    I am trying to provide different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position. I have 2 af:panelSplitter with orientation="horizontal" - One with positionedFromEnd="true" one with positionedFromEnd="false". I want to specify the horizontal collapse and restore icon using Skinning. I want specify different icons based on positionedFromEnd. When I specify icons they are appearing for both splitters. I gave 2 different styleClass to these splitter but it is not taking them in account,
    JSPX Page -
    <af:panelSplitter orientation="horizontal" splitterPosition="196" positionedFromEnd="false" id="pnlSplitterLeft" collapsed="false" styleClass="panelSplitterLeftClass">
      <f:facet name="first">
      <!-- Content of First Facets -->
      </f:facet>
      <f:facet name="second">
      <af:panelSplitter orientation="horizontal" splitterPosition="196" positionedFromEnd="true" id="pnlSplitterRight" collapsed="false" styleClass="panelSplitterRighClass">
      <f:facet name="first">
      <!-- Content of First Facets -->
      </f:facet>
      <f:facet name="second">
      <!-- Content of First Facets -->
      </f:facet>
      </af:panelSplitter>
      </f:facet>
    </af:panelSplitter>
    CSS Skinn
    af|panelSplitter::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Open.gif");
    af|panelSplitter::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Close.gif");
    af|panelSplitter.panelSplitterLeftClass::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Open.gif");
    af|panelSplitter.panelSplitterLeftClass::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Close.gif");
    af|panelSplitter.panelSplitterRighClass::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Right_Open.gif");
    af|panelSplitter.panelSplitterRighClass::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Right_Close.gif");
    It is always showing Left_Open.gif and Left_Close.gif for both splitters. But I want different image.
    How to specify different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position?
    - Sujay

    CSS attribute selectors are what you are talking about, but binding the selector with EL is a more-common approach. Using selectors like this require you to ensure browser support.
    af|panelSplitter.panelSplitterRighClass::horizontal-collapse-icon [positionedFromEnd=true]

  • Cosmetic Glitch when Replacing a Silver Style Combo Box by a String

    As the title says, if you replace a Silver Style Combo Box by a String (same data type), things turn ugly:
    Nothing of the sort happens with the other styles as can be seen above too.

    Hi X
    Yea I get the same behavior in 2012 and 2013. A workaround for this would be to replace the original control or indicator with a non-silver version of the control and then replace that control with the desired silver style control. This seems to work for me.
    Paolo F.
    National Instruments
    Applications Engineer

  • Auto-set Conditional Build Tags Based On Style?

    Is there a way to auto-set conditional build tags based on style?
    I want to be able to import a Word document into RoboHelp and have it recognize certain styles as requiring certain conditional tags. For example, an imported Word document might have a style called WD_Internal and any text with that style would automatically have a conditional build tag assigned to it. The idea is to allow my SMEs to indicate which text is intended for internal audiences and which text is OK for customer consumption in a single central Word document using styles. When the content is correct, I'd import it into RoboHelp, have RoboHelp assign conditional build tags, then generate multiple printed versions of the document (an internal version and a public consumption version).
    Setting conditional build tags is pretty easy, but it will still be a lot of work to manually set them. Is there a way to do this automatically?
    I am using RoboHelp HTML RH9.

    Hi,
    There's no way to do this through the interface. You can however create a script to do this for you. Cycle through the content of the topics and insert the code for the CBT.
    Greet,
    Willam

  • How to replace a paragraph style with object style

    Hi,
    I am having this issue lately that in paginating a newspaper I have to do all premium post with a Rectangle Border. the problem is that the text is in the grid.
    Is there anyway that, while I add a specific paragraph style to some parts of the text, I can automatically give this text a specific Object Style (like stroke rectangle)
    Does it make sense?
    Thank you very much

    Michael,
    I think that I did not explain myself as I should have. The problem is not really related to links but more of a automatic replacement issue.
    Every time I do this newspaper I include a new text information and the location of the Headers changes in every single case.
    http://i.imgur.com/sgQ2wIK.jpg
    In the link, the blue paragraphs need to be replaced with the respective Header Icons that you see on top and everytime this location of the headers in the newspaper changes due to the different number of posts in each specific category. Now the problem is related on how to autoaticaly replace this string in blue with its respective header
    thanks a lot in advace for all your help

  • Find and replace a table style

    I have about 10  table styles in a document and I want to replace all of them with the #1 table style. Can this be done with Find and Replace?

    You'll need to do this for each of the Table formats that need to be replaced.
    Let's assume the desired format is "Format A" (a default FM style), and one of the formats to be changed is "Specs 2".
    Click in any instance of a Specs 2 table.
    In the Table Tag field, pull down and click on [Format A].
    Click Commands > Global Update Options:
    (*) All Properties
    (*) All Tagged [Specs 2]
    [Update]
    If it works properly, you'll get a dialog:
    OK to change all Format B tags to Format A?
    [OK]
    Additional global updates may be required to clean up any overrides.
    Trying this on FM7 at home, it didn't always work. I don't know if newer versions are more stable. Personally, I never do it this way (probably because of prior experience), and I usually just hack the MIF.

  • Why not there a "Find/replace in Grep style" inside the Para style?

    Whenever I type a digit in my text, it should be colored red as per style. I do this by grep style inside the para style, but now I need to insert brackets before and after of the digit(s), i realize that there is no replace option in grep style in the para style. Why not it be there a "find/replace" instead "find" only as it now appears?

    Ya, this is simple, finding a specific para style with digit and change them, when the book in first pass. But while in the correction pass of the same book, whenever we are inserting more text into the document, there are chances to be unaware of the digit style that, it should be surrounded by brackets, and it happened earlier so I have a thought of it. Again, while paginating a book having more than 350 - 600 pages, and 3 to 4 guys working in it, I think this may work.
    Expecting your valuable comment on this.
    Thangaraj Mohan.

  • Find based on style in CS2

    Hi All
    I am trying to write script for search based on paragraph style here is my code
    var myDoc = app.activeDocument;
    var myStylename = myDoc.paragraphStyles.everyItem().name;
    var myStylenamelen = myStylename.length;
    var myStyles = myDoc.paragraphStyles;
    var mySlen = myStyles.length;
    for (var a=0; myStylenamelen > a; a++) {
    for (var j=1; mySlen > j; j++)
    if (myStyles[j].basedOn == myStylename[a])
    alert("Paragraph style " + myStyles[j].name + " " + myStylename[a]);
    exit();
    can anyone tell me what me doing wrong
    Thanks
    Shonky

    Hi,
    Is this what you want:
    var myDoc = app.activeDocument;
    var myStyles = myDoc.paragraphStyles;
    var mySlen = myStyles.length;
    for (var a=0; mySlen > a; a++) {
    try {
    alert("Paragraph style " + myStyles[a].name + " " + myStyles[a].basedOn.name);
    } catch (e) { alert("Paragraph style " + myStyles[a].name + " undefined"); }
    I don't know why you made the big construction when you can get the name of the basedOn with no extra effort. But that could be me.
    I have inserted a try-catch because you get an error when you take a basedOn of a root paragraph style.
    Greetz,
    Glen

  • Restarting footnote numbers based on Styles

    Is there a way to restart the footnote numbering based on a Style. I have a long document which has 120 chapters with numerous footnotes (Academic book) and I need the footnotes to restart on each chapter. I have a style that is the chapter header. I want the footnotes to restart the numbering based on this style. Short of manually entering 120 section break is there a way to this automatically? As the document is in flux (with many chapter/text reflows) I want to be able have the footnotes restart for each chapter. Does anyone know how to do this?

    David W. Goodrich wrote:
    As you have probably discovered, you can re-start numbering with "sections" (Pages palette) but those are linked to pages so if a given chapter flows onto a new page you'd need to add a page wherever this happened lest subsequent sections get out of whack.
    Really? Did you try that? In my expereince footnotes do not restzart with section breaks. They DO restart at the beginning of a new story, so if each chapter is its own story, and not threaded to other chapters, whether in a book or a single file, the numbers will restart.
    This is the opposite of the complaint we usually get that people want number to continue across chapters.

  • Possible to not have InDesign CC automatically generate class names based on 'Style Name'?

    In the Export Tagging settings in InDesign CC, there is an option to use a custom tag as well as a custom class name. However, if the class is left blank then the Style Name is used in its place.
    Is it possible to not have InDesign assign a class automatically?
    Here is my scenario: I would like to not clutter up my HTML markup by having a class name of `body` for all my p tags, when I could simply use p without a class and style it in my CSS.
    Thank you in advance.

    This is even worse than a Bug. It's a huge expense.
    Even if you make your paragraph style 1 letter, let's say "B" for "Body", You still end up with <p class=B> instead of just <p>. Now multiply that "class=B" by all the lines in your code and your bloat is greater than 10% on a per file basis.
    On Amazon a 3 MB file for example costs 45 cents to transmit to a customer. 10% more means an additional 4.5 cents cost per book. Say you sell 100,000 copies of a book, we're talking .045 x 100,000 = $4,500.00. And remember that MOBIs pretty much double the size of your basic EPUB. This is a serious problem, the correction of which cannot be delayed!

  • Script that make search and replace based on external configuration file

    Hello!
    As I have to make a lot of string replacements on text file, I need to write the script that takes values from separate file. It can be on this or other format:
    old;new
    Search_string;Replace_string
    I have searched the web and only found this
    thread  but the script download link on this
    thread does not function (I have played with import-csv and loops, but I think that I have a lack of the Powershell knowledge to realize this).
    Any help would be appreciated.

    One possibility:
    'old;new',
    'Search_string;Replace_string'
    ) | set-content replacements.txt
    $replace = (Get-Content replacements.txt |
    foreach {"replace('{0}','{1}')" -f $_.split(';')}) -join '.'
    $string = 'old stuff Search_string'
    $newstring = Invoke-Expression ('$string.' + $replace)
    $newstring
    new stuff Replace_string
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Set content-based cell style

    Is there any way to use GREP or something to apply style to cells by its' content?
    Situation:
    I have a table of about 10K rows, and in one column cells contain specific symbol. They must have different color. Doing it manually is a real hell to me.

    Use this (MyColorCellStyle should be set to your cell style):
    if (app.selection.length == 1)
              app.findTextPreferences = null;
              app.findTextPreferences.findWhat = "<266a>";
              myResults = app.selection[0].findText();
              for (i=0; i<myResults.length; i++)
                        myResults[i].parent.appliedCellStyle = "MyColorCellStyle";
    Not bad, considering I'm down with a case of the sniffles & me 'ead is 'urting.

  • Find and replace paragraph style

    I am creating a javascript for InDesign in order to search and replace some text. The text I am looking for has to be in a certain Paragraph style.
    This is what I have so far:
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = '^p'
    app.changeTextPreferences.changeTo = ';'
    app.activeDocument.changeText();
    I need to find/change a return of a certain paragraph style to a semi colon. What is the script that I would use to search for paragraph style?

    try:
    app.findTextPreferences.appliedParagraphStyle = 'para style';
    If you want to replace the para style, use:
    app.changeTextPreferences.appliedParagraphStyle = 'new para style'

  • Efficient Replace Style needed

    Last April I asked if anyone knew how simply to replace a graphic style in AI. Up to now I have no real answer except that which Scott Falkner kindly suggested (below). I take it that there is not easy way to do this, perhaps for technical reasons but maybe because it's an oversight. Thanks for trying to provide a simple way to do this rather than making the user use a round about way.
    Scott Falkner - 12:23pm Apr 12, 08 PST (#4 of 4)
    Unlock and show all layers and objects. Create a new global colour swatch, then redefine the style to use that swatch as a fill or stoke. Select an instance of the stye then use Select > Same > Fill Color or > Stroke Color to select all uses of that colour. You should now have all instances of the style selected. Apply the style you want. Sun the action Delete unused palette items and the now unused style should go away.
    Untested.

    This may be posted in the wrong thread by perhaps this answer will help, yanwell. It appears you are editing the bounding box and not the object within it. Here is what I suggest.
    Illustrator has a marvelous Layer/Object window. It's simply called 'Layer,' but as someone kindly pointed out to me some time ago, 'objects' are stored either under a Layer or Sublayer. This is crucial for understanding Illustrator since this allows you to easily choose a layer or an object in order to edit it or even apply a style. Styles can become very confusing here so watch out. This is covered elsewhere on the forum.
    I believe you should bring up your Layer window and find the layer on which the object you want to edit is (you can open all main layers by Option and clicking a closed layer to open all layers). *However* this will not open layers and objects under this main layer. You must expand the main layer and sublayers to get to the objects. Once there then use the little 'selection circle' on the right (the 'target' circle is the correct name I believe). If grouped then you have to open that group manually (all of this 'opening' is very tedious sometimes; I wish Adobe would make this easier). You will note that there the object and its bounding box are under this group. If you choose the object (rather than the bounding box) you should be able to proceed with your editing. Remember, once you get used to using the 'target' option in the Layer window you will greatly improve your efficiency in editing complex docs.
    What I don't understand is why Adobe doesn't make all of this clear somewhere (like in Help) but leaves it up to us poor users to figure it out. It caused me great frustration when I moved from Freehand to Illustrator. It may be buried in some tutorial.

  • Disable prompt to "replace current styles"?

    Hi,
    If I select a shape layer that I've created, then click the Styles icon in the toolbar to apply a new style to it, it comes up with the preview box.  Then I click the small button to the right to open the styles dropdown menu where I select, for example, Glass Buttons to show those styles.  But it always prompts "Do you want to replace the current styles with the styles from... [selected styes]?"  
    Is there a way to override this and disable this prompt so I can select and immediately view the newly selected style group?
    Thanks!

    The only easy way i'm aware of is to hold down the Alt key to bypass the dialog.
    MTSTUNER

Maybe you are looking for

  • Logical And Physical Joins Of  SH_PartTwo.rpd provided  by oracle OBIEE

    Hi, I am new the OBIEE tool.After downloading SH_PartTwo.rpd .Planned to recreate the physical and logical joins. If any one has already tried this, kindly explain why we are creating Alias tables of (SALES,TIMES)and joining COSTS to them instead of

  • "backspace" shortcut?

    my backspace key is broken. I am wondering if it is possible to write a new shortcut for backspace (that is not ctrl x, or "cut") so that i do not need to get a whole new keyboard.

  • Skype and iSight

    Hello all I have recently acquired my first Mac and am trying to get Skype to recognise the internal iSight so that I can make video calls. I have read the related discussion topics and followed the instructions regarding the Skype video set up. Howe

  • Does somebody has a driver for canon IP4600 series which works on OS X Mavericks?

    Everytime I try to use my Printer apple tries to configurate first. After waiting some time they are telling me that the software-website is not online at the moment. Does somebody has an idea how to use the printer? Would be great Thanks Julius

  • Where is the user image file located?

    So, I know this has been discussed before, but I can't find a sollution that works in Mountain Lion. I'd like to be able to locate the image file which I'm using for my user account icon. It also appears in iMessage and Contacts, but I can't drag it