Script to Change Paragraph Numbering

Hi.
I am really new to scripting (please don't hurt yourself laughing at my code below )  and need some help!
The issue: The documents I author go through a translation process which takes the InDesign XML data and exports my text into a web browser tool so it can be translated. After it has been translated, the text is placed back into my document with the formatting and paragraph styles that it had when I exported it. That created a problem with Figure and Table captions as those paragraph styles have "Figure" and "Table" hardcoded into the paragraph style.
Possible Solution: On page one of each document that is generated, I list the language of that document (for example "Russian"). I think I need to write a script that goes looks at the first page and if it has a language listed (in this case "Russian") then it replaces the paragraph numbering text with a defined text ("Рисуноk" is "Figure" in Russian).
if ((app.documents.length != 0) && (app.selection.length != 0)) {
  myDoc = app.activeDocument;
  myStyles = myDoc.paragraphStyles;
  myStringList = myStyles.everyItem().name;
// What im trying to do below: If page 1 contains text “Russian” then Change the “Figure Title” paragraph numbering style to “Рисунок ^#.” I am missing the page 1 text find function.
var myPara = appliedParagraphfstyle;
myPara.numberingStartAt: Рисунок ^#.
I’m so lost!!!! Help! Screenshots below to show what im trying to achive. Thank you so much!

Hmm, I think what you're after is "numbering expression" rather than "start at."
"Start at" is the actual number it's going to assign, to either continue from the previous number or if you're hard-coding to always start at 1, for example.
The expression is the form it'll take, with wording and spacing you're using as your format for these labels. In AppleScript, it'd be:
set numbering expression of paragraph style "Figure Title" to "Рисунок ^#. "
I don't know Javascript, but there must be something similar in the JS scripting guide.
Hope that helps!
Mary

Similar Messages

  • Is there a script to change paragraph style based on even/odd page

    Is there a script or way to have paragraph style change between 2 styles based on the text being on an even or odd page? 

    @JustMikey – as I understand your task, the problem has nothing to do with "special" paragraph styles, but (nearly) all with anchored objects (the images and parts of the gray bar) and appropriate margin settings.
    Just see the following IDML file I exported from InDesign CS5.5:
    Dropbox - ImagesAwayFromSpine-CS5.5.zip
    ImagesAwayFromSpine-CS5.5.zip
         ImagesAwayFromSpine-CS5.5.idml
         080731_Manchester-xxl_Grau.tif
    Of course you could add paragraph styles to format the data automatically or optimize in other ways.
    That's up to you. But you can see the principle:
    Inspect the Anchored Object Options for the image and the gray bar. Also the frame fitting options for the image.
    Note: See also the margin settings, that are not exactly mirrored on even and odd pages (for good reason).
    Uwe

  • [JS, CS3] a script to change language in all paragraph styles

    Hi,
    I made a script to change the language in all paragraph styles to "French", but when I run it I get the error: "Invalid request on root style". Could you please tell me what am I missing?
    myDoc = app.activeDocument;
    myStyles = myDoc.paragraphStyles;
    for (i = 0; i < myStyles.length; i++)
    myStyle = myStyles[i];
    myStyle.appliedLanguage = "French";

    Thanks a lot!
    The problem is solved
    Ola

  • Script to change numbers all at once...

    Hi,
    I work with technical drawings...90% of my time is changing the numbers on the drawing.   I take the PDF that was created in UG/NX and then open that in Illustrator to make formatting changes, and number changes. 
    What I would love, is to have a script that will let me take an excel file, text file (something)  the file would list the current numbers and list the new numbers, and have the illustrator script switch all the numbers at once.
    I know there is the find and replace but that takes too long, and I have to worry about if I'm changing 2 to 5, that it's not going to change 20 to 50. Even with the script that would be a concern.
    Is what I want even doable with a script,  and do you have any suggestions on how to get started?  I have someone who can help me with the code, just want to see if it's even possible.
    Sample list would look something like,
    Old number, New Number
    1, 5
    2, 6
    3, 7
    4, 8
    5, 9
    6, 10
    7, 11
    8, 12
    9, 13
    10,
    11, 14
    12, 15
    13, 16
    15,
    16, 17
    Numbers can go into the 400's
    TIA
    Karleen

    thanks for answering me.
    One number is never replaced by two different numbers. 
    How would I get started working on the code?  VB, Java?   Any tips or suggestions would be great.  
    Thanks!

  • When reflow text; How to change paragraph automatically when changing frame

    Hi
    Im new to indesign scripts, but thought that this maybe was the right forum to ask the following question. (Im using Adobe Indesign CS.5 )
    Im currently trying to import a file (word file / excel both is possible) into an indesign book and formatting the text automatically!
    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    I have already figured out how to reflow the text, and actually also managed to relow text into the frames and change paragraph style. I know how to use the keep option, and by this change the paragraph style when e.g. changing frame break/page break etc.  (but if the content being flowed-in is not tagged with style names then I cannot figure out how to do it)
    The document and its content I whish to import do not have any tagged paragraphs!
    If any of you have a hint, I would be more than happy to hear from you

    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    This question is not gramatically correct and I cannot understand what you are trying to ask.

  • [JS,CS3,CS4] Converting Paragraph numbering to text

    I'm trying to add line numbers by applying paragraph numbering to selected text (which I call "myText"), then converting numbers to text (then later I'll use GREP to remove the period and shift them to the right).
    I'm new to scripting, and wonder why the following doesn't work:
    myText.bulletsAndNumberingListType=1280601709;
    myText.convertBulletsAndNumberingToText();
    The first line seems to add the numbering as I'd like, but the second line just makes them disappear again!
    Thanks for any help you can give -- Jeremy

    I just had a similar problem.
    I have no idea whether my solution works in CS3.
    ( function() {
         var doc = app.activeDocument;
         // the image page item
         var r = doc.rectangles.item(0);
         // the destination textframe to hold the inline
         var tf = doc.textFrames.item(0);
         // it should already be tagged.
         // create a nested, blank tag
         var xe = tf.associatedXMLElement.xmlElements.add("bla");
         // copy the rect as inline
         xe.placeIntoInlineCopy(r,true);
    Dirk

  • 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?

  • Restart paragraph numbering each spread

    How do I restart paragraph numbering after each spread?
    I'm working on a catalog where the items in a spread are marked with a letter, and the images of those items are marked with the same letter.  This way the reader can see which image belongs with which listing.  For example:
    A: Widget
    This is a nifty widget!
    418.701A   $5.99
    (anchored image of a widget)
    A
    B: Thingamajig
    Try our new thingamajig.  It's fantastic!
    105.209X   $1,039.49
    (anchored image of a thingamajig)
    B
    If paragraph numbering doesn't restart at all, the numbers get far too high, as we have thousands of listings in the catalog.  If numbering restarts after every higher-level section, we could have two paragraphs on the same spread with the same number, as sections can change within a spread.

    Just to clarify, would you sometimes have A and B on one page, and A and B on the next consecutive page, but during the layout process, item A from the second page may be moved back, and need to become C on the first page, or possibly B from the first page is deleted and A from the following page moves back to become B? Is that what you're up against, and you want it to be automatic? I'm not sure I have a solution just now, but I want to be sure I understand you.

  • Is it possible to script language change in OSX Lion ?

    I recently purchased a Disney game (Cars 2) from the App Store, which advertises being available in 5 languages. It seems now that the game has no in-app options to change language, but selects the language based on OSX settings (but otherwise the app doesn't use ANY of the GUI elements from the OS).
    My Mac's are all set up in English, in the account on which my kid plays the game doesn't have administrator rights (for good reasons). He doesn't master the English language enough and would like to play the game in dutch. On the other hand, when using Safari and other apps, he is used to the English user interface.
    Is it possible to create a script that changes the Finder language to Dutch, then forces Finder Quit, then launches the App, and after quitting the App reverses the Finder Change ? (or if not in one step, maybe in a number of subscripts), so that I can let my kid enjoy his game in dutch without me having to be present each time to change the system settings ?
    Thanks in advance.
    Philip

    Tom, thanks, this works perfectly. In older days, I have been a programmer on Mac (long before even the PowerMac days), and back then I would have used ResEdit to do something similar as what you suggested. Since those days are long gone, I was not sure if it was possible to change the resources of an app without extensive coding software, but the trick you just showed me seems to be the current-day equivalent of ResEdit ...
    Anyways, you saved our day ... thanks alot
    Philip

  • Powershell Script to change the default user Account picture for all users in windows 7 and 8

    Hello,
    Can some sone help me with PS script to change user account pictures of all user account in windows 7 and windows 8 ?
    I will deploy this through MDT TS as Custom TS after OSD.
    Shailendra
    Shailendra Dev

    Hello,
    Can some sone help me with PS script to change user account pictures of all user account in windows 7 and windows 8 ?
    I will deploy this through MDT TS as Custom TS after OSD.
    Shailendra
    Shailendra Dev
    The default user account picture is stored here.
    C:\programdata\Microsoft\User Account Pictures\user.bmp
    It should just be a matter have copying the picture you want to that location and over writing what is there.
    or....
    Computer Configuration\Administrative Templates\Control Panel\User Accounts\Apply the default user logon picture to all users
    You can also configure this by a registry setting;
     [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]
      UseDefaultTile = 1
    The picture that you configure, will not be loaded until the user account will actually be created on the pc. Meaning the first time a >new< user will log on to a pc, they will have no picture shown at all using their login screen (this is default
    behavior). Same will occur if you enable the policy don't display last user name. However, once they log in the picture will be shown in the start menu, and if they lock their pc the image will also be shown

  • Figure numbering AND paragraph numbering in the same document

    Hi everyone,
    I have a document with both figure numbering and paragraph numbering. So let say I am in section 4, then the first paragraph would be "4.1. Introduction" and the first picture would be "Figure 4.1: Cool pics".
    I created two different lists, one for the figure and another one for the text so that figure numbers and paragraph number don't conflict. However I cannot add the section number in the figure numbering since it's on the other list... I tried to have the figure numbering and paragraph numbering in the same list, but then the numbers conflict (e.g it gives 4.1 Introduction and Figure 4.2: Cool pics).
    Can anyone help me, doing what I want (which is "4.1. Introduction" and "Figure 4.1: Cool pics")? Any help would be appreciated.
    Thanks!
    ps: I am using Indesign CS5.5 on a pc

    Thanks for your answer Jump_Over, but my project is already divided into chapters (themselves divided in sections) in a book.
    I found a way around by having the figure numbering in the same list as the paragraph numbering, the twist : while I use level 1 to 4 in paragraph numbering, I use level 5 for figure numbering with a numbering definition like ^1.^#, so no more conflict between numbers.
    It's working fine so far...

  • Changing/Adding Numbers to the Network/Dial-Up Connection Thing-a-ma-bob...

    I would like to do this:
    *Put these numbers in Network>TCP/IP>DNS Servers...*
    208.67.222.222
    208.67.220.220
    But I am scared to death to try. I get connected without a hitch now, and I do NOT want to disturb that!!! I don't know what I am doing with this, but if it will improve the speed and stability of my dial-up connection so I can successfully download and install my updates, I will risk it.
    How much chance do I have of messing my connect-ability up altogether?
    And how do I go about doing it properly?
    Cyan

    99.999999% safe and easy to undo, but to make it even nearer 100%...
    In the Network Pref Pane, choose the Location drop down, choose Edit Locations, then choose Duplicate... now you have one you can paste those numbers into, and just switch Locations back if need be without changing any numbers.
    It's safe though anyway really.:-)

  • Just setting up iCloud on my iMac, my problem is when trying to sign out/off from iCloud it comes up with a verification code that is being sent to my land line, I'd changed the numbers in my Apple ID and they show as changed but the land line number stil

    Just setting up iCloud on my iMac 10.9.2, my problem is when trying to sign out/off from iCloud it comes up with a verification code that is being sent to my land line, I'd changed the numbers in my Apple ID and they show as changed but the land line number still shows as number that the verification code is being sent, I prompt "Don't have access to this phone" and that's no help at all.  The only way I can sign out /off from iCloud is to uncheck everything that I wanted to keep in the cloud????
    Thanks in advance for any help.

    Skip the iCloud sign in for now.
    Once you reach the home page, go to settings and sign out of FaceTime and Messages.  This should also sign you out of iCloud.
    Go to iCloud in settings and sign in with the correct Apple ID.
    If that does not work
    Skip the iCloud sign in
    Go to Apple ID.apple.com and sign in
    Change your Apple ID to the old one
    Delete iCloud account on your device with the old Apple ID and the same password.
    Go back to the website, change your Apple ID back to the current one. You will receive an email to verify the account. Verify first.
    Sign into iCloud on your device with the correct Apple ID and password

  • How to change the numbers of items in a ring control in run time ?

    Hi !
    I would like change the numbers of items in a ring control in run time, but I can´t.
    Thanks.

    Hello blaze,
    did you try the "Strings And Values []" property of the ring?
    LabView7.1 help says:
    Array of clusters containing the strings from which you can select in the ring control
    and the numeric values for each item. Use the Strings [] property if you do not need to
    assign specific numeric values to each item.
    Best regards,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Powershell script to change the a column value of all documents in a site.

    Hi,
    I need a powershell script to change the value of a column (a site column which has been added to all document libraries) in all documents in a site,
    For example: 
    -column 1 is a site column added to all libraries
    the value of column 1 of all documents under this site: http://intranet.doman/ex1 should be equal to V1
    the value of column 1 of all documents under this site: http://intranet.doman/ex2 should be equal to V2
    So, if I can write a powershell script to change the value of all documents in a site, I can modify it for different site that I have and run it for each of them individually,

    cls
    # Is dev version?
    $dev = $false
    # Configuration
    $termStore = "Managed Metadata Service"
    $group = "G1"
    $subjectMatterTermSetName = "Subject Matter"
    # Check if SharePoint Snapin is loaded
    if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
         Add-PSSnapin Microsoft.SharePoint.PowerShell
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") | Out-Null
    function GetTermStore($site, $termStore, $group, $termSet) {    
        $session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
        $termStore = $session.TermStores[$termStore]
        $group = $termStore.Groups[$group]
        $termSet = $group.TermSets[$termSet]
        return $termSet
    if($dev) {
        Write-Host "Running DEV version..."
        $webUrl = "http://Site1"   
        $libraryName = "L1"
        $subjectMatter = "C1"
    } else {
        $webUrl = Read-Host "Enter Site URL" 
        $libraryName = Read-Host "Enter Document Library name"
    $subjectMatter = Read-Host "Enter Subject Matter"
    try {
        $web = Get-SPWeb $webUrl
        $site = $web.Site
        $library = $web.Lists[$libraryName]
        $items = $library.GetItems()
        $subjectMatterTermSet = GetTermStore $site $termStore $group $subjectMatterTermSetName
        $subjectMatterTerm = $subjectMatterTermSet.GetTerms($subjectMatter,$true) | select -First 1
        foreach($item in $items) {
            if([string]::IsNullOrEmpty($item["Subject Matter"])) {     
                #Write-Host "Filename: $filename / Keywords: $keywords / Subject Matter: $subjectMatter / Document Type: $documentType"        
                Write-Host "Updating $($item["ows_FileLeafRef"])..."           
                # Set Subject Matter column
                $subjectMatterField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$item.Fields["Subject Matter"]
                $subjectMatterField.SetFieldValue($item,$subjectMatterTerm)
                # Update Item
                $item.SystemUpdate()
    catch
        $ErrorMessage = $_.Exception.Message
        Write-Host "Something went wrong. Error: $ErrorMessage" -ForegroundColor Red

Maybe you are looking for

  • Help needed in calling a Web service

    Hi, I want to call a web service from my component. The called web service might have different names, therefore I don't want to use the proxy class way. I am facing problem in parsing the input parameters from the wsdl file. I have attached the wsdl

  • Recurring battery issue in x6

    My x6 ran fine for about 6-7 months, when suddenly I found one day, the battery life decreasing at an alarming rate. After trying many things, I finally fomatted(hard reset ) the phone using *#7370# & reinstalled all my apps. Battery life got back to

  • Re : Lion freeing up Hard Disk Space automatically

    Hey, I know this will sound strange but ive been noticing my Har Disk space automatically going up. It was 80 GB yesterday, this morning it was 120 GB and now its 152 GB !! I havent deleted anything and i have no idea what files are being deleted ! i

  • How do I back up file on external Portable Hard drive

    I recently dropped my laptop on the floor doing damage to the screen. I took it to Apple store and they were able to back my hard drive onto an external hard drive. It has been a couple weeks since then and I would like to update all the files since

  • 2 days of ****...Ipod 20GB not responding to my Imac G5 or Ibook G4

    Ok..so I have spent maybe 30 hours now trying to solve this problem. The dreaded Ipod Updater has basically put my 2nd Gen 20gb into the following a)disk mode-do not disconnect b)disk mode-ok to disconnect or c)apple logo then the exclamation and fol