It is currently March 29th, 2024, 1:31 am

Clipboard Code Problem

Get help with creating, editing & fixing problems with skins
levent0119
Posts: 3
Joined: January 10th, 2023, 7:23 am

Clipboard Code Problem

Post by levent0119 »

mouse right and left click I want it to copy the ip address and I want it to notify me when it's copied
can you help me


My code

Code: Select all

[MeterDate1]
Meter=String

MeasureName=MeasureComputerIp

X=5
Y=180
W=700
FontColor=249,251,231
FontFace=Segoe UI
FontSize=15
AntiAlias=1
StringStyle=Bold
Text="Lan Ip:%1"



; MeterDate1
[MeasureComputerIp]
Measure=Plugin
Plugin=Plugins/SysInfo
SysInfoType="IP_ADDRESS"
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clipboard Code Problem

Post by balala »

levent0119 wrote: January 21st, 2023, 12:47 pm mouse right and left click I want it to copy the ip address and I want it to notify me when it's copied
To copy the information add the following option to the [MeterDate1] meter: LeftMouseUpAction=[!SetClip "[MeasureComputerIp]"]. With this option added, the information is copied to clipboard when you click the [MeterDate1] meter.
Te get notified, you either need another meter which is not visible at the beginning and is shown when the address has been copied, or you have to replace what the existing [MeterDate1] meter is showing.
If you prefer the first solution, add the following meter to your code (after [MeterData1]):

Code: Select all

[MeterNotification]
Meter=STRING
X=0r
Y=10R
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Hidden=1
Text=Address copied
This being just an example you can change the options to get the meter looking as you want. Since the meter is hidden (due to its Hidden=1 option), you have to show it when it's the case. for this you have to extend the previously added LeftMouseUpAction option of the [MeterDate1] meter, for instance this way: LeftMouseUpAction=[!SetClip "[MeasureComputerIp]"][!ShowMeter "MeterNotification"][!Redraw]. Finally if you want to keep the notification on screen just for certain amount of seconds, add two more bangs: LeftMouseUpAction=[!SetClip "[MeasureComputerIp]"][!ShowMeter "MeterNotification"][!Redraw][!Delay "5000"][!HideMeter "MeterNotification"][!Redraw]. Note that the red 5000 is the time for which the message is kept on the screen (it is expressed in milliseconds, so 5000 means 5000 milliseconds = 5 seconds).
For the second solution, the above LeftMouseUpAction has to be modified this way: LeftMouseUpAction=[!SetClip "[MeasureComputerIp]"][!SetOption MeterDate1 Text "Address copied"][!UpdateMeter "MeterData1"][!Redraw][!Delay "5000"][!SetOption MeterDate1 Text "Lan Ip: %1"][!UpdateMeter "MeterData1"][!Redraw]. In this case the red part of the option is used to set what the meter shows back to the original value (the IP address) same way as previously, after a well defined time (here 5 seconds again, as described previously).
It's completely up to you which solution do you prefere. Please let me know if you got any of these solutions working as expected.