Create the directory - County list showing on all Pages of the book

Hi to all the InDesign scripting

I am trying to create a directory with InDesign CS6, that contains the name of the person, addresses, cities, etc.

I have a question which is to show the number of entry per city,

for example, there are 30 names under a city (in front of spreads and pages),

How to automatically display the number of registration County about InDesign?

And how InDesign find what kinds of use on this page?

(If I have two pages should show total registration under the same city is 30)

I found a script to add # sequential to paragraph styles, but I couldn't pick up the latest issue on the page by using the variable text - function headers running in InDesign, not the last issue under the same city.

Any help would be appreciated!

Best regards

V

Advertisement

Hi UFV

Assuming that you need to do one city at the maximum per page and use you a single paragraph for your titles in the city style and assuming that use you a paragraph for your entries to name style then the following should do it.

Trevor

// City Listings Count Script by Trevor www.creative-scripts.com (Coming soonish)
// Trevor {at} creative-scripts {dot} com
// http://forums.adobe.com/message/5837823#5837823

app.doScript("addListingsCount()", ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Add Listings Count");

function addListingsCount () {
    var  doc = app.activeDocument,
            cityParagraphStyle = doc.paragraphStyles.itemByName ("City Title"), // Change to correct paragraphStyles name
            nameParagraphStyle = doc.paragraphStyles.itemByName ("Entry Name"), // Change to correct paragraphStyles name
            countParagraphStyle = doc.paragraphStyles.itemByName ("Entries Count"), // Change to correct paragraphStyles name
            cityFinds = [],
            entryFinds = {};

    // Get GeometricBound for Title Text Frames
    var   pageMargins = [], pageGeos = [], textFrameGeos = [],
             vp = doc.viewPreferences.verticalMeasurementUnits,
             distanceFromTopMarginToTheTopOfTheEntriesCountTextFrame = UnitValue (".8cm").as(vp);  // Change distance as needed
             heigtOfTheEntriesCountTextFrame = UnitValue (".5cm").as(vp);  // Change height as needed
    pageMargins[0] = doc.pages[0].marginPreferences;
    pageGeos[0] = doc.pages[0].bounds;
    textFrameGeos[0] = pageGeos[0];
    textFrameGeos[0][0] += pageMargins[0].top - distanceFromTopMarginToTheTopOfTheEntriesCountTextFrame;
    textFrameGeos[0][1] += pageMargins[0].left;
    textFrameGeos[0][2] = textFrameGeos[0][0] + heigtOfTheEntriesCountTextFrame;
    textFrameGeos[0][3] -= pageMargins[0].right;

    pageMargins[1] = doc.pages[1].marginPreferences;
    pageGeos[1] = doc.pages[1].bounds;
    textFrameGeos[1] = pageGeos[1];
    textFrameGeos[1][0] += pageMargins[1].top - distanceFromTopMarginToTheTopOfTheEntriesCountTextFrame;
    textFrameGeos[1][1] += pageMargins[1].left;
    textFrameGeos[1][2] = textFrameGeos[1][0] + heigtOfTheEntriesCountTextFrame;
    textFrameGeos[1][3] -= pageMargins[1].right;

    app.changeTextPreferences = app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = cityParagraphStyle;
    cityFinds = doc.findText();
    app.findTextPreferences.appliedParagraphStyle = nameParagraphStyle;

    var l = cityFinds.length,
          c = 0, nameFinds, pageOffsets = [], pageOffset, fl, city;

    while (c < l) {
        pageOffset = cityFinds[c].parentTextFrames[0].parentPage.documentOffset;
        nameFinds = ([]).concat.apply ([],doc.pages [pageOffset].textFrames.everyItem().findText ());

        city = cityFinds[c].contents;
        fl = nameFinds.length;
        pageOffsets [c] = pageOffset;
        entryFinds [city] = (entryFinds [city]) ? entryFinds [city] + fl : fl;
        c++
        }

    while (l--) doc.pages[pageOffsets[l]]
                          .textFrames.add ({
                               geometricBounds: textFrameGeos [pageOffsets[l] % 2],
                               contents: "Total Listings: " + entryFinds [cityFinds[l].contents],
                               name: "Listings Count"
                               });
    doc.pages.everyItem().textFrames.itemByName ("Listings Count").texts[0].appliedParagraphStyle = countParagraphStyle;
}

// Note if you ever want to remove these text frame you can do
// app.activeDocument.pages.everyItem().textFrames.itemByName ("Listings Count").remove()

Tags: InDesign

Similar Questions

  • HOW TO CREATE A DROP-DOWN LIST ON A WEB PAGE LIST?

    I would like help on how to create a drop-down list on a web page.

    I know that its pretty basic, but I'm only a beginner!

    See you soon

    Dan

    http://CSS-tricks.com/2282-simple-jQuery-DropDowns/

    http://coding.smashingmagazine.com/2011/06/16/five-useful-interactive-CSS-jQuery-technique s-deconstruted / # mega - drop-down list

    http://vandelaydesign.com/blog/Web-development/jQuery-drop-down-menus/

  • How can I create a class to be used on all pages? CS6

    IM using Dreamweaver CS6 to create a mobile application. I have a lot of pages, but I need to keep change the stylesheet and include #pageid .class over and over again. Is it possible to do so as the class works on all pages. Thank you.question.jpg

    I apologize for my terrible wording, but I discovered that I had to drag my style sheet in the stylesheet that dreamweaver will automatically use to crush it. Thanks in any case.

  • How to create the book of the child at the time of the creation of master file.

    Hello

    I have MasterVO and ChildVO. And the association between the two are 1 to *. I have a requirement like, I need to create the line in ChildVO at the time of the creation of line MasterVO.

    I used the association based on the entities to create the link. This link to view created accessor ChildVO in MasterRowImpl as type RowIterator.

    Actually my idea is to substitute create method in MasterVORowImpl and call ChildVO ViewObject and call the method. createRow() on it. But I don't have access to ViewObject, instead it gave access to the RowIterator.

    Could you please provide any pointer to reach above feature?

    Thanks in advance.

    Jdev version - 11.1.1.7.0

    Kind regards

    Dietsch.

    You can use the line iterator to create new toys of the child vo.

    Check the doc http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/RowIterator.html and you will find the createRow and insertRow methods in this interface. The framework has created the straight for you.

    Timo

  • Book Module - I spent 3 days trying to edit the book that I am doing. None of the changes are never saved even after I go to the preview area and create the book. UHVVHQWLHV save changes to my editing?

    I tried to edit my book and worked three days to try to save the changes. Whenever I leave the LR program and come back, my changes will remain. The Adobe instructions say to save the book by clicking on the preview, then dialog box Create Book, then name the book and click on create. Whenever I do that I have a new name in the Panel on the left for photos with nothing in it. I'm frustrated... Please help. I don't know that I'm doing something stupid.

    I'm having the same problem and I am so frustrated that I'm about to go to one of the web services to create my book!  Help!

  • How can I create dependent drop-down list. ?

    Hello

    How can I create dependent drop-down list in my custom page.

    JAG

    Hello

    See my prev thred:

    Re: List of choices dependence relative to a framework for Oracle Page

    Concerning
    Meher Irk

  • I can't find the FF in 10 Windows anywhere... I downloaded, refreshed, etc... but no visible icon on the desktop, the icon taskbar, dosen't show at "all apps".

    I can't find the FF in 10 Windows anywhere... I downloaded, refreshed, etc... but no visible icon on the desktop, the icon taskbar, dosen't show at "all apps".

    See if there is a Mozilla Firefox directory in C:\Program Files (x 86). If so and there are files in this directory, you should be able to reinstall Firefox without losing your preferences.

    Also, you should be able to run it by typing "Firefox" at a DOS command prompt. If it is running, then just create icons yourself.

  • KB2628259 doesn't install, cannot create the directory or file. Anyone know of a solution?

    KB2628259 doesn't install, cannot create the directory or file. Anyone know of a solution?

    Hi dakota25,

    ·         Did you do changes on the computer before the show?

    ·         You are able to install other updates successfully?

    ·         You get the error message?

    Follow these methods.

    Method 1: Temporarily disable the security software.

    Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.

    Method 2: Put the computer in a clean boot state to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click on restart to restart the computer.

    Method 3: You can also manually install updates (KB number) by downloading from the Microsoft Download Center.

    http://www.Microsoft.com/downloads/en/default.aspx

    Method 4: Follow the steps in the article.

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    You cannot install some programs or updates

    http://support.Microsoft.com/kb/822798

  • 5 error message when you try to run gimp - 2.18.16 - Setup could not create the directory

    5 error message when you try to run setup.exe gimp - 2.18.16 after downloading... it reads:
    Setup could not create the directory
    c:\Users\DEBSWO~1\AppDate\Local\Temp\is-IKDP5.tmp ".
    Error5: Access denied
    In the Temp folder under Security I have:
    'SYSTEM' with full control
    "Administrators" with full control
    "Username" with full control
    All of which is listed in the permissions, but the box for'Include the permissions that can be inherited from the parent to this object "below is checked but not really dim so that you cannot check or uncheck the box?"
    The two latest downloads gave the same error message.

    Thank you for your time.
    Debbie

    I suggest you do this:

    1. click on the start planet.
    2. type cmd.exe in the search box.
    3. press on Ctrl + Shift + Enter
    4. click on "run as Administrator".
    5. type the following commands exactly and press ENTER after each:
    takeown /f "%Temp%" / r

    Cacls "%Temp%" / t/c/g "%nom user %": F System: F

    (Enter Y when you are prompted "Are you sure?")

  • Show/hide all the extension of the links at the opening of the subjects outside the normal display

    Does anyone know how to create a button or link that shows or hides all growing links in menu drop-down lists in a section of WebHelp, when the topic is open * outside * of the traditional view? I know that Peter Grainge has a solution for this on his site, but it assumes that the normal display is used, which is probably true for almost all users of RoboHelp. We, however, open outside this view help topics, I am looking for a solution that does not require a button in the skin.

    I watch the toggle.js Javascript file provided on the website of Peter Grainge, but I didn't know how to change the lines that assume the presence of a bsscright frame.

    Thank you

    Tammy

    Hello

    The problem is that there is a 'show' in whtopic.js function which is in conflict with the variable in the script. Rename the variable 'show' and all occurrences of something like "isshown" to fix the script.

    Take a bow

    Willam

  • I want to WRITE to open the list, personal address book, not all e-mail address books. How can I fix this?

    I want the book "Home address" to come when I go to "write". It has been like that. Now I get "All addresses" and need to change to 'personal book. I tried selecting 'Personal', then send me an email. Does not work. Next time I click on write, place the 'Addresses' book returns.

    The new "address book all the ' that you correctly identify occupies the site higher in the list.
    Currently there is no way to set a default value, because there has never been anyone want one so far.
    The developers are working on creating such a preference and it comes out when it's ready.

  • Domain Services Active Directory could not create the ntds object due to dns settings look for failure on the specific domain controller

    Forest consist of 1 DC server 2003 with all fsmo and 2000 1 domain controller roles.

    Completed all questions of adprep and when I tried to promote server 2008 standard edition to a domain controller, had the error message stating that Active Directory could not create the NTDS settings for the domain active directory CN = NTDS controller

    Settings, cn is 2k8dc1, cn = servers, cn = Default First Site Name, c is Sites, cn = Configuration, dc is Marie-France, dc = com on the ad distance dc server2.amanua.com.

    To ensure that the provided network credentials have sufficient permissions

    "The DSA operation unable to act because of the failure of the dns lookup"

    The idea was to demote the 2000 machine when I completed the installation of 2008.

    Hello

    You can display the query in the link provided to improve assistance:
    http://social.technet.Microsoft.com/forums/en/categories/

  • "Extract all...". "request password on some files inside the zip, but no password was used to create the zip file

    I created a zip of a directory tree file using "send to...". "'Compressed (zipped) folder '. When I try to "extract all...". ", he asks me a password for some (not all) of the files in the zip file. I does not have a password for the zip file. I didn't even know it was possible to have a password on a specific file in a zip! Needless to say, I can not give the password because I don't know what it is.

    I tried the following:

    (1) created with "send to...". "Excerpt from" compressed (zipped) folder ', with 'extract all... '. ». Result: request password.
    (2) created with "send to...". "" Compressed (zipped) folder ", extract with 7 - zip. Result: No password query. All the files extracted intact.
    (3) created with 7 - zip, extract with "extract all...". ». Result: request password.
    (4) created with 7-zip, extract with 7 - zip. Result: No password query. All the files extracted intact.

    What I find most interesting is (3).

    Does anyone have an idea of what's going on? Is there some kind of security on the files meta-data that could / should cause this behavior?

    System information:

    XP Pro 2002 SP3 on MS network (I have no idea what server, etc..)

    Hi ruborg,

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the forum TechNet for assistance:

    http://social.technet.Microsoft.com/forums/en/itproxpsp/threads

    Hope the helps of information.

  • Error message: cannot copy... Failed to create the directory or file.

    I get the Error Message ' cannot copy (a file USB Store n Go): failed to create the directory or file.»  All of a sudden I started getting error message is when I tried to copy to the USB mass storage: "F:" copy on the removable key worked for a proor very long in this message. And there are a lot of empty space.  The diagnosis says that everything works correctly.

    Dear Clarence

    Try first to unplug the mass storage device, then reconnect and format it by Righ click on Format.

    Then try to paste these files on this USB key again.

    If it fails this time then format your USB using HP USB stick formatting to http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?swItem=MTX-UNITY-I23839 tool

    Click Download on the page above. Install it and run it. This will guide you through the steps of formatting your USB drive in a few seconds...

    It is also useful for the repair of the almost dead usb keys.

    Concerning

    Zeeshan Ahmad

  • Error 5: Access is denied: failed to create the installation directory...

    I am installing an "Advanced System Care" program I get an error message, Setup failed to create the directory 'C:\users\arthur\appdata\local\temp\is-rukl.temp '.

    error 5 access is denied

    I realized today that I think I got this error on several things, I tried to install recently.  I thought it was a problem with the actual program installer.

    I have no idea where to start even.  Thanks for any help you can give me

    The problem is with the security permissions on the temp of your profile folder. To correct it access %Temp% or C:\Users\[Username]\AppData\Local and right click the Temp folder and choose Properties, then click the Security tab, and click Advanced.

    On the permissions tab, you should see the permissions that are there. There are 3 that are:

    'SYSTEM' with a total control that applies to "this folder, subfolders and files.

    "Administrators" with full control that applies to "this folder, subfolders and files.

    "Your username" in the full control that applies to "this folder, subfolders and files.

    and all 3 must be inherited from the folder C:\Users\[Username]\.

    If you have the option "Include the permissions that can be inherited from the parent to this object" checked, then check it and click on continue if there are problems, then remove the permissions that are not inherited.

    Once you click on 'Apply' and click 'OK', you must have the permissions to write to the directory and you won't get the error messages more.

    Hope this has solved your problem

Maybe you are looking for