It is currently March 29th, 2024, 12:49 pm

Yet another method to copy a string into clipboard

Tips and Tricks from the Rainmeter Community
Terrorlone
Posts: 6
Joined: August 15th, 2011, 12:08 pm

Yet another method to copy a string into clipboard

Post by Terrorlone »

I just search the forum and found there're already several methods to copy a string into clipboard, but before I did that, I tried to come up with my own method, and I still prefer mine after read those posts. So I'll share it to you.

First save the following code into a VBS file, say "toCB.vbs" in my case, and put it into the same folder as the skin.

Code: Select all

Dim Form, TextBox
Set Form = CreateObject("Forms.Form.1")
Set TextBox = Form.Controls.Add("Forms.TextBox.1").Object
TextBox.Text = WScript.Arguments.Item(0)
TextBox.SelStart = 0
TextBox.SelLength = TextBox.TextLength
TextBox.Copy
Then, whenever you want to copy a string into clipboard, use the following.

Code: Select all

LeftMouseUpAction=!Execute ["C:\WINDOWS\System32\WScript.exe" "#CURRENTPATH#toCB.vbs" "String to be copied"]
That's it! :welcome:
Smorkster
Posts: 19
Joined: April 30th, 2012, 12:33 pm

Re: Yet another method to copy a string into clipboard

Post by Smorkster »

Thanks for this script, seems much simpler than having to use a separate program :)
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Yet another method to copy a string into clipboard

Post by KreAch3R »

This has been simplified a lot. Use the intergrated !SetClip bang instead.
!SetClip [String]
Copies the specified string to the Windows clipboard.
Rainmeter Manual - !Bangs
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image