Page 1 of 1

Calling action = alast in a macro.

PostPosted: Mon Jul 31, 2017 7:31 pm
by Jsosnowski
I wrote a test macro which tracks the path and values for the argument 'act' through the menu function and the return value of type 'wanttype' . The menu function includes a 'F1' option for a dummy activity and 'S0' key option for exiting. I discovered that when 'S0' is selected the macro never goes to the action 'alast'. My code for acting on the 'S0' option returns the 'Main' case function result 'wanttype' as 'Xdone' and the macro exits correctly, however, I expected a last loop to call the 'alast' code code section before exiting. The 'wanttype' returned to main is 'xdone' (0). My question is what tells Datacad to enter 'alast' time to perform 'alast' cleanup code?

Re: Calling action = alast in a macro.

PostPosted: Tue Aug 01, 2017 5:30 am
by Mark F. Madura
There are four main sections within DataCAD's state machine.

Section 1: AlSize
This is where DataCAD's state machine allocates memory for your local variables.

Section 2: Afirst
This is where you initialize the local state and other variables. Tasks you
define here will only be performed once.

Section 3: Aagain
This is where DataCAD returns after it has performed an action for you. The
action variable will be equal to Aagain until you set the result to XDone.

Section 4: Alast
If your macro has been interrupted by user action, such as pressing a hotkey,
DataCAD will set the action to Alast to give you the opportunity to clean up any
temporary data before exiting to the new command.

Re: Calling action = alast in a macro.

PostPosted: Tue Aug 01, 2017 8:34 am
by Jsosnowski
Thanks Mark,

I understand the acts but my test macro is not performing an alast loop. As best as I can tell, my menu loop function is written correctly. So my question is what conditions does Datacad look for to invoke the alast act?

Re: Calling action = alast in a macro.

PostPosted: Tue Aug 01, 2017 8:43 am
by Mark F. Madura
Jsosnowski wrote:Thanks Mark,

I understand the acts but my test macro is not performing an alast loop. As best as I can tell, my menu loop function is written correctly. So my question is what conditions does Datacad look for to invoke the alast act?
Press a hotkey that would break you out of the macro and into another menu in DataCAD.

Re: Calling action = alast in a macro.

PostPosted: Tue Aug 01, 2017 8:45 am
by David A. Giesselman
Joe,

Try pressing the "m" key to call the Move menu while in your macro.

Dave

Re: Calling action = alast in a macro.

PostPosted: Tue Aug 01, 2017 10:37 am
by Jsosnowski
OK, that was way to easy!. I assumed alast was called whenever xdone is called. My bad.

Thanks Mark & David.