Automatically count the total number of steps

I have a procedure with x steps. In the title manually type us the total number of steps. As you can understand this process often translates into a failure, where the number in the title does not match the actual number of steps.

Is there a solution for automatically Indesign to count the steps below a certain style of paragraph and add the title number. I did find something similar.

For example, where '5' in the title is automatically generated:

How to count (5 steps)

  1. Be patient, start whispering 'a '.
  2. Then mentally count to two...
  3. ... three
  4. ... four
  5. Crying all of a sudden 'five' and pretend that nothing takes place.

Thanks in advance

This can be done very easily by the script. I wrote it while drinking my coffee in the morning.

Front

After

I don't know what style names that you use so I used 'Header' and 'steps '. Change them to your style of the script name (in a text editor - Notepad for example, ESTK):

If you add / remove certain steps, run the script again and it will update the numbers.

Here is the script and here is an example document for the test.

DISCLAIMER: I did not see your documents, so can't promise it will work for you, as it is.

/* Copyright 2014, Kasyan Servetsky
June 4, 2014
Written by Kasyan Servetsky
http://www.kasyan.ho.com.ua
e-mail: [email protected] */
//======================================================================================
var scriptName = "Count number of steps - 1.1",
doc;

PreCheck();

//===================================== FUNCTIONS ======================================
function Main() {
    var foundItem, header, lastPar, num;

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = "(?s).+";
    app.findGrepPreferences.appliedParagraphStyle = "Steps";
    var foundItems = doc.findGrep(true);
    if (foundItems.length == 0) ErrorExit("Found nothing", true);

    for (var i = 0; i < foundItems.length; i++) {
        foundItem = foundItems[i];
        if (foundItem.paragraphs.length == 0) continue;
        header = foundItem.parentStory.paragraphs.previousItem(foundItem.paragraphs[0]);
        if (header.appliedParagraphStyle.name != "Header") continue;
        lastPar = foundItem.paragraphs[-1];
        num = lastPar.numberingResultNumber;
        if (num == -1) continue;
        InsertNum(header, num);
    }

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function InsertNum(header, num) {
    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = "( \\()(\\d+)( Steps\\))$";
    app.changeGrepPreferences.changeTo = "$1" + num + "$3";
    app.findGrepPreferences.appliedParagraphStyle = "Header";
    var changed = header.changeGrep();

    if (changed.length == 0) {
        header.insertionPoints[-2].contents = " (" + num + " Steps)";
    }
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function PreCheck() {
    if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);
    doc = app.activeDocument;
    if (!app.activeDocument.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);
    Main();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function ErrorExit(error, icon) {
    alert(error, scriptName, icon);
    exit();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------

Tags: InDesign

Similar Questions

  • A script that will count the total number of pages into multiple PDF files in a batch file?

    Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?

    In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.

  • Count the total number of rows found in the schema

    Count the total number of lines present in the schema, including the table, sequence, view

    Desirable output

    Table sequence views
    20 of 1000 1000

    Do you mean that you need to count the number of Tables, views and sequence present in the schema?

    Hi something like that.

    SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
           c.seq_cnt AS "Sequence Count"
      FROM (SELECT COUNT (*) view_cnt
              FROM USER_VIEWS) a,
           (SELECT COUNT (*) tab_cnt
              FROM USER_TABLES) b,
           (SELECT COUNT (*) seq_cnt
              FROM USER_SEQUENCES) c
    

    Gives you,

    View Count      Table Count      Sequence Count
           153              878                   32
    

    Thank you
    Shankar

    Published by: Shankar Viji on August 28, 2012 03:03

  • Function to count the total number of data channels

    I know that I had stumbled on a tiara function that returns the number of data in all of my data channels.  I can't seem to find the thread where I had seen it.  I'm looking to replace a script a long time user with this simple function in my future coding.

    Thank you!

    Hi CrshTstr,

    I actually still use GlobUsedChn for that.  In more recent versions of DIAdem, you can use commads as GroupChnCount() or Data.Root.ChannelGroups (1). Channels.Count to return the number of channels in a particular group.  But regardless of which group the channels are in the GlobUsedChn variable always returns the total number of channels currently on the data portal.

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • Count the total number of specific words on each page

    I have a script that counts the number of times where the word 'Manager' is displayed on each page of a report.

    This is what is returned in the console after running the script:

    Count the number of managers 1 Page number 1

    Count the number of managers 2 Page number 1

    Count the number of managers 3 Page number 1

    Count the number of managers 4 Page number 1

    Count the number of managers 5 Page number 1

    Count the number of managers 1 Page number 2

    Count the number of managers 2 Page number 2

    Count the number of managers 3 Page number 2

    I need the console to report with only the total number of times that the word Manager appears on each page (once) and not iterate over each of them.

    Can someone please advise how this can be achieved?

    Script as follows:

    var this.numPages = NUMPAGES;

    for (var k = 0; k < numpages; k ++)
    {
    {
    numWords var = this.getPageNumWords (k);

    var number = 0;

    for (var i = 0; i < numWords; i ++)
    {
    var ckWord = this.getPageNthWord (k, i, true);
    var q = this.getPageNthWordQuads (k, i);
    Convert quads in the rotation by default user space
    Userspace used by links.
    m = (new Matrix2D).fromRotated(this,0);
    mInv = m.invert)
    r = mInv.transform (q)
    r = r.ToString)
    r = r.split(",");
    If (ckWord = "Manager")
    {
    Count ++;
    Console.println ("Count none managers" + count + "Number of Page" + (k + 1));
    }
    }
    }
    }

    Just move the statement outside the inner loop:

    var this.numPages = NUMPAGES;

    for (var k = 0; k)< numpages;="" k++)="">

    numWords var = this.getPageNumWords (k);

    var number = 0;

    for (var i = 0; i)< numwords;="" i++)="">

    var ckWord = this.getPageNthWord (k, i, true);

    var q = this.getPageNthWordQuads (k, i);

    If (ckWord = 'Manager') {}

    Count ++;

    }

    }

    Console.println ("Count none managers" + count + "Number of Page" + (k + 1));

    }

  • How to count the total number of records with distinction?

    Hello guys

    I have a report that contains a list of the types of company and other attributes as follows:
    Shipto               Company Type             GC Code               Measures
    A                         cc                             x                          100
                                                               y                          200
                                                               c                          120
    
    B                         YUT                         I                            200
                                cc                           U                           98
    
    G                         Maid                        rt                           200
                               YUT                        TT                         300
                               JTE                         TY                         400
    
                               
     
    The list goes on and... "Business type" appears is not the highest or the lowest... I would like to see what is the total number of different company types we have. By this report, there should be 5, but if I count or count (*) or rcompte, I actually get the total number of lines in the present report, which is not what I want...

    If someone could help me to find the total number of company types?

    Thanks in advance

    Have you tried this one?

    Sum (Count (distinct ColumnName))

  • How to count the total number of highlights in my PDF file using acrobat adobe XI?

    .

    Open the sidebar comment. In the comments list, click the button in the Middle, comments filter and set the nail Type submenu. The count at the top of the list of comments will be among the highlights.

  • How to query the total number of columns and lines filled with data?

    How to get the number of rows and columns in Exel file data using Excel report?

    Since you have posted this question in the forum of LabWindows/CVI, I guess you want to know how to do with CVI.

    You need to know how to open and activate the Excel data file.

    Depending on the function returns the total number of columns and lines col_count row_count, respectively.

    -----------------------------------------------------------------------------------------------------------------------------------------

    int CountColumnsAndRows (void)
    {
    Error HRESULT = 0;
    CAObjHandle rangeCurrentRegionHandle = 0;
    CAObjHandle rangeColumnsHandle = 0;
    CAObjHandle rangeRowsHandle = 0;
      
    unsigned long col_count = 0, row_count = 0;
      
    Must use the 'A1' property and CruuentRegion count the total of columns and lines, including the drafts!
      
    error = CA_VariantSetCString (& MyCellRangeV, 'A1');
      
    error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, & ExcelRangeHandle);
    If (error<0) goto="">
      
    error = Excel_GetProperty (ExcelRangeHandle, & ErrorInfo, Excel_RangeCurrentRegion, CAVT_OBJHANDLE, & rangeCurrentRegionHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeCurrentRegionHandle, & ErrorInfo, Excel_RangeColumns, CAVT_OBJHANDLE, & rangeColumnsHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeColumnsHandle, & ErrorInfo, Excel_RangeCount, CAVT_LONG, & col_count);
    If (error<0) goto="">
      
    error = Excel_GetProperty (rangeCurrentRegionHandle, & ErrorInfo, Excel_RangeRows, CAVT_OBJHANDLE, & rangeRowsHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeRowsHandle, & ErrorInfo, Excel_RangeCount, CAVT_LONG, & row_count);
    If (error<0) goto="">

    Error:

    CA_VariantClear (& MyCellRangeV);
    CA_VariantClear (& MyVariant);
    ClearObjHandle (& ExcelRangeHandle);
    ClearObjHandle (& rangeCurrentRegionHandle);
    ClearObjHandle (& rangeColumnsHandle);
    ClearObjHandle (& rangeRowsHandle);
      
     
    If (error<>
    ReportAppAutomationError (error);
      
    error return;
    }

  • HP Officejet Pro 8610: How can I get a report with the total number of pages printed on my HP Officejet Pro 8610?

    The number of pages that print is so critical to a choice to use the "HP Instant ink Plan' or not, how can I find the total number of pages that I printed on my brand new (installed 2 days ago) 8610?  And if I can, there are a total of 'resettable' or working capital?  Don't see anything in the user guide and a search gives nothing usable on this blog.

    Wireless printer installed on an old PC with Windows XP SP3.  I also of course install with cable network but so far it works well on my home network without a network cable.  Is there any operating system, I also have a laptop Lenovo Vista on which I can install this printer.

    Please do not answer I can find total by counting the number of pieces of paper that I have.  Surely the inner workings of this beautiful machine must have the requested data as well as HP can say my consumption if I select the monthly plan of ink!

    This 8610 was a good buy (net $89,00 after the resumption of my six years, Deskjet J36xx) at Office Depot/Max who has of course influenced my decision to purchase.  So far, I am very happy with the print quality and speed, have not yet tried the scanner and will probably never use the fax machine since I have no land line phone.

    Thank you

    Harry

    Hello

    Article #2 of the report printer Ststus will tell you. Please try:

    Printer status report

    The printer status report to view current information about the printer and the status of the ink cartridges. Also use the report to State printer for you help to solve the problems associated with the printer.

    The printer status report contains also a log of recent events.

    If you need to call HP, it is often useful to print the printer status report before calling.

    To print the printer status report

    1. in the Control Panel printer display, press and drag your finger on the screen and then press Setup.

    2. press on printing reports and then tap Printer Status Report.

    Kind regards.

  • How to track the total number of downloads of my app BB10

    Hello

    I'm not sure of this is the right section to post in, but it's the best I could find.

    I want to track the total number of downloads of my BB10 APP on the blackberry world. Download report is very simplistic and just generates a chart leaving me count manually. I tried also to export the data to download to Excel. While this works, it is a bit heavy. Is there another way for me to be able to view these data easily right now? Or do we have to wait for the SDK analytical tool to be made available for BB10?

    Thank you

    Take a look at this that maybe that's what you're looking for...

    http://www.appworldreport.com/

  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • Script to gather and calculate the total number og Sockets PR. cluster

    Hello

    for licensing purposes, I need to collect a report host information and decision-making by the host.

    I want the report to include the following text:
    -Display the host by cluster (attached script) information.

    -A title with NOMCLUSTER by cluster

    -The total catch by cluster

    I guess my problem is that I work in a table and I want to insert empty lines and headlines and my attempts have failed so far. I don't know if I should convert to html format and change the page in this way. (hope not)

    I'd appreciate any help...

    / Kim

    Hi Kim,

    Welcome to the VMware communities.

    I modified your script to include a row header per cluster with the name and the total number of outlets for the cluster:

    $clusters = get-cluster | sort name
    $vms = $null
    if(test-path report.htm)
    {
        remove-item report.htm
    }
    
    foreach ($cluster in $clusters){
        $report = @()
        $ClusterSockets = 0
        foreach ($ESXHost in ($cluster | Get-VMHost | Sort Name)){
            $row = "" | Select Name, Version, Build, ClusterName, Model, ProcessorType, Sockets, Cores, PNics
            $row.name = $ESXHost.name
            $row.version = $ESXHost.version
            $row.build = $ESXHost.build
            $row.clustername = $cluster.name
            $row.model = $ESXHost.model
            $row.ProcessorType = $ESXHost.ProcessorType
            $row.sockets = ($ESXHost | Get-View).Hardware.CpuInfo.NumCpuPackages
            $ClusterSockets += $row.sockets
            $row.cores = ($ESXHost | Get-View).Hardware.CpuInfo.NumCpuCores
            $row.PNics = ($ESXHost | Get-View).Config.Network.Pnic.Count
            $report += $row
        } # End foreach host
        "

    $($Cluster.Name), Number of sockets: $ClusterSockets

    " | Out-File report.htm -append $report | ConvertTo-HTML | Out-File report.htm -append } # End foreach cluster .\report.htm

    Best regards, Robert

  • Calculate the total number of the schema rowset.

    Hi all

    I use the oracle 10g database on windows server 2003.

    I want to calculate the total number of lines in a pattern.
    I have only one method to select just count (*) from each table within each schema.
    because it doesn't matter what possible query that could calculate the total number of lines in a pattern?


    Thank you.

    Published by: Maahjoor on May 13, 2013 23:21

    Hello

    Well, if you keep your cool failry statistics, you can get a very good grip on the number of lines through the NUM_ROWS in dba_tables column and then summarize the owner, on the top of my head:

    select sum(NUM_ROWS) from dba_tables where owner like 'SCHEMA';
    

    Do not forget that the number of lines shown this way will be the number of lines at the time of the last crawl (dbms_stats) has been run on the segment, so it may not always be equal to the number of the schema rowset did when running.

  • How to display the total number of rows in the dashboard

    Hello

    I have a dashboard report for retrieving the list of projects and details, it grows on a daily basis, instead of users downloading the report and find out the total number of projects, I want to display 'the total number of projects' alone in the dashboard. How can I do?

    Also is it possible to do like a pop up or something a little flash news - not necessary, but will be very good if I can do it.

    Thanks for your time and your help.

    create a report and a column to write a column invert the function max (rcount (1)). Call this column depending on the position of the column (as @1) in narrative mode.
    You can view only the narrative in the dashboard.

    for flash type of report, you can use the ticker view and call the same column in the view.

    refer to this link to view the total number of records
    http://Siebel.ITtoolbox.com/groups/technical-functional/Siebel-Analytics-l/display-row-count-in-top-of-the-table-view-3704999

    assign points if found useful.

  • How to display the total number of text entries in a table (php)?

    Hello

    I have a database of 'chorus' with 'members' table that has the following data structure:

    Name Voix
    Jennasoprano
    DannaAlto
    ROXYAlto
    Damientenor
    CarmenAlto
    Daisysoprano

    Diana

    Alto
    Roberttenor
    JohnBass

    With Dreamweaver, php, any help on how display in a Web page the total number of 'alto', in this case: 4.

    Thank you

    Luci.

    SELECT voice, COUNT (*) as the GROUP BY, ORDER BY DESC voice voice FROM choir;

    This will give you the plain voiceid - County

    SELECT voice, COUNT (*) as the chorus of voices ORDER BY DESC GROUP name;

    This will give you appoint County - voice -.

    Confidence, it helps.

    See you soon,.

    ST

Maybe you are looking for