[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UltraMacros Loop Limitation



msean wrote:
> Hi, I have some UltraMacro routines that call themselves such as:
>
> A:<all : $0 = screen 18,22,5 : if $0 = "Value" then $1 = $0 down sa-B
> else up sa-A>!

To make the macro repeat indefinitely, don't have the macro call
itself. Simply say <rpt> (repeat).  <goto> will go to the next macro
without any danger of looping back at some point. Unless you really
want to come back from SA-B, use <goto>.

A:<all : $1 = screen 18,22,5 : if $1 = "Value" down  goto sa-B
else up rpt>!

To stop the macro, press the Escape key, or ask me how to make the
macro sense that it is done.

And now, to tell you more than you ever wanted to know about macros:

To make it really fancy:

Your macro's screen reading depends on the column width for your
specific specific spreadsheet.   If the column width happens to be
narrower, i.e, less than 10, it will not give you the result you want.
To make it more generic, don't use <screen> to read the screen.  Use
another way to read the cell contents type.

{Of course, you don't need to do this if your column width doesn't
change. I just like to dig deeper, if at all possible.}

With the cursor on each cell, peek bit 7 of memory location $8290. If
bit 7 of peek $8290 is set, the contents of the cell is a value or a
formula. If not, it is a label.  (You can also differentiate further
between a value and a formula, if needed.)

This bit has a label, peek #worktype; so you don't need to remember the
peek or understand about bits.

A:<asp: x=peek #worktype: if x>128 down goto sa-B: else up rpt>!

This is sort of off the top of my head, so anyone feel free to correct
me.

Beverly Cadieux
TEXAS II an International newsletter for users of AppleWorks® 5.1