This is a simple little plugin that will copy the contents of the Windows Clipboard. Once loaded, the plugin "remembers" any text that is copied to the Windows Clipboard until the skin is unloaded or refreshed. This plugin uses the Parent/Child structure.
Options include:
For Parent measures only:
TextOnly - When TextOnly=1, only text items are copied into the Parent measure. TextOnly=0 is default.
ErrorString - If non-text is copied into the Windows Clipboard, this string is copied into the Parent measure. (An empty string is default)
MaxIndex - This number represents the number of indices that will be available. This is to avoid high memory usage when running the skin for a long period of time. It is recommended to use the same number as indices you plan on referencing. Set this to 0 to only remember the current contents of the clipboard. If you set "MaxIndex=-1", this will remember everything you copy into the clipboard, this is not recommended. MaxIndex=15 is default.
For Child measures only:
ParentName - Represents the name of the Parent measure. Do not include brackets.
For both Parent and Child measures:
Index - Represents the current clipboard contents, or "old" text. Index=0 is default.
Commands:
Commands only work on Parent measures.
Clear - Clears contents of the clipboard. Also clears all indices of the Parent measure.
Usage: !CommandMeasure ParentName Clear
ClearIndex n - Clears index n from the Parent measure. If n=0, the Windows Clipboard is also cleared, also Index=0 of other Parent measures are also cleared.
Usage: !CommandMeasure ParentName "ClearIndex 2"
Copy string - Copies string into the Windows Clipboard.
Usage: !CommandMeasure ParentName "Copy Hello World!" - Removed in version 1.0.1 - use !SetClip instead
CopyIndex n - Copies index n from the Parent measure into the Windows Clipboard.
Usage: !CommandMeasure ParentName "CopyIndex 2"
Warning: When using the Clipboard plugin with a String meter, it is highly recommended that you use a W and H to define its size, otherwise you can use up a lot of screen space to display the entire string - especially when using DynamicWindowSize.
I'd suggest using the SetClipboardViewer function with a listener window for change notifications. With the current implementation, changes may be missed (if the clipboard is altered multiple times between updates).
Nice! I was expecting to use Lua to keep track of the "history," but your built-in solution will probably be more robust (especially with poiru's suggestion).
Question: is there a (functional) difference between !CommandMeasure ParentName "Copy Hello World!" and !SetClip "Hello World!"?
poiru wrote:I'd suggest using the SetClipboardViewer function with a listener window for change notifications. With the current implementation, changes may be missed (if the clipboard is altered multiple times between updates).
True, I did actually realize this when making the plugin, however SetClipboardViewer involves a slightly more complex implementation then what I chose. I will probably update to this method when I get time.
If we get to a point of dropping support for Windows XP, AddClipboardFormatListener is actually the preferred function.
Kaelri wrote:Nice! I was expecting to use Lua to keep track of the "history," but your built-in solution will probably be more robust (especially with poiru's suggestion).
Question: is there a (functional) difference between !CommandMeasure ParentName "Copy Hello World!" and !SetClip "Hello World!"?
Honestly, I had forgotten about !SetClip. But, to answer your question: No, there is not a difference between them as they both use the same function to copy text into the clipboard. So I might drop support for this command.
TextOnly now accepts "0" and "1" instead of "Off" and "On", respectively. This change is to be more consistent with how other "on/off" options work in Rainmeter.
Could this be implemented to use some clipboard sync services? I'd like to be able to sync my clipboard contents between computers and pull it's output through rainmeter. Any clue on how one could do that?