[win][js][cs4]find/change paragraph styles without losing local overrides

Hi guys i need a little help here.
I created a javascript which will find and replace doc file paragraph styles with indesign paragraph styles. everything works fine but the problem is that when it applies the paragraph styles it loses all local overrides. i tried:
changetext(false);
but its not working is there some kind of conditional parameter that i can put in the changetext() function so that it wont clear local overrides?
Thanks.
CharlesD

Thanks Kasyan. You're always there to save my day. Thank you very much...
I slightly modify the script to go through all my paragraph styles that need to be replaced coz there are hundreds of them. Im not sure though if this is the best or is there any faster way to do this:
replace("T1", "Text", "T1");
replace("T", "Text", "T");
replace("1", "Heads", "1");
replace("2", "Heads", "2");
function replace(input, folder, output) {
    var foundItem;   
    var doc = app.activeDocument;
    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = ".+";
    app.findGrepPreferences.appliedParagraphStyle = input;
    var foundItems = doc.findGrep();
    for (var i = 0; i < foundItems.length; i++) {
        foundItem = foundItems[i];
        foundItem.applyParagraphStyle(doc.paragraphStyleGroups.item(folder).paragraphStyles.item( output), false);
    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;

Similar Messages

  • How can I force a paragraph style without losing italic?

    This has been annoying me for ages. I work on documents in Word, applying italic to book titles etc, and then import into indesign. I apply a paragraph style and three times out of four the bits of italic are preserved. However, the fourth time the paragraph style doesn't take (probably because of the presence of italic) and I have to force it to do so by using Alt-click. Invariably the italic is then replaced by roman.
    It's happening just now with a whole lot of footnotes and endnotes in a book I'm working on and means I have to go back through them all, manually applying italic to my book titles and references. Is there any way to force an endnote/footnote paragraph style without losing the italic text?
    Thanks for any suggestions,
    Tom.

    I'm not sure that forward planning is so necessary here.
    If your only concern is losing italics when importing from Word, create,
    in InDesign, an italic character style. Then do a search and replace
    throughout the InDesign document (after you've placed the Word file)
    searching for italics formatting, and replacing with your italics
    character style.
    That will prevent you from losing your italics formatting.
    Repeat for bold, bold italics, superscript, subscript, and anything else
    the author uses.
    There are some scripts that help in this process (I think one of them is
    called "preptext", by Jongware).
    If you want a comprehensive solution that can find every type of
    formatting override and creates and applies the appropriate character
    style, check out my "Create Character Styles from Overrides" script,
    available under the scripting tab on freelancebookdesign.com.
    Ariel

  • Changing sim cards without losing music and video on iphone

    I have an iphone 3gs, with an Australian account. I have gone on a trip to London and have obtained a payg sim card here. Before I left I unlocked my iphone with my provider and am looking to use the UK sim card. My concern is that if I change sim cards I need to restore my iphone. Does this mean that I lose my music, video and podcast files? All the originals are on my pc at home in Australia. Is there a way that I can change sim cards without losing my media files in the iphone?
    thanks

    I too have an account with 3 Australia (now known as VHA) and am using it in Malaysia during my holidays here. Anyways to your question:
    No if done properly you don't even need to restore your iPhone. If your phone is already unlocked just chuck in the new SIM card and that's it.

  • Changing apple ID without losing content.

    I am having to change apple ID since I changed internet (email) provider. I have gone into set up a new Id: but when I look at Itunes account it is still listing underprior name; also if I go on ipod to download I get a prompt to enter password to the old account. I have not restarted computer since I entered new email adress as apple ID; I am afraid I am going to lose all of my content. Any suggestions?
    Kelly

    All your content is saved to you computer it's self so u shouldn't lose anything.  However, when in doubt back it up.  Do a back up of your content just to give yourself leave of mind that way you have it if it does get lost.  I changed my account without losing anything.  U should be fine

  • Is there a way to change clip size without losing image quality? Specifically from 568 x 320 to 1920 x 1080?

    Is there a way to change clip size without losing image quality? Specifically, from 568 x 320 to 1920 x 1080?

    No, especially not video files. That's way too much scaling.

  • Need help changing Apple ID without losing info

    I have 3 Iphones linked to the same Apple ID.  2 are mine and 1 is my fathers who is not too saavy with Iphones which is why it's been linked to mine to help him.  He has since upgraded from the 3 to a 4s (like I said, he's behind the times) and was wanting to move his content from one phone to the other.  First off, the Apple 'Genius's' were anything but 'Genius' when it came to helping him.  So he ended up having to ship his phone 3k miles to me to help.  I was able to back up his phone and attempted to create a new Apple ID for his phone.  Then I realized it had changed my phones ID's to the same as the one I made for him.  I have since switched both of my personal phones back to the original ID's, but his phone still has the old/new ID I created for his phone but comes up as not 'verified' since I changed my 2 back to the original ID.  If you're still reading this and I haven't lost you yet then maybe you can help.  My question in a nutshell is how do I give him his own ID without losing the content he has on this phone?  He can't sync from ICloud because it will import all of my info onto his phone as well.  I would really like to get this resolved so I can send him back his phone asap and not worry about further issues if and when he needs to backup or sync his phone to his own account without my info transferring as well.

    All your content is saved to you computer it's self so u shouldn't lose anything.  However, when in doubt back it up.  Do a back up of your content just to give yourself leave of mind that way you have it if it does get lost.  I changed my account without losing anything.  U should be fine

  • [JS, CS2] Find Text - Change Paragraph Style

    I have text supplied to me formated with <g>,< b>,<k> or <r> at the start of paragraphs, this represents different paragraph styles that need to be applied. <br /><br />I started a script below, but it comes up with an error at "app.findTextPreferences.findText" <br /><br />have a used the wrong function here? <br />Is there an easy way for it to run through all of them as well, or should I just repeat this script with < b>,<k> and <r><br /><br />var myDoc = app.activeDocument;<br />var greenBullet = ["<g>", "<g>"]<br />replaceGreen();<br /><br />function replaceGreen() {<br />for (i = 0; i < greenBullet.length; i++) {<br />            var myGreenArray = greenBullet[i];<br />            app.findTextPreferences.findText = myGreenArray[0];<br />            app.changeTextPreferences.changeTo = myGreenArray[1];<br />            app.changeTextPreferences.appliedCharacterStyle=myDoc.characteerStyles.item("OFI Body copy_GREEN BULLET");<br />            myDoc.changeText();<br />            }<br />}

    Thanks Dave!<br /><br />OK, Now I am getting this message when I run it:<br /><br />"A layer with this name already exists...<br />...     if (myPageItems[i]  instanceof TextFrame && myPageItems[i].itemLayer.name = "listings")"<br /><br />So it's trying to create a new layer called listings.<br />Also - it seems to want to move the items to that layer?<br /><br />var myDoc = app.activeDocument;<br />app.findPreferences = null;<br />app.changePreferences = null; <br /><br />myObjectStyle = myDoc.objectStyles.item("defaultText");<br />myPageItems = myDoc.allPageItems;<br />for (var i = myPageItems.length - 1; i >=0; i--) {<br />     if (myPageItems[i]  instanceof TextFrame && myPageItems[i].itemLayer.name = "listings") {<br />          myPageItems[i].applyObjectStyle(myObjectStyle);<br />     }<br />}<br /><br />myDoc.search("<g>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_GREEN BULLET"});<br />myDoc.search("<k>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_BLACK BULLET"});<br />myDoc.search("<r>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_RED BULLET"});<br />myDoc.search("< b>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_BLUE BULLET"});

  • [CS4 JS] Find a paragraph style and get text contents

    Hello,
    I would like to get to contents of text that is applied with a specific paragraph style, so that I can copy it to another text frame
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = "headline";
    // and then get the value/contents of that applied paragraph style
    Sjoerd

    Something like this:
    str = "";
    found = app.activeDocument.findText();
    for (i = 0; i < found.length; i++)
       str += found[i].contents;
    "str" now contains aal text styled with that paragraph, which you can now save in a text file.
    Peter

  • GREP for changing paragraph style?

    Okay folks, I have another one for all you smart people out there. I think GREP can be used to change formatting in the following instance, but I have no idea how to set it up.
    I have a very long document, essentially a phone book-type listing of names, phone numbers, addresses, well over 150 pages' worth. The paragraph styles are fairly simple, only two per listing. The name/phone number is bold with a right hand tab with leader dots to a phone number that is flush to the right side of the column. The following lines are flush left, not bold, but indented 6pts. I've placed the text file and assigned the entire thing the NameListing paragraph style. I'd like to use GREP to find the address lines and change them to the NameListingAddress paragraph style.
    Here's a screen shot to give you an idea. The left column is formatted correctly with both styles, the right column is "raw", all paragraphs formatted with the NameListing paragraph style.
    Is this an appropriate application for GREP? If so, how do I set it up to only change the paragraphs that "don't have tabs"? It would save me a crapload of time.
    THANKS again! --Dina

    If your intent here is to use the character style to trigger a variable, as I belive it is based on your other thread, you MUST apply the character style up to the first tab to pick up the text at the start of the paragraph. There are two approaches to automating the formatting after that, but it may be too late for you to be much help.
    In cases where every listing has the same number of lines it makes sense to use a unique paragraph style name (not necessarily format -- base on on another) for each lline and make it its own paragraph. Set up "next styles" to rotate through the list so each line is assigned the correct style based on the style of its predecessor. You get the rotation to sart over by making the first line style the next style for the last line. This works for manual entry and can be applied to an entire block of placed text in a single operation by selecting the text, then right-clicking the name of the first style to be applied and choose Apply <stylename>, Then Next Style.This ONLY works if you have exactly the same number of paragraphs in each listing.
    The other option is to use forced line breaks instread of paragraphs and use one style for the entire listing. Set a left indent and negative first line indent, create a character style for the part of the first line that you want to appear in your header and apply it Up To ^t^n (that's a little-known trick -- if you enter more than one character in the trigger for a nested style it will activate on the first instance of any of the characters listed that occurs, so for example if you enter the word cat, your style will end on the first, c, a or t that appears inthe paragraph. ^t is the metacharacter for tab, and ^n is for forced line break) so that the style will end at either the tab, if present, or the forced line break if there is no tab (if you use a right-indent tab instead of a regualr right aligned tab [tricky to do a leader, but that's another discussion] substitute ^y for the ^t), then add a nested Line Style for one line. That line style should use a second character style that is based on the first character style you created for the name text and has no other attributes if you want the line to be the same from end to end. Sounds more complex than it is, and will work for listings with variable lenghths. The trick is to repalce your paragraph returns with forced line breaks, and will require a little thinking.
    If using separate paragraph styles for each line, you'd use the same technique of a nested style up to a tab for the first line, but there is no need to get fancier since it will apply to the whole line if there is no tab. The paragraph style, in this case, would carry all of the bold and size formatting (and no need for any indents), and the character style would be nothing more than a name that will allow you to use it in the variable.

  • JS:CS3 Newbie needs help! find/change character styles

    I'm new to scripting and JavaScript is giving me a headache, but I'll keep trying. What I'm trying to do is automate a few things so that the production time of our school newspaper is reduced while insuring accuracy.
    I've played around a little with the text find change sample and the changing or adding paragraph styles in the InDesignCS3_ScriptingGuide_JS.pdf and I barely understand what I'm doing.
    When us page designers receive text to place in the document, our editors mark the text with tags like: < b >text< / b >, where the word "text" is to be bolded. (there wouldn't any spaces between < and b and > etc. I just did that so It'll show up here). We have basic character styles and paragraph styles set up, and we just started working with nested styles.
    Is there a way we can search for the < b > tag and bold everything after it up until the < / b > tag? Sort of the way it does for html (the way it would do for this message if I took out the spaces). It'll be great if it could remove the tags as well, but if not, I know I could create a find/change script to do the removal afterwards.
    I appreciate any input.
    Thanks!

    You've not found yourself the easiest of tasks! You need GREP find/replace, not text. Do you have any experience with GREP? It's worth investigating, it's a powerful feature. The script below handles bold. For clarity, it doesn't do any error checking: it assumes that there's a document with text in it and that the document contains a character style called 'bold'.
    // talk to Indesign, nobody else
    #target indesign
    // reset the Find/Change dialog
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // find everything between <b> and  (including these codes)
    app.findGrepPreferences.findWhat = '<b>.+?</b>';
    // add 'bold' style
    app.changeGrepPreferences.appliedCharacterStyle = 'bold';
    // make the changes
    app.activeDocument.changeGrep();
    // now delete the <b> and </b> codes
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = '</?b>';
    app.changeGrep();
    You can adapt it easily to handle other codes, and at a later stage you could generalise it so that you needn't repeat whole bunches of code.
    Good luck with your first forays. Again, it's not the easiest of tasks, but it's worth getting to grips with.
    Peter

  • Change paragraph style from X to Y in Pages Doc

    Hi
    Sorry for such a simple question, but I have looked through the Applescript manual and searched this forum and can't find a solution to my problem.
    All I want to do is loop through the paragraphs of a Pages document and if the paragraph style is "Body Full", then change it to "Body Half". I have tried if statements repeat statements and everything I can think of but can't seem to get it to work. I can loop through all the paragraphs and change them to "Body Half", but as soon as I try to select only those whose paragraph style = "Body Full" it doesn't change any.
    Here is an example of my attempt:
    tell front document of application "Pages"
    repeat with X from 1 to count (get paragraphs)
    if paragraph style of paragraph X = "Body Full" then
    set paragraph style of paragraph X to "Body Half"
    end if
    end repeat
    end tell
    If anyone could help I would be grateful. It's kind of embarrassing since I was a programmer for many years on mainframes and AS/400. Scripting is a new world to me.
    Thanks in advance.
    Jim

    Hello
    Jim Kahler wrote:
    I am also using iWorks 09. Now the indent level sets all paragraphs to the indent level of wherever the insertion point was when I ran the script.
    ? Still confused, it looks so easy!
    Jim
    Ok, i understand.
    Here is the solution :
    tell front document of application "Pages"
    set sel to selection
    set search_style to paragraph style "Body Full"
    set new_style to paragraph style "Body Half"
    repeat with X from 1 to count paragraphs
    tell paragraph X to if its paragraph style = search_style then
    select character 1
    set Y to indent level
    set its paragraph style to new_style
    set indent level to Y
    end if
    end repeat
    select sel
    end tell

  • CS4 PDF Export: Paragraph Styles to Bookmarks

    Hi,
    Is there a way of mapping bookmarks to paragraph styles for PDF export? I have a hunch there is, but I'm only finding the option to insert bookmarks manually. I want to structure the pdf by heading level for an interactive version
    i.e.,:
    Chapter Title
    -Heading 2
    --Heading 3
    ---Heading 4
    Thanks in advance!

    You must export to Acrobat 5 or higher, and check the boxes inthe export dialog to include the bookmarks, hyperlinks, and interactive content (the second too may no longer be necessary in CS4, but od habits die hard).
    I've had some trouble, and I think others report it too, with including bookmarks from more than one TOC.
    Peter

  • How to change paragraph style

    I have a text frame selected and it contains a story having various pargraph styles applied.
    I want to get name of each paragraph style applied in it and replace each with some other styles.
    But when I am applying style only one style is applied to whole text frame .(i.e all existing styles are replaced with a single style).
    Please help me , if there is any way.
    Thanks

    It was not a criticism of your design choices. You have misread my comments, I am simply warning you from long experience. We have no idea of what you do or don't know, most people who come here have little and it is safer to assume they have none.
    Creating a Textbox, which is randomly sized and placed and contains no text, is not dissimilar to having a Textbox already in the document with Placeholder text in it that you click on and it is replaced by whatever you type. If your client is quite familiar with Pages they must be familiar with using Placeholders and with duplicating and resizing objects as required. It is just a way of getting around your problem.
    Obviously you have done something else, or you would not be getting the results you have. I keep my version of Pages 5.5.3 as installed for testing, I don't know what you have done that is different and can't tell without having the file.
    If you want me to look, email me via my blue name. If not, that's fine too.
    Peter

  • Finder changes Icon List without asking

    Strange behaviour on my new SL mac.
    If I change the Icon List in a folder to, say, Cover Flow, the finder (sometimes?) changes other (all?) folders to Cover Flow. And vice versa etc.
    Obviously I don't want that.
    Is this something I can switch off, or a bug?
    Thanks
    Tom
    PS Another thing that came in with OS9 I think. When you duplicate a file (Apple D) it makes a copy then leaves the cursor in the original label. In the old days it left the cursor in the COPY file - which meant you could change the name without having to reselect. Much better. Is there any way to go back to the old system? (It's been annoying me for years).

    If I change the Icon List in a folder to, say, Cover Flow, the finder (sometimes?)
    changes other (all?) folders to Cover Flow.
    I see the same thing in Snow Leopard, and after some earlier experimenting my own take on this is as follows. I'm not sure it is all correct:
    My understanding is that despite the wording, the View Option setting for "Use as Defaults" was not intended to be interpreted as "Other folders (or even just 'all new folders') will now open in the same view as this one." Rather "Use as Defaults" means "IF a future folder is displayed in the same view as this one, THEN that view will have the same internal parameters as this window does."
    For example, if the current folder window is in List view and you use View Options to change the Text Size from 12 to 14 and then click "Use as Defaults", then IF a future folder is opened in List view, THEN it will also display with Text size 14. If the current folder window is in Icon View and you change the icon size from 64x64 to 108x108 and click "Use as Defaults" then IF a future folder is opened in icon view, THEN it will also display 108x108 icons.
    But clicking "Use as Defaults" doesn't affect WHETHER a future folder will open in a particular view when double-clicked. *The global default for that is simply the last view that was used for a prior folder*, with the exception of particular folders which had been individually set to "always open in xxx view".
    So for example, I just created and opened a new folder on my Desktop, set it to List view, used command-J and altered its parameters somewhat, clicked "Use as Defaults, and closed the folder window. I then created a second new folder, and it opened in List view, as expected. I then set this second folder window to Icon view, and closed it without doing anything else. *I then re-opened the first folder, and it opened in Icon view*, without regard to the "Default" that had been previously set while it was in List view. I then created a 3rd new folder, and it also opened in Icon view, again the "last view used for the prior folder" not the "Use as Defaults" that had earlier been set for the first folder's List view.
    The View Option wording "Always open in xxx view" is also somewhat ambiguous - it actually means "always open THIS folder" in xxx view, not "always open ALL folders " in xxx view. Checking this box will not in itself affect the behavior of any other folder, whether or not that folder has been previously opened. The global default for opening another folder will continue to be the view that was used for the prior folder, and this default can be again be individually overridden for a particular folder by checking that folder's box for "Always open in xxx view."

  • What is the function to change paragraph styles?

    I'm trying to make a simple script that changes a raw data file that has preset Paragraph style already in the exported data from a HTML calender, and once its copied over into Indesign it changes the already existing paragraph style into a diffrent paragrph style?
    is this a simple script, I got no idea what the script function is to make the change of paragraphs.

    Would this work? or do I got the wrong function commands?
    var myInDesign = app
    var myDocument = app.activeDocument
    var myDocName = myDocument.name
    app.findParagraphStyle.caseSensitive = false;
    app.findParagraphStyle.wholeWord = false;
    app.findCharacterStyle.wholeWord = false;
    app.findCharacterStyle.caseSensitive = false;
    app.findParagraphStyle.findWhat = "SN.outabout.DAY-Gray";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Day_of_the_week";
    app.documents.item(0).changeParagraphStyle();
    app.findParagraphStyle.findWhat = "SN.outabout.DATE";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Month_and_Day";
    app.documents.item(0).changeParagraphStyle();
    app.findParagraphStyle.findWhat = "SN.listingsLT";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Paragraph";
    app.documents.item(0).changeParagraphStyle();
    app.findCharacterStyle.findWhat = "SN.listingsBOLD";
    app.changeCharacterStyle.changeTo = "SN.Holiday-Title_Paragraph";
    app.documents.item(0).changeCharacterStyle();
    //myInCopy = CreateObject("InCopy.Application.CS3")  //Not sure if this would work, just crafting idea's.
    //var myDocument = myInCopy.ActiveDocument
    //var mySelection = myInCopy.Selection.Item(1)
    //var myStory = MySelection.ParentStory
    //var myText = myStory.Paragraphs.Item(1)
    //myStory.CheckOut
    //myText.ApplyParagraphStyle myDocument.ParagraphStyles.Item("zAPPROVED"), True
    //myStory.CheckIn
    Can I just do this with like a Nested If, then Statement?

Maybe you are looking for

  • How can I get a fullscreen version of my iMovie to play for friends?

    I have uploaded my 8 minute iMovie 08 to my .mac site. When I send the link to friends, they see the movie play in a very small window. It also is fuzzy and unfocused. How can I get a fullscreen version of my iMovie to play for friends? Also the volu

  • How to create hierarchies in Bex queries?

    Hi All, I am new to query designer tool, can you please help me how to create hierarchies in Bex queries using query designer tool? Thanks in advance...

  • Synchronizing calendar with Yahoo

    In the older version of the Desktop Manager software, one of the options offered for synchronizing my Blackberry with my computer was Yahoo.  With the new version of Desktop Manager (5.0.1) this option does not appear.  Is this no longer available? 

  • Can I use Numbers templates like template wizard in Office 98?

    I own apartment houses. With Office 98 I made a rent receipt template and linked it to the database with template wizard, end result I would bring up the template, fill in date, amount, apt # ect. Then I would print the receipt and give it to the ten

  • Recovering RAID1 after non RAID boot

    The system was setup to use 2 sata disks in raid-1 (mirror) configuration with Windows XP (SP1). Because of some other issues I did a bios update and forgot to activate raid in bios.... Windows XP booted up ok, propably doing some automatic driver up