Forum Replies Created

Viewing 15 posts - 796 through 810 (of 1,335 total)
  • Author
    Posts
  • in reply to: Define table row heights, column widths in styles somehow? #56862

    A small addendum: the Name_Script stuff does not play nice with decimal points in your value. Change line #4 to this to solve it:

    newHeight = app.activeScript.name.split('_')[2].split('.jsx')[0];

    in reply to: Define table row heights, column widths in styles somehow? #56860

    This is super-fancy if you need several variants. Save this script as “Resize_Cell Style Name_New Size.jsx”, and it'll pick up the variables from the script name :) (For instance, “Resize_Yellow Cells_10mm.jsx”.)

    if (app.activeScript.name.match(/_/g).length == 2)
    {
    cellStyleName = app.activeScript.name.split('_')[1];
    newHeight = app.activeScript.name.split('_')[2].split('.')[0];
    if (app.activeDocument.cellStyles.item(cellStyleName).isValid)
    app.doScript (sizeRows, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, “Undo Resize Height of “+cellStyleName);
    else
    alert ('There is no Cell Style named “'+cellStyleName+'”');
    } else
    alert ('The name “'+app.activeScript.name+'” should be in the format “Resize_CellStyleName_Height.jsx”!');
    function sizeRows ()
    {
    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == cellStyleName)
    cellarray[a].height = newHeight;
    }

    in reply to: Define table row heights, column widths in styles somehow? #56859

    (Achh! Reply was to previous replay ;))

    Yes, I suspect writing it as one single AS command allows you to Undo it at once. However, Me ≠ AppleScript.

    There is also a way to encapsulate an entire Javascript into one “undo” command — hold on while I look up how that was done.

    (.. insert elevator muzak here ..)

    There we go:

    cellStyleName = “myCellStyle”;
    newHeight = “12mm”;

    app.doScript (sizeRows, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, 'Undo Resize Height of “'+cellStyleName+'”');

    function sizeRows ()
    {
    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == cellStyleName)
    cellarray[a].height = newHeight;
    }

    in reply to: Define table row heights, column widths in styles somehow? #56857

    That's strange — I can't get it not to work (locked story, locked layer, header rows …). There must be Something Unexpected™ in your tables.

    Can you try this? It counts the number of changes made.

    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    changed = 0;
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == “myCellStyle”) <- Cell Style Name
    cellarray[a].height = “12mm”, changed++;
    alert (changed+” change(s) made”);

    in reply to: Define table row heights, column widths in styles somehow? #56855

    Javascript is missing a construct that is available in Applescript: the whose command. whose selects from an array only the elements that have a certain value. Since you don't want to apply your change to every cell, which is what everyItem selects, you'll have to get 'everything', then loop over the result, applying your height only to cells with the right name.

    This seems to work (since it's no longer a single command, Undo undoes it one at a time):

    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == “myCellStyle”) // <- Cell Style Name!
    cellarray[a].height = “12mm”;

    in reply to: Define table row heights, column widths in styles somehow? #52835

    .. but but but .. I added the message there to warn there is no Cell Style named “myCellStyle” in your document!

    You are supposed to use the correct cell style name in the script name. If you name the script “Resize_SomeTotallyRandomNameHere_5mm.jsx”, it'll try to use “SomeTotallyRandomNameHere” for a Cell Style name — and if you don't have that style, it'll warn you and don't do anything at all.

    in reply to: Define table row heights, column widths in styles somehow? #52833

    A small addendum: the Name_Script stuff does not play nice with decimal points in your value. Change line #4 to this to solve it:

    newHeight = app.activeScript.name.split('_')[2].split('.jsx')[0];

    in reply to: Define table row heights, column widths in styles somehow? #52831

    This is super-fancy if you need several variants. Save this script as “Resize_Cell Style Name_New Size.jsx”, and it'll pick up the variables from the script name :) (For instance, “Resize_Yellow Cells_10mm.jsx”.)

    if (app.activeScript.name.match(/_/g).length == 2)
    {
    cellStyleName = app.activeScript.name.split('_')[1];
    newHeight = app.activeScript.name.split('_')[2].split('.')[0];
    if (app.activeDocument.cellStyles.item(cellStyleName).isValid)
    app.doScript (sizeRows, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, “Undo Resize Height of “+cellStyleName);
    else
    alert ('There is no Cell Style named “'+cellStyleName+'”');
    } else
    alert ('The name “'+app.activeScript.name+'” should be in the format “Resize_CellStyleName_Height.jsx”!');
    function sizeRows ()
    {
    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == cellStyleName)
    cellarray[a].height = newHeight;
    }

    in reply to: Define table row heights, column widths in styles somehow? #52830

    (Achh! Reply was to previous replay ;))

    Yes, I suspect writing it as one single AS command allows you to Undo it at once. However, Me ≠ AppleScript.

    There is also a way to encapsulate an entire Javascript into one “undo” command — hold on while I look up how that was done.

    (.. insert elevator muzak here ..)

    There we go:

    cellStyleName = “myCellStyle”;
    newHeight = “12mm”;

    app.doScript (sizeRows, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, 'Undo Resize Height of “'+cellStyleName+'”');

    function sizeRows ()
    {
    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == cellStyleName)
    cellarray[a].height = newHeight;
    }

    in reply to: Define table row heights, column widths in styles somehow? #52828

    That's strange — I can't get it not to work (locked story, locked layer, header rows …). There must be Something Unexpected™ in your tables.

    Can you try this? It counts the number of changes made.

    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    changed = 0;
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == “myCellStyle”) <- Cell Style Name
    cellarray[a].height = “12mm”, changed++;
    alert (changed+” change(s) made”);

    in reply to: Define table row heights, column widths in styles somehow? #52826

    Javascript is missing a construct that is available in Applescript: the whose command. whose selects from an array only the elements that have a certain value. Since you don't want to apply your change to every cell, which is what everyItem selects, you'll have to get 'everything', then loop over the result, applying your height only to cells with the right name.

    This seems to work (since it's no longer a single command, Undo undoes it one at a time):

    cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
    for (a=0; a<cellarray.length; a++)
    if (cellarray[a].appliedCellStyle.name == “myCellStyle”) // <- Cell Style Name!
    cellarray[a].height = “12mm”;

    in reply to: Easy catalog plugin problems #56839

    Tables run onto the next frame (= page, usually) just like normal text does. So if you import a large number of rows and place it into one frame, you'll get the red “There Is More” plus marker at the bottom right of the frame, and you can add pages and have the text flow continue in the usual way.

    in reply to: Using RGB JPEGs PSDs in InDesign #56831

    I think you just described the difference between the Easy Way and the Right Way …

    in reply to: Easy catalog plugin problems #56830

    Wouldn't it be easiest to add a new column in Excel and designate it a 'unique key' field? (I faintly remember something like that ought to be possible.)

    in reply to: CS5 Data Merge – Empty Field Character? #56822

    If you select just that character you can see its Unicode in the Info Panel.

    I'm betting it's an U+FEFF, a reserved value according to Unicode, and so it was safe for Adobe's engineers to put it to other uses (since it's not allowed as a character code). The U+FEFF code is visible on screen, but since it's usually a very specialized marker for more data, you are usually not allowed to copy it.

    If it is U+FEFF, you are not yet done :) Strangely, GREP does not allow you to search for it the usual way, using

    x{ffef}

    — which ought to have worked! It's rather strange because you can find it just fine with regular Find Text, using the notation

    <feff>

    A curiosity: this same code is used for XML tags and for Index Markers. You cannot replace XML tags (they simply won't budge), but removing Index Markers works fine.

    (Another curiosity, proving the “special status” of this code: the special codes ^I (Text) and ~I (GREP) will find Index Markers but skip other occurrences of U+FEFF.)

Viewing 15 posts - 796 through 810 (of 1,335 total)