Copy link to clipboard
Copied
This script is used to determine if there is already a table header and add a row if there isn't.
Since this script doesn't require the table to be selected in full, I like it.
I found the script to be correct if there is only one table.
However, if there are more than two tables, my cursor is already inside the second table, but mytable still points to the previous table table[0].
//first mytable in the active document
var mytable=app.activeDocument.textFrames[0].parentStory.tables[0]
var firstRow = mytable.rows[0];
//to header and add 1 row;
if (firstRow.rowType !== RowTypes.HEADER_ROW)
{
dupeTopRow(mytable);
mytable.rows.add(LocationOptions.BEFORE, mytable.rows[0]);
}
else{
alert("header exist")
exit ();
}
Copy link to clipboard
Copied
I suspect it looks for all text boxes, and every script in every text box.
By @dublove
Why would you think that?
Copy link to clipboard
Copied
@dublove -- I've mentioned this before, and I'll mention it again, hoping that you'll add it to your list of New Year good intentions.
1. The most important thing for you is to get to grips with InDesign. Get yourself a good reference book. There are books aimed a users of various levels of experience. I would suggest Real-World InDesign. It covers InDesign up to some versions ago but nothing much has been added to InDesign in recent versions that would get people like you -- typesetters -- excited. It's an excellent reference with a good table of contents and an excellent index. You could also consider Linda tutorials, many of which are produced by seasoned InDesign pros.
2. When you can't find something in the book/tutorials, use a search engine to check whether your problem was dealt with in the past. You clearly don't do that. what you raised recently -- about user interaction -- is a sad example. User interaction has been dealt with many times in this forum but also in other forums.
3. Perhaps the best approach for you would be to hire a consultant. Make a deal with someone you can ask questions and ask to write scripts for you. You can learn from such a consultant, and you can also get some script solutions that are tailored to your problem. This is more efficient than trying to adapt other scripts to your needs.
P.
Copy link to clipboard
Copied
The great Peter Kahrel.
You always give me some great ideas.
I'm just a typesetter and I'm pretty clueless about scripting.
I've actually searched through a lot of the postings and you'll see I've left comments under a lot of the old ones.
I'm making a lot of progress these days.
Thank you very much.
Just today I have completed a script worth millions.
I'll try not to ask big questions in the future.
It's all forced by life.
Congratulations on the fortune.
Thank you.