Manuel Collado wrote:
> I've recently discovered the 'execute' command that allows command test 
> and debugging. It works quite well, but I have a couple of questions 
> about it. I'm using the following code in 'customize.xxe'
> 
>   <command name="testCommand">
>     <macro>
>       <choice>
>         <sequence>
>           <command name="execute" />
>           <command name="alert" parameter="Return: [%_]" />
>         </sequence>
>         <command name="alert" parameter="Failed" />
>       </choice>
>     </macro>
>   </command>
> 
>   <binding>
>     <keyPressed code="E" modifiers="ctrl" />
>     <command name="testCommand" />
>   </binding>
> 
> 1.- If the command doesn't return a value, the alert message displays a 
> literal '%_' instead of an empty string. Is that the intended behaviour?

Yes. The rationale is to make a difference between no result at all and 
a result which is the empty string.

Is this behavior the most sensible one? Well, I don't know. If you think 
it is not the right behavior, do not hesitate to explain us why.




> 2.- The "Failed" alert message is never got. Again, is that the intended 
> behaviour?

Yes, <choice>A B</choice> means try to execute A.

If A can be executed, choice is done.

Otherwise, try to execute B.



> If so, is there a way to know if the command fails or not?

To make it simple, a command does not fail. It can be executed given 
current context or it cannot be executed.

"alert 'Failed'" would be executed if sequence "execute+alert" cannot be 
executed.

This never the case: sequence "execute+alert" can *always* be executed 
because "execute", without any parameter, can be executed whatever is 
the context.


Reply via email to