Re: How to address a table row in Quark?
Re: How to address a table row in Quark?
- Subject: Re: How to address a table row in Quark?
- From: Hans Haesler <email@hidden>
- Date: Tue, 9 Jul 2002 16:28:03 +0200
On Mon, 8 Jul 2002, john mead wrote:
>
Hi - I'm new to scripting Quark tables and want to
>
know how to address particular cells within a table
>
row. When I run the following script on a 3x3 empty
>
table, row 1, cell 2 is populated, but I can't seem to
>
get any other rows (like 2 and 3) to populate their
>
cells.... so the "of table row 2" seems to be going
>
ignored. Anyone know what I'm doing wrong here?
John,
it's not your fault. It is possible to color a certain cell...
---
tell document 1 of application "QuarkXPress 5.0"
tell table box 1
tell text cell 2 of table row 3
set color to "Magenta"
set shade to 20
end tell
end tell
end tell
---
... but when it comes to set the contents of story 1, then the
column / row parameters are not working properly.
I have modified the Script Menu script "Row or Column Color..."
and replaced the setting of the color and shade of every cell
in a row or a column by setting the story 1 to a string.
The string is defined as empty and the character "A" is
concatenated to it on each iteration. The table has 10 columns
and 5 rows.
When selecting "Columns" then the same cells 1 to 5 (the number
of the rows!) of row 1 are "visited" on each iteration.
When selecting "Rows" then the cells 1 to 10 (the number
of the columns!) of row 1 are populated on each iteration.
A workaround: use the values column/row to compute the ID
of the cell and address it directly.
Using my table of 10 by 5, addressing cell 5 of row 3:
---
set colNum to 5
set rowNum to 3
tell document 1 of application "QuarkXPress 5.0"
tell table box 1
set colCnt to count of every table column
set cellNum to ((rowNum - 1) * colCnt) + colNum
tell text cell cellNum
set story 1 to "this bites...."
end tell
end tell
end tell
---
The variables 'colNum' and 'rowNum' can be set by using a dialog.
You should also get the number of cells and alert the user if
the addressed cell doesn't exist.
---
Hans Haesler <email@hidden>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.