Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Convert Paragraph to Table and apply table style #74386
    Poleroad
    Member

    Hello B. Eenkhoorn,

    I found your script very helpful, if I could make it work for me. That is Convert Paragraph to Table and Apply Table Style. If you have a minute for hand-holding, the script bombs on line 15 and also on the following line:
    for (var i = result.length-1; i >= 0; i-)

    Could you post a more readable version?

    Thank you,
    Martin

    in reply to: Convert Paragraph to Table and apply table style #74385
    Poleroad
    Member

    Hello B. Eenkhoorn,

    I found your script very helpful, if I could make it work for me. That is Convert Paragraph to Table and Apply Table Style. If you have a minute for hand-holding, the script bombs on line 15 and also on the following line:
    for (var i = result.length-1; i >= 0; i-)

    Could you post a more readable version?

    Thank you,
    Martin

    in reply to: Find/Change Paragraph Style to Cell Style #74384
    Poleroad
    Member

    Hello Jongware,

    I managed to find the script that I was looking for above. I found a script posted by B. Eenkhoorn. That is Convert Paragraph to Table and Apply Table Style. If you have another minute for hand-holding, the script bombs on line 15 and also on the following line:
    for (var i = result.length-1; i >= 0; i-)

    Thank you again,
    Martin

    Here it is:
    ***********************************************************************

    book = app.activeBook;

    for (var i=0; i<book.bookContents.length; i++)
    {
    var currentDoc = app.open (book.bookContents[i].fullName, false);

    // DO THINGS HERE FOR EVERY BOOK

    currentDoc.close(SaveOptions.YES);
    }

    //Script to convert Paragraph to Table and apply table style
    //==================
    app.findGrepPreferences = null;
    app.findGrepPreferences.appliedParagraphStyle = app.documents.firstItem().paragraphStyles.itemByName = “Heading 3″;

    var result = app.documents.firstItem().findGrep();
    for (var i = result.length-1; i >= 0; i-)

    {
    var a_text =(result[i].characters.lastItem().contents == ‘\r’)
    ? result[i].parentStory.characters.itemByRange(result[i].characters.firstItem().index, result[i].characters.lastItem().index -1)
    : result[i];
    var a_table = a_text.convertToTable( );
    }

    app.findGrepPreferences = null;
    var d = app.activeDocument;
    var myTableStyle = myDisplayDialog ();

    d.stories.everyItem().tables.everyItem().appliedTableStyle = myTableStyle;
    d.stories.everyItem().tables.everyItem().clearTableStyleOverrides( true );

    function myDisplayDialog(){
    var myDialog = app.dialogs.add({name:”Avakov Table Stripes”});
    with(myDialog.dialogColumns.add()){
    var myTsDropDown = dropdowns.add({stringList: d.tableStyles.everyItem().name, selectedIndex:d.tableStyles.length-1});
    }
    var myResult = myDialog.show();
    if(myResult == true){
    var tS = d.tableStyles[myTsDropDown.selectedIndex];
    myDialog.destroy();
    }
    else{
    myDialog.destroy();
    exit()
    }
    return tS;
    }

    in reply to: Find/Change Paragraph Style to Cell Style #74314
    Poleroad
    Member

    I think you deserve 50 shades of Thank you!

    After some tinkering to figure out what were the variable-names and what were my InDesign styles and match them — voila: it worked.

    Now, if I may ask for a bit more of an improvement. As I discovered, one needs to manually place the cursor into the table, is there a way to run the script over an entire document with hundreds of tables. That would be the biggest help.

    Ditto: same for Table Styles. Find all Tables and apply Table Style.

    Thank you again,
    Martin

    in reply to: Find/Change Paragraph Style to Cell Style #74297
    Poleroad
    Member

    Thank you Jongware, making progress !

    Got past up to line 27 :)

    but on line 28, this one:
    myCellStyle[c][/c].parent.appliedCellStyle = “Header Cell”;

    I got the following error: Offending Text: /

    I assume there is something with [/c] entity that is not accepted.

    Thank you again,
    Martin

    in reply to: Find/Change Paragraph Style to Cell Style #74236
    Poleroad
    Member

    OK, no take on this question, but is there a way to use plain Find/Change to apply Cell Styles based on Paragraph styles?

    Thank you,
    Martin

    in reply to: Toggle shortcut between Find panel and found text #73802
    Poleroad
    Member

    Thank you, David, I tried but it is just cumbersome and the reason is that it takes a bit of time to re-open the Find again. There should be something like Ctrl+Tab, so that both remain open and it would be fast to go back and forth.

    Any better alternatives?

Viewing 7 posts - 1 through 7 (of 7 total)