On Tue, Dec 30, 2003 at 04:48:12PM -0700, Rick Lansky wrote:
> My problem is that I have a macro that calls a command and I need to use 
> the results of the command. I know that I can use the '%_' operator to get 
> the results of the previously run command, but the problem is that I don't 
> use the results until several commands later and it is impossible to change 
> the order of the commands. I've tried copying the results of the command 
> into the clipboard but I haven't been able to get that to work. Any 
> suggestions?

I had a similar problem, and was equally stumped until Mr. Shafie
suggested the following solution.  What you can do is encapsulate the
sequence of commands following the command that sets the '%_' variable
within a single new command, and pass the '%_' variable to that command
as a parameter, so that it will be accessible as '%0' for every command
located in the new command.  For example (assuming a default namespace
of http://www.xmlmind.com/xmleditor/schema/configuration):

  <command name="trickyCommand">
    <macro>
      <sequence>
        <command name="somethingThatReturnsACriticalValue"/>
        <command name="intermediary"/>
        <command name="needsValueReturnedByFirstCommand"/>
      </sequence>
    </macro>
  </command>

Would become:

  <command name="wrapper">
    <macro>
      <sequence>
        <command name="intermediary"/>
        <command name="needsValueReturnedByFirstCommand"
        parameter="%0"/>
      </sequence>
    </macro>
  </command>

  <command name="trickyCommand">
    <macro>
      <sequence>
        <command name="somethingThatReturnsACriticalValue"/>
        <command name="wrapper" parameter="'%_'"/>
      </sequence>
    </macro>
  </command>

If the instance of your problem is more complex than this, you might
want to post additional details to the mailing list.

Take care,

    John L. Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20040102/ebdfa2e3/attachment.sig
 

Reply via email to