It is currently May 25th, 2024, 1:49 pm
Click to copy text?
-
- Posts: 1150
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Click to copy text?
I was wondering if it were possible to click on a string meter in order to copy it's text to the clipboard? Then you can paste that into whatever app you need it in.
- MuLab -
-
- Developer
- Posts: 22634
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Click to copy text?
Yes, but a String meter has no "value". You will need to copy the value from the same measure(s) that the String meter is bound to.
https://docs.rainmeter.net/manual/bangs/#SetClip
Code: Select all
[MeterString]
Meter=String
MeasureName=SomeMeasure
LeftMouseUpAction=[!SetClip "[SomeMeasure]"]
DynamicVariables=1
Code: Select all
LeftMouseUpAction=[!SetClip "[MeasureAdapterDesc]#CRLF#WAN: [MeasureIPWeb]#CRLF#LAN: [MeasureIPLan]#CRLF#Router: [MeasureRouter]"][Play "#@#Sounds\Copy.wav"]
-
- Rainmeter Sage
- Posts: 5417
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Click to copy text?
Use !SetClip and your [##CURRENTSECTION#] variable.
When you click the 'text', this will send your text (the partial code and description) to the clipboard, and prefix it with \x so the pasted item will contain a useable character reference. Of course the description would need to be removed.
Maybe you can find a better way to just get the character code in the clip.
Code: Select all
[sAllText]
FontFace=Trebuchet MS
FontSize=9
FontColor=#Color1#
AntiAlias=1
Text=[##CURRENTSECTION#]
UpdateDivider=-1
X=15R
Y=3r
LeftMouseUpAction=[!SetClip "\x[##CURRENTSECTION#]"]
Maybe you can find a better way to just get the character code in the clip.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 16262
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Click to copy text?
My comment / question has nothing to do with the original request / question, however wondering what are you meaning by [##CURRENTSECTION#]? I saw this variable written this way a few times these days and to be honest can't realize what it is. Seems to be a nesting variable, but it's finally not. So, what is it?eclectic-tech wrote: ↑September 1st, 2021, 10:22 am Use !SetClip and your [##CURRENTSECTION#] variable.Code: Select all
[sAllText] FontFace=Trebuchet MS FontSize=9 FontColor=#Color1# AntiAlias=1 Text=[##CURRENTSECTION#] UpdateDivider=-1 X=15R Y=3r LeftMouseUpAction=[!SetClip "\x[##CURRENTSECTION#]"]
-
- Rainmeter Sage
- Posts: 5417
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Click to copy text?
I had the same thoughts...balala wrote: ↑September 1st, 2021, 10:29 am My comment / question has nothing to do with the original request / question, however wondering what are you meaning by [##CURRENTSECTION#]? I saw this variable written this way a few times these days and to be honest can't realize what it is. Seems to be a nesting variable, but it's finally not. So, what is it?
sl23 is using the #CurrentSection# Name as part of another variable that uses nested syntax in MeterStyle definition.
So if the current section name is [Icon1], [##CURRENTSECTION#] resolves to nested variable syntax of [#Icon1] which is the variable he want to deal with in that section. This lets him use it in a meter style and work with multiple section names.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 1150
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Click to copy text?
Thank you for your help.
@ JSMorley: the skins have no meters so this won't work, but thank you for the tip, I'll try to keep that in mind
@ eclectic-tech: again you saved the day! I'll try this when I get home. Thanks
Oh and thanks for the description on the nested variable, I hadn't a clue what is was doing, I just tried different syntax and got lucky!
Also, I will be using the icon variable to copy from so won't need to adjust anything. That way, it's ready to use in another skin.
@ JSMorley: the skins have no meters so this won't work, but thank you for the tip, I'll try to keep that in mind
@ eclectic-tech: again you saved the day! I'll try this when I get home. Thanks
Oh and thanks for the description on the nested variable, I hadn't a clue what is was doing, I just tried different syntax and got lucky!
Also, I will be using the icon variable to copy from so won't need to adjust anything. That way, it's ready to use in another skin.
Last edited by sl23 on September 1st, 2021, 12:13 pm, edited 2 times in total.
- MuLab -
-
- Developer
- Posts: 22634
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Click to copy text?
It's not really about measures as such. It's just that you need to define whatever text you want in the !SetClip bang, and that can be literal text, any #Variables# that you want, and / or any [SectionVariables] that get values from measures. My only point was to be clear that Meters have no intrinsic "value" of their own.
-
- Posts: 1150
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Click to copy text?
That's good to know. I realised meters don't have a value, hence my question
I didn't even know there was a !SetClip bang. I'm on my phone which can be hard for my eyes to see, so thought I'd pose the question
Thank you for the feedback. Very much appreciated.
I didn't even know there was a !SetClip bang. I'm on my phone which can be hard for my eyes to see, so thought I'd pose the question
Thank you for the feedback. Very much appreciated.
- MuLab -
-
- Rainmeter Sage
- Posts: 16262
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Click to copy text?
Oh, yep, maybe it makes sense this way. Interesting idea...eclectic-tech wrote: ↑September 1st, 2021, 11:06 am sl23 is using the #CurrentSection# Name as part of another variable that uses nested syntax in MeterStyle definition.
So if the current section name is [Icon1], [##CURRENTSECTION#] resolves to nested variable syntax of [#Icon1] which is the variable he want to deal with in that section. This lets him use it in a meter style and work with multiple section names.
-
- Posts: 1150
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Click to copy text?
I tried the code supplied by eclectic-tech above, but when pasted, I just get a strange character instead of the actual text. Any idea on how to fix this?
According to the manual, this is a limited operation. Meaning you can't specify something like:
[!SetClip sAllIcons Text "[##CURRENTSECTION#]"]
Or whatever would be required to set text from the current meter.
Here's what I have in the Style section that activates the copy. I tried the !SetClip at the beginning and here, in the middle to see if the order mattered:
According to the manual, this is a limited operation. Meaning you can't specify something like:
[!SetClip sAllIcons Text "[##CURRENTSECTION#]"]
Or whatever would be required to set text from the current meter.
Here's what I have in the Style section that activates the copy. I tried the !SetClip at the beginning and here, in the middle to see if the order mattered:
Code: Select all
[sAllIcons]
FontFace=Segoe Fluent Icons
FontSize=14
FontColor=#Color1#
AntiAlias=1
Text=[##CURRENTSECTION#]
LeftMouseUpAction=[!EnableMouseAction * "MouseOverAction|MouseLeaveAction"] [!SetClip "[##CURRENTSECTION#]"][!SetVariable Preview [##CURRENTSECTION#]] [!SetOptionGroup Preview FontColor "#Color1#"] [!UpdateMeterGroup Preview] [!SetOption #CURRENTSECTION# FontColor "#Color4#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw] [!DisableMouseAction #CurrentSection# "MouseOverAction|MouseLeaveAction"]
UpdateDivider=-1
DynamicVariables=1
X=185
Y=5R
- MuLab -