I'm confused about using $ME in a particular situation. I'd like to write a macro to extract compile switches from a text file and run that macro via $ME from the compile command line. The macro would simply return a string with the necessary compile command line switches. Use of $ME would cause the switches to be substituted on the command line.
Is this a valid use case for $ME, or is $ME only useful in a template?
I'm having trouble getting a proof of concept of this to work. I've written a simple macro that returns a string literal. I then wrote another simple macro that uses macro_tag("$ME<testmacro.lua>"). Finally, I switch to another (empty) document. When I execute the second macro, I get an error on the status line "Database is currently lock. Please try again later!".
Am I doing something wrong or misunderstanding what $ME does? I realize I could write a macro to build the command line, use system to run the compile and hook it to F10, but somehow this seems preferable. This started off as an experiment to figure out how $ME would deal with multiple return values, but it appears now that the return values aren't what's important, only what it does to the current document.
$ME macro tag
I just checked this and sure enough I also get this messageWhen I execute the second macro, I get an error on the status line "Database is currently lock. Please try again later!".

It appears a bug/feature was introduced when code was added to Zeus to ensure access to the tag database (as suggested by the message) is always serialised

This will get fixed in the next Zeus patch

Cheers Jussi
Thanks, Jussi.
Should $ME work as I expect? I've used it in templates, but there the macro is actually writing to the open document, not returning anything. I'm assuming that the returned value will simply replace the $ME tag on the compile command line, just like any other macro tag.
What should happen if the macro returns multiple values? Assuming I return a string containing all the parameters/options I want, I don't really need to use multiple return values, but I'm kind of curious.
Bill Diener
Should $ME work as I expect? I've used it in templates, but there the macro is actually writing to the open document, not returning anything. I'm assuming that the returned value will simply replace the $ME tag on the compile command line, just like any other macro tag.
What should happen if the macro returns multiple values? Assuming I return a string containing all the parameters/options I want, I don't really need to use multiple return values, but I'm kind of curious.
Bill Diener
Should $ME work as I expect?
It should still work in a template. The bug you have found relates to when one Zeus macro tries to run another Zeus macro.
I'll have to double check but I don't think that is the case.I'm assuming that the returned value will simply replace the $ME tag on the compile command line, just like any other macro tag.
What should happen if the macro returns multiple values?
I am pretty sure the Zeus macros can only return a single integer value.
Cheers Jussi
The way this works is the output (i.e. the prints and writes) of the macro that normally end up in the currently active document is redirected to an internal buffer and the macro tag is then assigned this buffer as it's value.I'm assuming that the returned value will simply replace the $ME tag on the compile command line, just like any other macro tag.
So it is not the return value but the macro output that is important

Cheers Jussi
The bug raised in this thread is now be fixed in the latest Zeus patch found here: http://www.zeusedit.com/forum/viewtopic.php?p=4119
Cheers Jussi
Cheers Jussi