It is currently April 23rd, 2024, 2:23 pm

Click to copy text?

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Click to copy text?

Post by sl23 »

Sorry for the confusion, I thought I'd made it clear? :oops:

I always seem to pick the awkward things to do in Rainmeter ! :rofl:

I am not trying to copy the icon, I am trying to copy the string.

So if I click on an icon, it copies the text not the icon. Then that text can be used anywhere.

So is that the answer? To escape the variable using two * ?

Thanks for your help :thumbup:
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Click to copy text?

Post by death.crafter »

sl23 wrote: September 2nd, 2021, 8:17 am Sorry for the confusion, I thought I'd made it clear? :oops:

I always seem to pick the awkward things to do in Rainmeter ! :rofl:

I am not trying to copy the icon, I am trying to copy the string.

So if I click on an icon, it copies the text not the icon. Then that text can be used anywhere.

So is that the answer? To escape the variable using two * ?

Thanks for your help :thumbup:
Actually, the best thing to do is to store the variables as \xmmmm and use it as [#variable#] and use in bang as [*#variable#*]. But I guess you figured that out already.
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Click to copy text?

Post by sl23 »

Not too sure what you mean? :lol:

Currently, I have 100 variables per skin. 1 for each icon- Icon1=[\xE123].
Then in meters.Inc file, I have a left click action - LeftMouseUpAction=[!SetClip "[##CurrentSection#]"]. So do you mean I need to escape the variable with * like this - LeftMouseUpAction=[!SetClip "[*##CurrentSection#*]"]?

Ah, just reread it. I think you mean to have the variables without the square brackets and use the call for them to place the brackets. Then I can escape the variable, is that right?
- MuLab -
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Click to copy text?

Post by jsmorley »

sl23 wrote: September 2nd, 2021, 9:45 am Not too sure what you mean? :lol:

Currently, I have 100 variables per skin. 1 for each icon- Icon1=[\xE123].
Then in meters.Inc file, I have a left click action - LeftMouseUpAction=[!SetClip "[##CurrentSection#]"]. So do you mean I need to escape the variable with * like this - LeftMouseUpAction=[!SetClip "[*##CurrentSection#*]"]?

Ah, just reread it. I think you mean to have the variables without the square brackets and use the call for them to place the brackets. Then I can escape the variable, is that right?
Yes, like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Icon1=\xe756

[MeterOne]
Meter=String
FontSize=30
Text=[#Icon1#]
FontFace=Segoe Fluent Icons
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
LeftMouseUpAction=[!SetClip "[*#Icon1#*]"]
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Click to copy text?

Post by death.crafter »

sl23 wrote: September 2nd, 2021, 9:45 am Not too sure what you mean? :lol:

Currently, I have 100 variables per skin. 1 for each icon- Icon1=[\xE123].
Then in meters.Inc file, I have a left click action - LeftMouseUpAction=[!SetClip "[##CurrentSection#]"]. So do you mean I need to escape the variable with * like this - LeftMouseUpAction=[!SetClip "[*##CurrentSection#*]"]?

Ah, just reread it. I think you mean to have the variables without the square brackets and use the call for them to place the brackets. Then I can escape the variable, is that right?
If you are using vscode or something that has regex substitution, do

find: ^\s*(?!Text[^\w])([^\s]+)\s*=\s*\[(\\x\w{4})\]\s*$
replace: $1=$2

$1, $2 are capture groups in vscode, you code editor might have different syntax
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Click to copy text?

Post by sl23 »

Thank you for clarifying JSMorley.

@ death.crafter: I assume that's a fine and replace for those 1200 variables? :rolmfao:

Well it's probably half that, but thanks I'll take a look when I get time.
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Click to copy text?

Post by death.crafter »

sl23 wrote: September 2nd, 2021, 12:17 pm Thank you for clarifying JSMorley.

@ death.crafter: I assume that's a fine and replace for those 1200 variables? :rolmfao:

Well it's probably half that, but thanks I'll take a look when I get time.
Well, doesn't matter if it's 1200 or 1200k, regex replace can do it in a blink of an eye.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Click to copy text?

Post by balala »

jsmorley wrote: September 2nd, 2021, 9:50 am Yes, like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Icon1=\xe756

[MeterOne]
Meter=String
FontSize=30
Text=[#Icon1#]
FontFace=Segoe Fluent Icons
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
LeftMouseUpAction=[!SetClip "[*#Icon1#*]"]
:o It seems I missed something :o
A while ago escaping variables were done as [#*Icon1*#], not as [*#Icon1#*]. I checked and the [*#Icon1#*] form is definitely working, however I'm not sure why. This probably is something new (to me definitely).
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Click to copy text?

Post by death.crafter »

balala wrote: September 2nd, 2021, 2:26 pm :o It seems I missed something :o
A while ago escaping variables were done as [#*Icon1*#], not as [*#Icon1#*]. I checked and the [*#Icon1#*] form is definitely working, however I'm not sure why. This probably is something new (to me definitely).
Actually what is being escaped here is, [\xe756] as [*\xe756*] to not resolve it to unicode character literal and not [#Icon1#] as [*#Icon1#*]. More like a [*MeasureName*].
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Click to copy text?

Post by balala »

death.crafter wrote: September 2nd, 2021, 2:49 pm Actually what is being escaped here is, [\xe756] as [*\xe756*] to not resolve it to unicode character literal and not [#Icon1#] as [*#Icon1#*]. More like a [*MeasureName*].
:thumbup:
Makes sense. Missed this, so thanks for the info.