It is currently April 20th, 2024, 2:17 pm

Add a "Click to Show" toggle for WAN address display

Get help with creating, editing & fixing problems with skins
User avatar
Razwerkz
Posts: 6
Joined: August 29th, 2010, 8:30 am

Add a "Click to Show" toggle for WAN address display

Post by Razwerkz »

Wow, I haven't been around the likes of here since 2012! :o Hello once again, RM Forums!

I've been using this skin since before I was here last time (over a decade!). Modified from Kaelri's "Enigma," originally posted on DeviantArt, this Network Address skin is used to show LAN and WAN information on the desktop.

Now, as you could imagine, having one's IP on their desktop can impose some risks (I almost doxxed myself with a screenshot once), so I come here asking today for help in inserting a feature that will simply hide just the IP information by default (replacing the address with "CLICK TO SHOW"), and toggle it revealed with a click, and then another click to hide it again.

Here is the code:

Code: Select all

;------------------------------------------------------------------------------------------------
; ENIGMA ADDRESS
; Class: Double

[Rainmeter]
Author=Kaelri.LCD@gmail.com
AppVersion=1001000
Update=1000
MiddleMouseDownAction=!RainmeterRefresh #CURRENTCONFIG#

[Metadata]
Name=Enigma Address
Config=Enigma | Taskbar | Network-Address
Description=This skin shows your local-area and wide-area IP addresses.
Version=2.7
Tags=Taskbar | Network
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Preview=#SKINSPATH#Enigma\Resources\Images\Preview.png

[Variables]
@include=#SKINSPATH#Enigma\Resources\Variables\UserVariables.inc

;------------------------------------------------------------------------------------------------
; MEASURES

[MeasureLAN]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS
SysInfoData=0
Substitute="":"ERROR - CHECK CABLE"

[MeasureWAN]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=21600
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
Substitute="":"DISCONNECTED"

;------------------------------------------------------------------------------------------------
; STYLES

[StyleText]
X=40
Y=0
H=15
W=150
FontColor=#Color1#
FontFace=#Font#
FontSize=#Height4#
StringAlign=LEFT
StringStyle=NORMAL
AntiAlias=1

[StyleLabel]
X=r
Y=1r
H=15
W=60
FontColor=#Color2#
FontFace=#Font#
FontSize=#Height2#
StringAlign=RIGHT
StringStyle=NORMAL
AntiAlias=1
Text="%1 |"

;------------------------------------------------------------------------------------------------
; METERS

[Background]
Meter=Image
SolidColor=0,0,0,2
X=25
Y=0
W=30
H=30

[WAN]
Meter=STRING
MeterStyle=StyleText
MeasureName=MeasureWAN

[Label WAN]
Meter=STRING
MeterStyle=StyleLabel
Text="WAN |"

[LAN]
Meter=STRING
MeterStyle=StyleText
MeasureName=MeasureLAN
Y=15

[Label LAN]
Meter=STRING
MeterStyle=StyleLabel
Text="LAN |"
I appreciate anything you all might have to offer.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Add a "Click to Show" toggle for WAN address display

Post by SilverAzide »

Razwerkz wrote: March 12th, 2023, 1:09 am Wow, I haven't been around the likes of here since 2012! :o Hello once again, RM Forums!

I've been using this skin since before I was here last time (over a decade!). Modified from Kaelri's "Enigma," originally posted on DeviantArt, this Network Address skin is used to show LAN and WAN information on the desktop.

Now, as you could imagine, having one's IP on their desktop can impose some risks (I almost doxxed myself with a screenshot once), so I come here asking today for help in inserting a feature that will simply hide just the IP information by default (replacing the address with "CLICK TO SHOW"), and toggle it revealed with a click, and then another click to hide it again.

Here is the code:

I appreciate anything you all might have to offer.
Since you've modified the original, please post the entire skin. There's not enough here to tell you anything.
Gadgets Wiki GitHub More Gadgets...
User avatar
Razwerkz
Posts: 6
Joined: August 29th, 2010, 8:30 am

Re: Add a "Click to Show" toggle for WAN address display

Post by Razwerkz »

SilverAzide wrote: March 12th, 2023, 6:10 am Since you've modified the original, please post the entire skin. There's not enough here to tell you anything.
Here you go.

Edit: Here's the full Enigma suite, as I have it, in case more information than above is required.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Add a "Click to Show" toggle for WAN address display

Post by balala »

Razwerkz wrote: March 12th, 2023, 6:17 am Here you go.

Edit: Here's the full Enigma suite, as I have it, in case more information than above is required.
I think the posted code is perfectly enough, no need to get the whole skin.
I sincerely hope SilverAzide doesn't mind if I post a quick (and hoping easy enough) solution. So I'd this the following way:
  • Add a variable to the [Variables] section, for instance RegExpSub=1.
  • The original substitution, done on the [MeasureWAN] measure has to be extended. Add the following RegExpSubstitute and DynamicVariables options and alter the existing Substitute option of the [MeasureWAN] measure, as it follows:

    Code: Select all

    [MeasureWAN]
    ...
    RegExpSubstitute=#RegExpSub#
    Substitute="\d{1,4}\.\d{1,4}\.\d{1,4}\.\d{1,4}":"Click to show","":"DISCONNECTED"
    DynamicVariables=1
    Don't modify the other options of the measure.
  • Finally, add the following two options to the meter you'd like to click, to get the address revealed (probably one of the best meters for doing this, is the [WAN] meter, but it's your decision which one to use - in the following example, this is the one I used):

    Code: Select all

    [WAN]
    ...
    DynamicVariables=1
    LeftMouseUpAction=[!SetVariable RegExpSub "(1-#RegExpSub#)"][!UpdateMeasure "MeasureWAN"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
    An extremely important detail here is to make sure to add the DynamicVariables=1 option, besides LeftMouseUpAction, because if you miss it, the meter will react only to the first click.
And one more thing, which not too much to do with the question (well, in fact it has nothing to do with it), but had to say: even if not forbidden, it's not a good idea either to use spaces in section names. Can give you lot of headaches, so recommend to remove them. I'm talking about the [Label WAN] and [Label LAN] meters.
User avatar
Razwerkz
Posts: 6
Joined: August 29th, 2010, 8:30 am

Re: Add a "Click to Show" toggle for WAN address display

Post by Razwerkz »

balala wrote: March 12th, 2023, 7:10 am [...] a quick (and hoping easy enough) solution [...]
Thank you, this works perfectly. A quick and easy edit to the main INI.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Add a "Click to Show" toggle for WAN address display

Post by balala »

Razwerkz wrote: March 12th, 2023, 7:21 am Thank you, this works perfectly. A quick and easy edit to the main INI.
Glad to help. Hope once again SilverAzide doesn't mind I posted a solution in meantime.