Sort the table of Foundtext and respective Page number

Hi all

I'm a novice scripter. It is also my first Indesign script. Please help anyone for my first script. Here is my requirement.

I want to generate a text style applied to particular character with belonging "number of Page. Also, I need to sort the text found in alphabetical order with the belonging itself page number. I have generated just the text and the page number for membership by writing the following code.

myDoc var = app.activeDocument;
var myDocPath = app.activeDocument.filePath;
var myDocName = app.activeDocument.name;

app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = myDoc.characterStyles.item ("Test");
var myText = myDoc.findText ();
var myPageNumber = new Array;
var myFoundText = new Array;
var myFoundTextSort = new Array;

for (var i = 0; i < myText.length; i ++)
{
myFoundText.push (myText [i] .silence);
}

for (j = 0; j < myText.length; j ++)
{
var r = getPageFor(myText[j].characters[0]);
myPageNumber.push (r.name);
}

var inc = 0;
var myLogFile = new File (myDocPath.fsName + "/ Text_Report_" + app.activeDocument.name.split(".")) ([0] + ".log");
If (myLogFile.open ("w", defined, undefined))
{
if(myFoundText.Length!=0)
{
for (var k = 0; k < myFoundText.length; k ++)
{
SERIALNO = k + 1;
myLogFile.writeln ("" + serialno + ".")  ' + myFoundText [k] + "-Page" + myPageNumber [k]);
}
}
}

myLogFile.close ();
myDoc.close ();

function getPageFor (element)
{
While (!) (element instanceof Page) | element instanceof request))
If (element instanceof character)
item = element.parentTextFrames [0] .parent;
on the other
item = element.parent;
If (element instanceof Page)
Returns the element;
Returns a null value.
}

Please help anyone. Thanks in advance

Well, you're almost there. The current problem is in your push instruction. Array.push (...) peut push more than a single element in the table, but it will do so in single shoot; This is why you do not get the composite objects back, but each has pushed point on its own place.

So either use the method of Kasyan and create a composite object

PAGEText.push ({pageNumber: 5, text: "this is some text 5 '});

either way, in a table:

MYFoundText.push ([MYResults [i] .silence, r.name]);

Whatever it is, you have to adjust your sort code for what you choose.

Tags: InDesign

Similar Questions

  • Script to sort the table in ascending order

    Hello

    I am not able to find any manufacturer of chassis function to sort the table in ascending order with respect to column 1. Please, guide me how I can write the script extended chassis manufacturer to sort the table.

    Thanks and greetings

    Libson

    Here's how you can sort a table with ExtendScript:

    #target framemaker
    
    var doc = app.ActiveDoc;
    // Set a variable for the selected table.
    var tbl = doc.SelectedTbl;
    
    // Select the table.
    tbl.MakeTblSelection (Constants.FF_SELECT_WHOLE_TABLE);
    
    // Sort the table.
    CallClient ("TableSort", "row nocase 0 ascending -1 ascending -1 ascending");
    

    Here's the FDK Programmers Reference for TableSort settings information:

  • Who holds the keys for encryption AES mentioned in the table under "security and features iCloud?

    Who holds the keys for encryption AES mentioned in the table under "security and features iCloud?

    Article

    Security and privacy - Apple Support Overview iCloud

    has a useful table in the section entitled Security and features iCloud.

    The table shows the types of keys used to secure the different types of data.

    Apple holds these keys as it may be requested of Apple by third parties?

    Hmmm... You definitely raise a good and valid question to which I don't know the answer to, but if I had to guess, I would say that no one.  Would this be possible?  I know I've heard Cook mention that they "don't hold the keys" but does the same thing, it refers?  It would make a very interesting topic of discussion.

  • Windows XP icons, the buttons of the menu, Favorites, files, and Web pages are too big.

    Brower, the menu buttons, icons and Web pages are large

    icons of Windows xp, the menu buttons, the Favorites file, and Web pages are too big

    Hi rayrange,

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

    Follow these methods.

    Method 1: Perform a System Restore and check if the problem persists.

    Method 2: Follow the steps in the article.

    Resources for troubleshooting problems in Windows XP

  • Can not get the position of the disabled parent node and - U Menuitembox (number) has no associated page

    I find it impossible to get anywhere with the new face of reactive. He is constantly crashing with mainly two can't get messages that keep coming up - position of the parent node invalid and - U Menuitembox (number) has no associated page. I stripped the file back take a few days of work by stages in a few pages. deleted all the pictures. Always crashing. Any advice would be much appreciated

    Hi WoodyCD,

    Sorry to hear that you are facing problems with this version.

    We are aware of the first crash (cant get position of the - invalid parent node"). This happens when you have a text block with padding to left/right (from the spacing Panel) which is reactive width in some breakpoints and fixed/browser width in others. If possible, please avoid this combination until we release a fix (hopefully soon). Often, you can use the margins of left/right paragraph (since the text panel) as a substitute for left/right padding.

    We have not seen the other accident (Menuitembox... has no linked pages) within a certain time. Could you send us your .muse file (e-mail [email protected] or use a file sharing service) with a link to this topic?

    Thank you

    Abhishek

  • How to insert image from mysql into the table using php and create the checkbox in the table?

    How can I insert image from mysql into the table using php and create the checkbox for each data as a vote? Here is my code...

    WELCOME

    connect_error) {die ("connection failed:".)} $conn-> connect_error); } $sql = "SELECT no, Calon, ID, of course, the Image OF THE candidates." $result = $conn-> Query; If ($resultat-> num_rows > 0) {echo ' '; export data of each line while ($row = $result-> fetch_assoc()) {"echo"}}
    NO Candidate INFO Vote
    " . $row ["no"]. "-" . $row ["Calon"]. "
    -" . $row ['ID']. "
    -" . $row ['class']. "
    "; } ECHO ' ' ;} else {echo '0 results' ;} $conn-> close();?} >

    hope someone can help me because I am a newbie in this program... need to finish this project... Thank you.

    If you have saved the file name in the database, it's pretty simple.

    echo '' . $row['description'] . '';
    

    Is the same for the box:

    echo '';
    

    If you have saved the image file in the database, it is much more complicated. I recommend you store only the file name in the database.

  • difference in size of the Table in oracle and timesten

    Hi all


    I have a large table with 2 million records,

    I see no big difference in the size of the table in oracle and Timesten
    In oracle table size to 4 GB, but in Timesten is arround 15 GB (using ttSize for 2 M lines)

    Could you please tell me what could be the cause of this difference?
    Is the size of the table in Timesten is always more than oracle?
    What are the factors and parameters affecting the size of Perm?

    It is typical for the storage needs for a DataSet to be significantly larger in TimesTen in Oracle. This is due to the Organization of the very different internal storage in TT from Oracle; Oracle is optimized to save space while TT is optimized for performance.

    Ways to minimize these costs are:

    1. make sure you use TimesTen 11.2.1. This has some characteristics compare compact (minor) and earlier versions.

    2 assess the use of numeric types; native types TimesTen (TT_TINYINT, TT_SMALLINT, TT_INTEGER and TT_BIGINT) use less space than MANY and longer by the effective calculation as well.

    3. check use of data of variable length (VARCHAR2, VARBINARY, NVARCHAR) and the trade-offs between online and online storage (see documentation for the compromise between these options stirage TT).

    Even when you use the foregoing, you will still see a storage important "inflation" for TT from Oracle.

    Chris

  • problems with the table of contents and index

    I do the localization for the Japan, so I'm all nice and good in Japanese (themes, table of contents and index), however, after compilation, only the TOC and India are in a font that does not support Japanese characters.
    Does anyone have any ideas how to solve this problem?
    Thank you

    Thank you Pete, it's part of the solution.
    In fact, what I discovered on a German forum for RoboHelp, is to set the machine to the locale for the country, and the location is made. I installed the language support pack before my problem and so I was able I was translating into topics. The problem appeared when I tried my first compilation. The subjects were still in Japanese, that I translated, but the table of contents and the index and were the only ones who wrote in a totally unknown style (not Japanese English and not another language, I know).
    Now that I've changed the location of my system, it works.
    So, I think that this should be a first improvement for RoboHelp, right? They boast that they support 35 languages, however the support isn't quite... finish, huh?
    Furthermore, the error message continues to come even after all these changes, but I don't like too much about this, I get what I need.
    Thanks again Pete for the solution and the quick response.

  • I ordered the creative cloud Sunday and received a number control but still cannot open any programs. When I check the status of my order online, he says that he can't find it. Is this normal after 3 days?

    I ordered the creative cloud Sunday and received a number control but still cannot open any programs. When I check the status of my order online, he says that he can't find it. Is this normal after 3 days? I tried to ask in a chat instead of the forum window, but no one answered and after 10 minutes, my screen restarted and closed window cat. It seems a bit frustrating not knowing what happened to my order and not being able to communicate with anyone. This habit with Adobe or are they just of technical problems this week?

    Your subscription to cloud appears on your account page?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

    -or by phone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • Filter the Table during execution and keep uncommitted line changes

    Hello

    I have a requirement which has been quite difficult for me so far.

    I use the first version Jdev 12 c.

    I have a table of AF that is connected to a ViewObject that is used for sending new data.

    When I add lines to this ViewObject, I put a field that I intend to use for filtering so that the number of lines is not displayed at the same time.  This field comes from a selection of LOV.

    I want to be able to change lines are displayed in the table based on what is the current value of selection LOV.  This isn't a problem for me, and it works perfectly using a view criteria and a variable transitional EO I put in place.

    My problem is that when I select a new value in the LOV and change to bind the variable view criteria, I want all changes uncommitted to the lines to be preserved in the View object.  Currently, the lines are not keep their changes, and I need to do this, because after that the user has entered data for a large number of lines, there will be a commit to the database for all new lines added.  Is this possible or should I look for an alternative?

    I also tried to use a table filter in the link of the page layer, but I get an error that I can't debug. It is marked as Houston-34014.  In this method, I try to access my bean in pageFlowScope to filter the table.  This bean variable is updated when the LOV selection changes.  Error messages settings are {0 = oracle.jbo.Key [-220-225], 1 = root}.  I also read that this filter parameter is a static filter and does not dynamically during execution.

    Any help would be appreciated, thanks for reading.

    Hello lhymel

    I think that your problem is solved, so please close this thread and open a new thread for tuning related problem

    Thank you

    -Ashish

  • Rows in the table are break on separate pages...

    I have 20 lines equipped table:

    first 3 lines are on one page, then half of the page is empty hen remaining 17 rows is on the second page.

    How can I keep table to break the lines. I want all rows in the table to succeed himself.

    Help, please. Thank you.

    Keep them with parameters are in the table > Format > Format line...

    Note: the first row on the second page may also have a start parameter that indicates that it is at the top of a page or column.

    The control of widows and orphans just specifies how many rows to keep together (widow is the first page; ( orphan , is the second page) when a table has over a page. The higher the number, the more lines are forced to remain together.

  • Problem in sorting the table advacned attribute

    Hi all

    Everyone please help me sort the column Advanced because I need readonly columns but when I sort in converted writable format...

    Thanks in advance

    Hello

    ColoumnHeaderPrompt ther is a property; All sort and set the Initila Staus.

    WHT is the style of columns in advance Table RN...? IF you want to only read only go to "MessageStyledText".

    Nani

    Published by: Nani652595 on February 24, 2010 22:06

  • How can I change the formats for left and right pages?

    First timer here in the Apple community so forgive my mistakes.

    Works with Apple Pages 5.6.1 on a MacBook Air, try to format a book for automatic printing. I want to do different for left and right pages headers and footers, and margins so that, for example, the page numbers appear outside of the page rather than all the beings in the lower right.

    Is it possible? I googled around and it seems page was once able to do, but the feature was removed thereafter. I have reviewed in the Document and Format menus and sought help, but no joy so far.

    Any help much appreciated.

    Not possible on Pages 5.6.1 which is absent from the reams of features.

    Use instead the Pages ' 09.

    Peter

  • Need to sort the photos by date and time taken

    It is ridiculous that there is no possibility to sort the photos in an album by the date and time taken.  I imported the photos of several cards, two cameras take pictures at the same time, there is no way to sort photos, so the photos appear in true chronological order.  This should be added to the Photos, I think it's available in iPhoto.

    On Photos for Mac you can sort photos by date and time.  This was introduced with the update to El Capitan.  What version of Photos are you running?

    If you select one of your albums and ctrl-click, you can sort it by the titles, oldest first or newest first.

    Or is the problem that the sort order is incorrect?

    Then, you may need to adjust the date and time for pictures from camera cards different.  If you imported the photos while you were in different time zones, photo interpreter differently dates.  It will use the time zone of time current system at the time the photos are imported to interpret dates on cards.

  • Use the table 2D input and output dll

    Hi, I have a problem with table 2D used with library funtion call to get the table of DLL.

    uint16_t is defined as unsigned short, who is unsigned 16-bit in labwindows.

    In the following two codes origFrame.height is 1024, 1280 origFrame.width.

    QCam_Err DLLEXPORT FrameGrab(void* handle, uint16_t frame2D[1024][1280]) {}

    uint16_t * p;
    p = (uint16_t *) origFrame.pBuffer;
    Copy each pixel of the 2D array
    for (int i = 0; i)
    for (int j = 0; j)
    frame2D [i] [j] = * p ++;
    }
    }
    }

    2D array is passed to the DLL in the form table 1 d, I also tried table 1 d below but to get the same numerical results.

    {QCam_Err DLLEXPORT FrameGrab(void* handle, uint16_t *frame1D)
    uint16_t * p;
    p = (uint16_t *) origFrame.pBuffer;
    for (int i = 0; i)<(origFrame.height*origFrame.width);>
    frame1D [i] = * p ++;
    }
    }

    Both of these methods gives me the same numeric result with regard to the numbers in the output array.

    Something interesting is that the output array has the right size, but all the numbers in the table are about ~ 40, while my expected in all values table is 60.  I know, because I use this to get values of a pixel in a camera and I know that the values of the pixels.  I also used the same code in LabwindowsCVI as a normal program built as exe.  Everything works fine and I get my expected values.  So apparently miss me something here, when I changed the settings to make dll.

    What I've done wrong?  Thank you very much for your help!

    Best,

    Charles


Maybe you are looking for