Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberWell, for starters it’s not Visual Basic but Javascript ;)
It stops on the first line because Javascript is case sensitive and “Function” should be “function”. Apart from that it should work nicely if you change the operation from changing the Row Height to setting the cell style. In the script below, the name of the applied cell style should be in “myCellStyle”.
When copying your code I found all single and double quotes were transformed into typographically correct “curly” ones. Javascript cannot work with these, they must be straight ones. It’s possible this forum changes them, so please make sure to check them after copying.
Adobe’s own ExtendScript Toolkit Editor, and other Javascript editors as well (I use TextPad) will apply syntax highlighting to keywords and properly formed text strings. You can use this to check; ‘function’, for example, should blue, just as “while” and “if” and other keywords. A text string without proper quotes appears ‘black’ (i.e., as regular text), but with the proper opening and closing quotes it appears in dark red.
Also, watch out for runaway comments. The very last line in your post contains one after the ‘//’, and this indicates the comment runs until the end of the line. However, there is a return missing and the ‘else’ part including the closing brackets should be on a new line.
function findTable(obj)
{
while (obj.constructor.name != "Table")
{
obj = obj.parent;
if (obj.constructor.name == "Application")
{
throw "Can’t find table";
}
}
return obj;
}var myTable = 0;
if (app.documents.length > 0 && app.selection.length > 0)
{
myTable = findTable(app.selection[0]);//Find styles cells formater
if (myTable.constructor.name == "Table")
{
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedParagraphStyle = "Heading 2";
var myCellStyle = myTable.findText();
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
}
if (myCellStyle.length > 0)
{
for (var c = 0; c < myCellStyle.length; c++)
{
myCellStyle[c][/c].parent.appliedCellStyle = "myCellStyle";
}
} else
{
alert("Not found");
}
}
March 25, 2015 at 3:26 pm in reply to: How do I select multiple, noncontiguous sections of text in a text frame? #74174Theunis De Jong
MemberNo.
Clicking with Ctrl, on my Mac, does what it always does: pop up the Right Click menu. Shift does what Shift-clicking already does: extending a text selection. Apple toggles to Select, Alt toggles the Hand tool.
Theunis De Jong
MemberFrom 2011: https://forums.adobe.com/thread/934251
“Page numbering with words
Is it possible set up automated page numbering where the numbers are actually formatted as words instead of numbers?Eg. ‘Four’ instead of ‘4’”
(I distinctly remember having a great time writing that script! Do mind the corrections later on in the discussion.)
March 8, 2015 at 3:03 pm in reply to: Use GREP to find first line indented paragraphs with a different value #73821Theunis De Jong
MemberYou cannot use “not a certain measurement” in GREP (or, for that matter, in regular Find Text). But if some paragraphs are correct, and others may not be, why not simply change ALL of them to the correct measurement?
You can also create a filter by changing some other (unused!) property of ‘good’ paragraphs. For instance, if you are not using Space Before anywhere (it’s all 0), do the following:
1. Search for paragraphs with the correct indentation, and add a Space Before of “1mm”.
2. Now search for paragraphs with a Space Before of “0mm”. These are the wrong ones. Change whatever you want.
3. When done, change ALL paragraphs back to “0mm” Space Before.Note that I hardly ever have to do this, because whatever the source of a Word document is, the very first thing I do is applying a style to *everything*. Not only will it ensure ALL indents are equal, but changing them later on is just a click of a button away.
Theunis De Jong
MemberSo it may not be wise to click the link in his other post? https://creativepro.com/topic/portfolio-template
After this, I dare not try!Theunis De Jong
MemberIt is a plain text file, so you can open it with any plain text editor. Its syntax is deliberately kept as simple as possible: first, some general font information, followed by the exact metrics of each separate character, and then the list of kern pairs follow. All sections are clearly marked.
The hardest part is finding an .AFM file for your font in the first place. They are for the precursor of modern, self containing OpenType fonts: separate ‘outline’ files in .PFB format. I am only guessing .AFM files should still be available for modern fonts, because there is still a lot of legacy software that can’t use OTF fonts right away.
Theunis De Jong
MemberAndy, this is EXACTLY what I created IndyFont for! A lot of my typesetting is in the linguistics field, and there are not that many professional fonts that sport phonetic characters — or even loose diacritics, to manually position.
You can easily find out the built-in kerning of a font by setting the Kerning to Metrics (which will use the font’s own values), typing the two base characters you want to inspect, and then moving the cursor between those two characters. The value in the Kerning field then indicates the amount! This is between parentheses, such as “(-14)”, because it is an automatic value, just as the value of Leading is shown in parentheses when you use the automatic value.
So if you created a ‘?’ (a t with dot below) and want to know how much kerning is applied in the base font between ‘o’ and ‘t’, simply type them and check the value, and then you can use this same value for the underdot character. This will work for almost all combinations, as long as the underdot itself does not interfere with the character before. I don’t think there are many characters that extend at the bottom, but a combination such as ‘?j’ may need a manually determined value.
There is no easy way to read *all* kerning values out of a font. In modern OpenType fonts there is a thing called “Kerning Class”, which is an entire set of left-hand characters vs. right-hand characters. That means there may be hundreds of possible combinations … (which is why it’s stored as a class in the first place, instead of separate combinations!). If you can find an official .AFM file for your font, this usually lists kerning values for certain common pairs.
November 22, 2014 at 4:45 pm in reply to: Indesign CC 2014_Multi-Page PDF Import, Place and Page Creation #71798Theunis De Jong
MemberWhat scripts have you tried and what errors do they (all of them?) return?
Scott Zanelli’s MultiPageImporter, for example, is able to place pages with a certain offset.
Theunis De Jong
MemberOleh: because you would make several groups of people read and think about it INDEPENDENTLY.
That means that on one forum, someone could ask for a clarification (which then would be given in that forum only; or, the OP would need to visit all of these forums and add it everywhere). If someone has a partial solution or suggestion, the people of the other forums cannot enhance or suggest further options based on it. Finally, if a working solution gets posted in one forum, the readers of all the others may not be aware of this and continue to work on it.
Theunis De Jong
MemberSo these intermittent text boxes do not need to “flow” with the rest of the text? Then
1. cut the text out from the flowing text;
2. paste it in a box of its own on the correct page;
3. delete the threaded text frame on that page.Threaded text will only through in text frames that are threaded together. If you place a box of text anywhere on a page and do not thread it to the flowing story, the text inside it will not move along with the rest.
If you find text moves around unpredictably, then you may have moved text frames out of sequence. Switch on Text Threads in the View window to see what flows from where to where; selecting any frame will show ALL of its threads for the entire text run that it contains.
November 22, 2014 at 4:32 pm in reply to: How to delete space at the start of every paragraph? #71795Theunis De Jong
MemberAndy,
Go to the regular Find/Change panel and then click the GREP tab — not the usual “Text” tab. Make sure both Find and Change text fields are empty, and there is no formatting in either. Those work the same as it does as in the regular Text change.
Type in the top (“Find”) field
^ +
— mind the gap! That is a single space in-between. Leave the bottom “Change” field blank. Now hit “Find” and check if it finds and highlights the first occurrence of a space at the start of a paragraph. If it does, hit “Change all” and duck.
The magic codes are
^ = Start of Paragraph. Sort of the same as “^p” in the regular Find/Change dialog, except that this is a *position* only, and it doesn’t ‘eat’ the paragraph return. Since it’s only a position and not an actual character, it also works when there is no Paragraph return ‘before’ the start of a paragraph.
(imagine a single space here) = The literal text to find. GREP uses lots and lots of special characters as commands (the ^ above is one of them) but a space is just a space.
+ = The previous command, group, or character, and then repeated as much as possible.So this will look for *any* positive number of spaces at the start of a paragraph, be it 1 or 42 or any other number larger than 0. Replacing them with ‘nothing’ does exactly that: it deletes them.
How is this different from David’s suggestion? (Sorry David!) He suggests
^+?
where the ” command stands for ‘any kind of space’. That can be useful because apart from a single regular space, this also includes tabs, hard (unbreakable) spaces, and even en and em spaces; but *also* the hard return and the soft return. The latter may unintended wreak havoc on your document, as two consecutive hard returns are *also* seen as “start of a paragraph” (right after the first hard return) followed by “white space” — the next hard return. The next hard returns — any number of them — will also disappear!
Based on your image I understand there are only regular spaces at the start of paragraphs, and so my search expression is a bit safer.
For more information: IDSecrets has a page full of links to resources on GREP: https://creativepro.com/resources/grep
Theunis De Jong
MemberYou already asked this on other forums: https://graphicdesign.stackexchange.com/questions/42328/how-do-i-automatically-insert-a-partial-filename-in-indesign, https://forums.adobe.com/thread/1633660
It is not considered polite to make several different groups of people work independently for you.
Theunis De Jong
MemberStewb,
You’re out of luck, as far as GREP is concerned. Tutorials and references may happily refer to “lines”, but these are not the same kind of line as in InDesign, where the equivalent is “paragraph”. InDesign’s GREP cannot locate the start and end of lines *inside* paragraphs.
It’s possible to write a script that checks for each of these characters, as scripts CAN see individual lines.
Theunis De Jong
Member(Alexey: funny, it seems pages *are* selectable in the latest version! But it’s not necessary to apply a master.)
In the place of “MasterName”, below, fill in the exact name of the master that you want to apply. That is *with* the Prefix and the full name, such as “A-Master”.
var myDocument = app.activeDocument; var myPages = myDocument.pages; var myMaster = myDocument.masterSpreads.item("MasterName"); //change i=0 – for select even; or i=1 – for select odd for (i=0; i<myPages.length; i=i+2) { myPages.appliedMaster = myMaster; } -
AuthorPosts
