How to apply two different styles to help find and replace

Hi all

In the manuscript, I have many paragraphs list of ball. In indesign, I have three styles (first Bullet, intermediate ball and the last ball). I can easily applied the style of ball intermediate (BL) to all paragraphs of bullet list. Now I need to apply the first Bullet (BL1) and last bullet (BL2) style. I used the script below, but it is not applied in specific styles.

app.findTextPreferences.appliedParagraphStyle=app.activeDocument.paragraphStyles.item("BL");
var myResults = app.activeDocument.findText();
     for (i = 0; i <= myResults.length - 1; i++) 
     { 
          myResults.select; 
          var mySel = app.selection[0];
          var myParagraphs = mySel.paragraphs.length;
          //alert(myParagraphs);
          mySel.paragraphs[0].appliedParagraphStyle = "BL1";
          mySel.paragraphs[myParagraphs-1].appliedParagraphStyle = "BL2";
     }

Kindly help me on this...

As so often said in this forum, there is no need to choose anything:

for (i = 0; i< myresults.length;="">

{

myResults [i] .paragraphs .appliedParagraphStyle [0] = 'BL1;

.appliedParagraphStyle .paragraphs [-1] myResults [i] = 'L2 ';

}

Peter

Tags: InDesign

Similar Questions

  • How can I adapt this script GREP to find and replace the current open document?

    // Get the current selection
    var doc   = app.activeDocument;
    var sel   = doc.selection;
    var frame = sel[0];
    
    
    if (!frame || frame.constructor.name !== "TextFrame") {
          var msg = "Please select a text frame containing";
          msg += " the story you wish to format";
          alert(msg);
    } else {
          var story = frame.parentStory;
    
    
          // Reset the Find/Change options
          app.findGrepPreferences = NothingEnum.nothing;
          app.changeGrepPreferences = NothingEnum.nothing;
    
    
          // Remove all soft returns, then replaces all double spaces to single spaces
          app.findGrepPreferences.findWhat = " \s+\n";
          app.changeGrepPreferences.changeTo = " ";
          story.changeGrep();
        
          // Remove all multiple spaces
          app.findGrepPreferences.findWhat = "\s+";
          app.changeGrepPreferences.changeTo = " ";
          story.changeGrep();
    
    
          // Split Listings WITH Images
          app.findGrepPreferences.findWhat = "(\d\d-\d+.*)\t(?!~a)(.*)\t(.*)\r";
          app.changeGrepPreferences.changeTo = "$2\r$1\t$3\r";
          app.changeGrepPreferences.appliedParagraphStyle = "Description";
          story.changeGrep();
        
    //      // Split Listings WITHOUT Images
    //      app.findGrepPreferences.findWhat = "(?<=~a)(.*)\t(.*)\t(.*)\t(.*)\r";
    //      app.changeGrepPreferences.changeTo = "$1 $2\r$3\t$4\r";
    //      app.changeGrepPreferences.appliedParagraphStyle = "Description";
    //      story.changeGrep();
        
          // Format Pricelines
          app.findGrepPreferences.findWhat = "^(\d\d-\d+-\d\t.*)\r";
          app.changeGrepPreferences.changeTo = "$1\r";
          app.findGrepPreferences.appliedParagraphStyle = "Description";
          app.changeGrepPreferences.appliedParagraphStyle = "Priceline";
          story.changeGrep();    
    }
    
    

    Hello

    story.changeGrep ();      ==> This sets a goal of change

    To replace it any doc as target

    doc.changeGrep ();

    and remove part of the code that is cause of selection type do not need you to check

    Jarek

  • Whenever the computer is started, two different styles of start menu appear on the screen, divided vertically from left to right.

    Original title: is this monitor or windows?

    This condition began while I was running xp sp 3.

    I worked in google earth at the time.

    I don't remember exactly what happened.

    But now, every time I start windows, two different styles of the start menu

    appear on the screen, divided vertically from left to right.

    The menu on the right can only be extended to about half of the control panel to the left.

    The menu on the left can grow to the right once the right image has been reduced.

    I tried to reset the start menu in the program settings without success.

    Anyone have any ideas?

    I hope that I was clear enough with this info.

    The article you referred to seems to apply to vista and windows 7.

    How ever, before I received your reply I had already solved the problem myself"

    I appreciate the proposed both help Lisa M and Azeez 'n'

    No further assistance is necessary.

    Thanks again.

  • How to apply a character Style that has already been made in a document model?

    First of all, I would like to thank everyone who helps. I am a complete newbie to the script and appreciate your help.

    I mainly use GREP expressions to search for patterns in a document and apply a character Style that has already been done. This character style did not help script, but just in InDesign when the production and implementation of the model.

    var myDoc = app.activeDocument;
    
    
    //Clear the find/change grep preferences.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    
    //Set the find options.
    app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    
    //GREP Expression for finding all HEADERS
    app.findGrepPreferences.findWhat = ".+\n";
    
    //Applying formatting changes to put into All Caps, Bold and changing the font size to 12 pt.
    app.changeGrepPreferences.capitalization = Capitalization.allCaps;
    app.changeGrepPreferences.fontStyle = "Bold";
    app.changeGrepPreferences.pointSize = "12";
    myDoc.changeGrep();
    
    //Clear the find/change preferences after the search.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    

    This is how I currently. I will manually define the changes made to the text. The problem is, each model uses a different set of fonts and not all use them "BOLD", for example Sabon can use THIS "BOLD".

    I would like to know how to apply a character Style and tried to look, but nothing seems to work.

    Any help would be appreciated.

    Thank you.

    app.changeGrepPreferences.appliedCharacterStyle = "A";

  • Hello. How to link two different language site

    For example, I built two different Web site in English and Somali that work together. If someone who has read the Somalis can go to the pages of Somali somali Web site or someone who reads English can go to the English pages on the English site, so please is there anyone can help with this situation?

    Hello

    Please check the following threads,

    How to set up a multilingual with Adobe Muse website and push it live Adobe Business Catalyst

    Re: How can I create different languages for my page?

    I hope this helps. Let me know if you have any question.

  • How to use the different style sheets for ChangeAttributeRequest workflow in OAM

    Hello

    We have a requirement to invoke different change attribute request workflows (change password, change email etc.) of external JSPs.
    I want to apply different style sheets for each workflow. In the URL of the workflow if I get style = the style sheet name its not not using this stylesheet. Its still using the same basic (wf_changeattr.xsl) stylesheet. How can I use different style sheets? Pointers on this is appreciated.

    Thank you inadvance.

    Kind regards
    Srikanth

    Hi Srikanth,

    Are you using & xsl = stylesheetname or & style = parameter? XSL = must specify a specific xsl file, while & style specifies a complete style (for example & style = style0 for the default style).

    Kind regards
    Colin

  • Two different programs, is Security essentials and windows defender? They collide

    Original title: security essentials

    Two different programs, is Security essentials and windows defender? They collide

    Yes, 2 different applications. Defender is anti-spyware only and Security Essentials has antispyware and antivirus. Windows Defender is useless if you use Microsoft Security Essentials, given that the built-in anti-spyware component and allows you to disable Windows Defender by design.

    See http://answers.microsoft.com/en-us/protect/forum/protect_start/windows-defender-and-microsoft-security-essentials/5309cb8d-02e1-40e8-974f-0dcedb9ab9fd

  • How can I find and replace the xml tags?

    Hi, I am using xml in my workflow and want to be able to remove some tags if they contained particular text.

    Here is an example of the xml struct...

    < Entry >

    < name > DEFAULT < / name >

    < such > default < / such >

    DEFAULT < address > < / address >

    < / Entry >

    I use this initial structure to define paragraph styles to follow when you import the xml data.

    This leaves DEFAULT in place everywhere where an entry is not any content of this field.

    I want to be able to import my XML and then run a script that deletes tags that include by DEFAULT, - I need to the xml tag to remove not only the text, if I do a normal find and replace will remove only the text not the tags that is causing problems with style. I also want to remove the end of para/return (^ p) that I placed at the end of the line. So it would be the same opening editor mode and removing content, tags + hard back in there, but I want to automate the process...

    So I think that's what I'm looking for in each case

    "< name > DEFAULT < / name > ^ p.

    and I want to replace it with nothing.

    Is this possible in a script (ideally javascript)?

    I have a little knowledge of javascript, but don't know how to search for and target this kind of string in indesign...

    using indesign cs5

    Thank you very much

    Hello

    Script should do it in two steps:

    1 find all occurrences of that is ' > by DEFAULT.<>

    2 delete the whole paragraph which is a found_text container.

    For example, in this way - JS - (a textFrame filled your text must be selected):

    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    

    Rgds

  • Ideas: I get the 0x80073AFC error code when I try to use the system restore then, how can I find and replace this file missing MUI?

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: I get the 0x80073AFC error code when I try to use the system restore then, how can I find and replace this file missing MUI?

    • I am running Windows 7 for packs SP 1 or SP 2 does NOT solve my problem since neither one works with Windows 7.  Is there a way to search for this MUI (Multiple User Interface) missing file? The every thing must have himself installed in the first place. I took my mom (she died in June) and my brother on this PC as users so even if they do not use this PC supports multiple users. Maybe if I deleted as a reboot and additional users it will solve my problems. My updates install OK but I can't run at all system restore. It creates a restoration point OK but when I try to sr back to a restore point before I get the error 0x80073AFC topic of the missing MUI file. Then, when I spear SR it is said that he could not and no files have been changed because of the error 0x8000FFFF error, unspecified catastrophic failure and could not retrieve the file several times when system restore is attempted.

      I'm running Windows 7 on a HP Pavilion with browser Firefox 3.6.8 browser Opera 10.60, IE8 and Google Chrome 5.0.375.125 browser browser.

      Can you tell me what I try next? Thnks a lot and sayonara for now the guy-Jack McElwee / keimanzero the Scion of the Anime in Brookhaven PA - USA

      OK I tried everything and nothing works! Only added beginners are updated browser Opera 10.63; IE9 (Beta); Firefox 3.6.12 and Google Chrome 7.0.517.41 and Java 22. Of course like everyone else in the world, I had to uninstall/enable and disable/download again and reinstall new Adobe Flash 10 and 11 of the shock wave and they keep crashing too! Hello 4 keep screwing browsers and now I get connection network problems. I run Comcast doctor and did everything it said to do, but nothing works. Oh and I added 7-Zip and WinZip also. Likewise, they will not work! Help! Thanks - K & K

    keimanzero,

    Comcast of Norton Security Suite version is installed? If Yes, who and perhaps malware is most likely to cause questions you have published, in particular the failure of the restoration of the system.
    First, configure the system to boot - How to solve a problem by performing a boot in Windows Vista or in Windows 7
    NOTE: Start-up mode minimum state all the 3rd party firewalls will be disabled. Open Control Panel > Windows Firewall to make sure that the native firewall of Windows 7 is now on.

    Download and Save the update system (or CheckSUR) tool. You will need to download the specific Version of CheckSUR corresponding to the architecture of the system to Windows 7. If you do not know the architecture of the system, and then click the link that says "Click here to show or hide the instructions step by step with images" under method 2: download the update directly system preparation tool from Microsoft Download Center .
    Description of the preparation tool system update for Windows Vista for Windows Server 2008, for Windows 7 and for Windows Server 2008 R2

    Once the download is complete, close all open programs and browsers. Now, run CheckSUR with the system connected to the internet because it will download the .cab for system files. Reboot once CheckSUR is complete.

    Secondly, I suggest that you run the File Checker system while in the same clean boot state.
    To run the System File Checker tool, follow these steps:

    1. Click Start and type cmd in the field search programs and files .
    2. Right click on cmd.exe in the programs of list, and then choose 'run as administrator '.
      If you are prompted for an administrator password or a confirmation, type your password or click on continue.
    3. At the command prompt, enter the following line exactly as written including the space between thec and the/and then press ENTER:
      sfc/scannow

    When the analysis is complete, test to see if the problems facing the system have been resolved.

    If they are not, you will need to contact Norton support for the version of Norton Internet Security Comcast to get help, or just uninstall NIS, run the Norton removal tool (right click Norton_Removal_Tool.exe, choose "Run as Administrator"), reboot and then check to see if the problems are still occurring.

    Expert MowGreen Windows IT Pro - consumer safety

  • Can I find and replace an object? And I can copy styles from another file InDesign?

    Hi all

    I hope someone has a solution to these two...:

    First, I have a line object between two text frame, and I want to change the thickness and color, no problem, it's

    the problem is I have 100 of them and now I'm a one, is it all find and replace for an object?

    Secondly, is it possible to copy a style from another file InDesign without synchronization of all styles in a book file?

    I'll be very grateful for an answer!

    Thank you

    Vraja

    In the find and Replace dialog box, there is a tab object. You can find your line by its attributes and change. I suggest the setting up and style object and replace all your lines of this style. In this way, the next time you need to change them, you can change the style.

    Regarding the copy of a style of an InDesign document to another. You can just copy something to the style and paste it into the document you want to move to.  (This will not work if the style of the same name exists in the file you are pasting to. In this case, your stuck item would take on the attributes already defined in the new file).

  • Find and replace paragraph styles?

    Hi all

    I'm building a desktop, Tablet and phone layouts for a site.  What is the the faster/more easier way to change between layouts paragraph styles?  Is there a way find and replace paragraph styles?  If I copy / paste the contents of the desktop version to the version of the Tablet, and I've set up styles for each layout, how to change styles without manually changing each iteration of the style?

    Example: I paragraph title book BookHdr styles and BookHdrTablet is it possible for me to automate changing all instances of BookHdr in BookHdrTablet?

    Thank you very much, Barbara

    There is no way to override the styles heavily; You can, however, change the styles of multiple objects by shift-click to select.

    David

  • How to find and replace data in fields of form in acrobat xi, its not allowing to do while trying, one

    How to find and replace data in fields of form in acrobat xi, its not allowing to do while trying, request adobe livecycle to settle. Help, please.

    Best way to do is the following:

    -Open the PDF in Acrobat.

    -Go to tools - form - form more Options - export data.

    -Save form data in an XML file somewhere on your system.

    -Open the XML file in a plain text editor (I recommend Notepad ++).

    -Let's say you want to replace all the years in dates "2013" to '2014 '. Do a global search & replace '2013-' to '2014' - (I added the dashboard in order to ensure that only the date fields are changed).

    -Save the XML file (maybe under a new name).

    -Go back to the PDF file and now go to tools - forms - more form Options - import data.

    -Select the modified XML file and import it.

    -Fact!

  • Help to find and replace. Please

    I imported a text where there are in italic content original, but when put in IDCS4 italic text appears as _italic words_. It is under the Roman name with _ of the characters who surround him. Is it possible to find and replace. Needless to say that the text between the _s varies.

    I would like to try a find/change GREP searching (_) ([^ _] +) (_) and replace them with $2 all change to italic formatting (preferably in a character style).  This translates to seek a _, then everything that is not a _, followed of another _ and replace it with the content between the two. You can also use (_) (. +?) (_) that match the srting more runs between two characters _ in the same way (except it does not cross a paragraph break), but it will run a little slower.

    Credit for this should go to Peter Kahrel and his excellent introduction GREP...

  • How to find and replace this text in the url

    I have a NCLOB column with a text with the url between the two as shown below:
    ========================================================================
    This text is intended to testign. This text is intended to testign.
    < a PL/SQL and SQL < U PL/SQL and SQL / < u > < / a >
    Required text is also aimed at testign. This text is intended to testign.
    < a http://forums.oracle.com > < oracle metalink U > < / u > < / a >
    This text is intended to testign. This text is intended to testign. This text is intended to testign. This text is intended to testign. This text is intended to testign. This text is intended to testign. This text is intended to testign. This text is intended to testign.
    ========================================================================
    Requirement:
    ========
    It is necessary to implement find and replace functionality.
    I just need to check if the search text is present in the url or not?
    Suppose that if research of orcale.com, given that research should therefore be successful otherwise search for his part of the url must be unsuccessful.
    Here, I can give you the indicator, as always the url is located between the anchor tags * (< < /A >). *

    Tahnks in advance.
    SELECT REGEXP_SUBSTR('testhttp://forums.oracle.comoracle.comhttp://ora.com', '((.*?oracle\.com.*))') FROM dual
    
  • Need help to find and replace multiple query

    Hello

    Is it possible to run multiple searches and replace queries both in Dreamweaver 8?

    Currently I have:

    Find: current Document
    Search: Source Code
    Find: ToR
    Title: < acronym 'Mandate' = > ToR < / acronym >
    Options: Match case and find whole words

    I have search and replace about 12 acronyms on each page, and I was wondering if I can create a search and replace the query that includes all my acronyms or do I have to manually run these 12 single queries every time?

    Thanks for the help!

    I'm afraid that is both

    --
    Paul Whitham
    Certified Professional Dreamweaver MX2004
    Adobe Community Expert - Dreamweaver

    Valleybiz Web design
    www.valleybiz.NET

    "Acadieman" wrote in message
    News:eci6a5$JDL$1@forums. Macromedia.com...
    > Hi,.
    >
    > Is it possible to run multiple searches and replace queries both in
    > Dreamweaver 8?
    >
    > Currently I have:
    >
    > Search in: current Document
    > Search for: Source Code
    > Find: ToR
    > Replace: ToR
    > Options: match case and find whole words
    >
    > I find and replace about 12 acronyms on each page and I was
    > I was wondering if I can create a search and replace the query that would include
    > all my
    > acronyms or I have to manually run these 12 single queries every time?
    >
    > Thanks for the help!
    >

Maybe you are looking for