Moving from Microsoft Office VBA to AppleScript:
MacTech's Guide to Making the Transition
Introduction
|
Table of Contents
Page Prev and Page Next buttons at bottom of the page.
|
April, 2007
Page 37
Next Counter
Application.ScreenUpdating = True
End Sub
Here is the AppleScript equivalent. Note that the repeat loop has to be done differently, and backwards, as with a previous example, because we are deleting items. More on this following the script.
tell application "Microsoft Word"
activate
--Specify which table you want to work on
set theTable to table 1 of selection -- or table 1 of active document
set numRows to number of rows of theTable -- faster than counting rows
set screen updating to false
--iterate backwards because deleting!
repeat with i from numRows to 1 by -1
set rowText to text object of row i of theTable
set status bar to "Row " & i
set textInRow to false
--you NEED the explicit gets if not setting variables!
repeat with theCell in (get every cell of rowText)
if (count of (get content of text object of theCell)) > 2 then
-- end of cell marker is 2 characters, count faster than length
set textInRow to true
exit repeat -- no need to check other cells
end if
end repeat
if not textInRow then
delete row 1 of rowText
< Previous Page Next Page>
- SPREAD THE WORD:
- Slashdot
- Digg
- Del.icio.us
- Newsvine