I am fiddling around with my first Quark script: so far, a single table box is selected and I get its unique id (tableID) and the count for columns and rows. Now, I would like to cycle throug each row and its cell values to concatenat each possible cell value to one big string (separated by tabs chr(9)), then to delete each column after the first column. Finally, I would like to set the value of the (left over) first cell of column one to the value of the big list with the separated values. I just can’t get the syntax to select the value of a single cell. Perhaps, someone could give me a hint in the right direction? Thanks in advance.
This works so far:
--instructions
tell table box id tableID
set columnCount to count of table columns
set rowCount to count of table rows
end tell
--instructions to come
not very slick, but it works Perhaps of use for someone?
tell table box id tableID
--count the table rows and columns
set counterColumn to count of table columns
set counterRow to count of table rows
--check, if this script might have been applied to the selected table before
--script quits, if only one column exists
if (counterColumn = 1) then
display dialog ("Tabelle besteht nur aus einer Spalte - Script wird beendet!") buttons {"OK"} default button 1
else
repeat with rowi from 1 to counterRow
repeat with columni from 1 to counterColumn
if (get text of text cell columni of table row rowi) ≠"" then
set myCellText to myCellText & (get text of text cell columni of table row rowi) & (ASCII character of 9)
end if
end repeat
set text of text cell 1 of table row rowi to myCellText
set columni to 1
set myCellText to ""
end repeat
set rowi to 1
--set width of first column to 63 mm
--actually, this value is fix, may be changed later on set width of table column 1 to "63"
--delete the rest of the columns starting from second col
repeat while counterColumn > 1
delete table column 2
set counterColumn to count of table columns
end repeat
do updates
end if
end tell