This simple plug-in introduces a new string function to CodeRush that allows you to copy text to the clipboard within keyboard templates.
This plug-in introduces a new String Function, CopyToClipboard(), that accepts a single parameter and copies its text to the clipboard.
When this plug-in is installed, you can reference the new function within the Keyboard Template editor. Simply open the template you wish to edit and click the String Function button. The menu similar to the following will appear. Notice the highlighted item, this is your new function.
Selecting the CopyToClipboard item from the menu will update the Template Editor as follows:
Now, what happens when you launch this template? Absolutely nothing; at least, not until you indicate the text to copy to the clipboard.
Suppose you have a text snippet you wish to copy to the clipboard for later use in a keyboard template. You would simply insert the text to be copied between the parentheses in the string function, like so:
%?CopyToClipboard(This is my text sample)%
This copies the text "This is my text sample" to the clipboard for later use. Note that there are no quotes around this text.
Suppose you are working with a string function and you wish to copy the results of it to the clipboard for later use in a keyboard template. Regrettably, it appears that CodeRush for Delphi does not support this functionality. Only literal text can be copied to the clipboard.
Referencing the Text
Now that we have copied the desired text to the clipboard, what do we do with it? The answer is simple. Anywhere you wish the copied text to appear you simply have to drop a Paste Token (see the screen shot below).
Please note that if the text you are copying has an embedded space, you will need to use the Paste Line symbol instead, as below:
Suppose I wanted to make a keyboard template to insert the text of the disclaimer on this page. Rather than entering the following:
I could type this instead:
which gives me the dual benefit of a less-cluttered keyboard template (my repeated text is replaced with a Paste symbol) as well as a value that is returned via the clipboard to Delphi for any further use I may need of it.
Better uses can obviously be made for this plug-in. This simple example is merely meant to outline what can be accomplished with it.
Copyright 2006 Ackerson Software, All Rights Reserved.
Copy To Clipboard
Author: Rich Ackerson
Created: May 20, 2006
Plug-In Type: Standard
Options Page: No
This plug-in is currently supported.
This plug-in is not the property of Developer Express; it is the sole property of its author. As such, Developer Express cannot be held liable for any incidental damages that may be related to the usage of this plug-in.