Back

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

Forum Replies Created

Viewing 15 posts - 796 through 810 (of 1,338 total)
  • Author
    Posts
  • in reply to: Change hyphenation options in script? #56918

    (Would you mind asking script-specific questions in the Scripts section of the forum? I think David wants to keep his forum tidy ;) )

    This quick hack of a Javascript will reset all 10 (!) hyphenation options of each paragraph to the values defined in the applied style. I tested only on a small document; I suppose it might take some time on a longer document (whereas the number of paragraph styles has no influence at all).

    allPars = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();
    for (p=0; p<allPars.length; p++)
    {
    style = allPars[p].appliedParagraphStyle;
    if (!style.isValid) continue;
    allPars[p].hyphenWeight = style.hyphenWeight;
    allPars[p].hyphenateAcrossColumns = style.hyphenateAcrossColumns;
    allPars[p].hyphenateAfterFirst = style.hyphenateAfterFirst;
    allPars[p].hyphenateBeforeLast = style.hyphenateBeforeLast;
    allPars[p].hyphenateCapitalizedWords = style.hyphenateCapitalizedWords;
    allPars[p].hyphenateLadderLimit = style.hyphenateLadderLimit;
    allPars[p].hyphenateLastWord = style.hyphenateLastWord;
    allPars[p].hyphenateWordsLongerThan = style.hyphenateWordsLongerThan;
    allPars[p].hyphenation = style.hyphenation;
    allPars[p].hyphenationZone = style.hyphenationZone;
    }

    in reply to: Recommended typeface and font #56895

    You'll want a good, clean, readable typeface. Use big letters if you don't have a long résumé ;-)

    Use lots of leading — up to 1½ of your point size, but don't go wild and use twice the point size.

    A trick to make your resume look longer than it is, is to put headers (“Grades”, “Previous occupations”, stuff like that) into a left column with a small bold font, and put the actual data in a right column, so it takes up more vertical space.

    If you are applying for a design job, you should try to make it a calling card for your design skills, and in that case I'd rather say: follow your intuition! “Would I hire me if I used some drop shadows?”

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

    .. 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? #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.

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