Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
Member(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;
}Theunis De Jong
MemberYou'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?”
August 28, 2010 at 3:57 pm in reply to: Define table row heights, column widths in styles somehow? #56864Theunis De Jong
Member.. 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.
August 28, 2010 at 12:20 pm in reply to: Define table row heights, column widths in styles somehow? #56862Theunis De Jong
MemberA 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];
August 28, 2010 at 12:14 pm in reply to: Define table row heights, column widths in styles somehow? #56860Theunis De Jong
MemberThis 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;
}August 28, 2010 at 12:03 pm in reply to: Define table row heights, column widths in styles somehow? #56859Theunis De Jong
Member(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;
}August 28, 2010 at 11:47 am in reply to: Define table row heights, column widths in styles somehow? #56857Theunis De Jong
MemberThat'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”);August 28, 2010 at 10:23 am in reply to: Define table row heights, column widths in styles somehow? #56855Theunis De Jong
MemberJavascript 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”;August 28, 2010 at 8:57 am in reply to: Define table row heights, column widths in styles somehow? #52835Theunis De Jong
Member.. 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.
August 28, 2010 at 5:20 am in reply to: Define table row heights, column widths in styles somehow? #52833Theunis De Jong
MemberA 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];
August 28, 2010 at 5:14 am in reply to: Define table row heights, column widths in styles somehow? #52831Theunis De Jong
MemberThis 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;
}August 28, 2010 at 5:03 am in reply to: Define table row heights, column widths in styles somehow? #52830Theunis De Jong
Member(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;
}August 28, 2010 at 4:47 am in reply to: Define table row heights, column widths in styles somehow? #52828Theunis De Jong
MemberThat'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”);August 28, 2010 at 3:23 am in reply to: Define table row heights, column widths in styles somehow? #52826Theunis De Jong
MemberJavascript 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”;Theunis De Jong
MemberTables 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.
-
AuthorPosts
