Fco. Mario Barcala Rodr?guez wrote:
>   I am testing XXE customization, and I have the following problem:
> 
> I have associated this command with ENTER key:
> 
>   <command name="my.insertAfter">
>   <macro>
>     <choice>
>       <sequence>
>         <test expression="not($selected) and not($mark) and
>                           $dotOffset &gt;= 0 and
>                           $dotOffset &lt; string-length($dot)"/>
>         <command name="selectTo" parameter="textNodeEnd"/>
>         <command name="cut" />
>         <command name="selectNode" parameter="self[implicitElement]"/>
>         <command name="insertNode" parameter="sameElementAfter"/>
>         <command name="paste" parameter="into"/>
>       </sequence>
>     </choice>
>   </macro>
>   </command>
> 
> which split a text element at the caret position and paste contents from the
> caret to the end of line in a new element.
> It works fine, but it change the clipboard. I want to get clipboard content
> before executing this command (as the first step) and restore it as the
> final step of it.
> ?Can you help me? ?How can I copy clipboard content into a variable and
> restore it after? ?Is it possible?

The best is to avoid using the clipboard.

Here's a variation on what you did which works without using the clipboard:

---
  <command name="my.insertAfter">
   <macro>
     <choice>
       <sequence>
         <test expression="not($selected) and not($mark) and
                           $dotOffset &gt;= 0 and
                           $dotOffset &lt; string-length($dot)"/>
         <command name="selectTo" parameter="textNodeEnd"/>
         <set variable="chars" expression="$selectedChars" />
         <command name="delete" />
         <command name="selectNode" parameter="self[implicitElement]"/>
         <command name="insertNode" parameter="sameElementAfter"/>
         <get expression="$chars" />
         <command name="paste" parameter="into %_"/>
       </sequence>
     </choice>
   </macro>
  </command>

  <binding>
    <keyPressed code="F2" />
    <command name="my.insertAfter" />
  </binding>
---


Reply via email to