It is currently April 19th, 2024, 9:14 pm

VPN notification

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: VPN notification

Post by balala »

Ivan wrote:I do not understand this
(MeasureNetwork<1)
This is a condition. If it's true (so the value returned by the MeasureNetwork measure is less than 1), the result of (MeasureNetwork<1) condition is 1 (this means true), otherway it's 0 (which means false). But instead of what's there, I'd use this:

Code: Select all

[OnlineStatus]
Measure=Calc
Formula=(MeasureNetwork<1)
IfCondition=(OnlineStatus=0)
IfTrueAction=[!SetOption MeterNetwork FontColor 0,255,0,255]
IfFalseAction=[!SetOption MeterNetwork FontColor 255,0,0,255]
It seems to me more concise.
Ivan wrote:BTW I tried it and it is always green.
For me, it's working: it's green when the network cable is connected and red when it's not.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

VPN connection is Virtual private network. I have to be on internet to be able to connect to VPN, it does not change online status.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: VPN notification

Post by balala »

But the code suggested by drakulaboy is working?
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

it works for turning off my WiFi... but not for turning on VPN.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

I was playing with WAN/LAN meters and I noticed that LAN is changing when I go on VPN.
So question now is how to make skin that will recognize lan ip address and based on that change color of VPN text.
as I move my laptop only fixed lan ip is when i am on VPN so it should actually recognize that one and make text green, and if it is not that one then VPN text have to be red.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

I finnaly have something that make sense... but it does not update as it should. when it update it show both ON and OFF. If I update skin manually then it show only correct text, but as soon as IP change it show both texts... HELP?

Code: Select all

[Rainmeter]
Author=Ivan...http://deivantan.deviantart.com
Update=500
MouseActionCursor=0
BackgroundMode=1
DynamicWindowSize=1

[Metadata]
Name=Skyrim based VPN notification
Description=Skyrim based VPN notification
Instructions=Change IP in MeasureLAN to your IP when you are on VPN.
Version=0.1
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

;........................................................................
;Variables
;........................................................................

[Variables]
FontColorText=888888
FontColorLabel=f2f2f2
FontFace=Papyrus
FontSizeLabel=15
FontSizeText=12
StringEffect=SHADOW
FontEffectColor=3a3a3a

;........................................................................
;Measures
;........................................................................

[MeasureLAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=0
UpdateDivider=5
StringIndex=1
IfMatch=1.1.1.1
IfMatchAction=[!HideMetar Text2][!ShowMeter Text1][!Redraw]
IfNotMatchAction=[!HideMetar Text1][!ShowMeter Text2][!Redraw]

[Text]
Meter=STRING
X=0
Y=0
SolidColor=0,0,0,1
FontFace=#FontFace#
FontSize=20
FontColor=#FontColorText#
StringAlign=LEFT
StringEffect=#StringEffect#
FontEffectColor=#FontEffectColor#
Text="VPN is"
AntiAlias=1

[Text1]
Meter=STRING
X=R
Y=0
SolidColor=0,0,0,1
FontFace=#FontFace#
FontSize=20
FontColor=#FontColorLabel#
StringAlign=LEFT
StringEffect=#StringEffect#
FontEffectColor=#FontEffectColor#
Text="ON"
AntiAlias=1
Hidden=1

[Text2]
Meter=STRING
X=1R
Y=0
SolidColor=0,0,0,1
FontFace=#FontFace#
FontSize=20
FontColor=#FontColorLabel#
StringAlign=LEFT
StringEffect=#StringEffect#
FontEffectColor=#FontEffectColor#
Text="OFF"
AntiAlias=1
Hidden=1
LNK
Posts: 3
Joined: January 31st, 2015, 2:06 pm

Re: VPN notification

Post by LNK »

I've been trying to do this as well, mainly after seeing this post.

My partial working solution -

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,255

[MeasureNetwork]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=0
StringIndex=1
Substitute="default ISP address":"-1","VPN address":"1","VPN address":"1"


[OnlineStatus]
Measure=Calc
Formula=[MeasureNetwork]
IfAboveValue = 0
IfAboveAction=[!SetOption MeterNetwork FontColor 0,255,0,255][!Redraw]
IfBelowValue = 0
IfBelowAction=[!SetOption MeterNetwork FontColor 255,0,0,255][!Redraw]
DynamicVariables=1


[MeterNetwork]
Meter=String
MeasureName=OnlineStatus
FontSize=30
FontColor=0,0,255,255
StringStyle=Bold
AntiAlias=1
Text=VPN
Default ISP address is whatever address you have with the VPN NOT running. Gets a value of -1
VPN address - local IP address the VPN gives you (i.e a good address that says the VPN is up). These all get a value of 1

The "IfAboveAction" and "IfBelowAction" just change the font colour as it flips from -1 (off) to 1 (on) to -1 (off)

It will flip between red and green automatically as I log in and out of my VPN. My VPN software tells me the local IP address it is using, so I can build up the list of "this is a good address, so go green" in [MeasureNetwork]. You might have to play with the value of SysInfoData to find it on your setup.

What I want it to do is go blue when the VPN uses a IP address it hasn't seen before. Not figured that bit out yet. At the moment, a VPN address it hasn't seen before leaves it at red.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

I just noticed that in VPN IP last number is different...

So how to extract first three values from IP address and to compare them with first three values in IP that is set as measure????


123.12.123.xxx to campare with 123.12.123.yyy ???
LNK
Posts: 3
Joined: January 31st, 2015, 2:06 pm

Re: VPN notification

Post by LNK »

I have a similar question, but at the other end. On my VPN, the IP always starts with 10.xxxxx. How can I extract the first part of the string to test it? I've thought of things like Webparser, but you have to give it a front marker to start from, and I don't have one. I think I need something like 'start from position 1, go to the first . and take everything in-between".

Ivan - my "VPN on" and "VPN off" IP addresses are hugely different, not just different in the last set of numbers. I wonder if you are looking at the right thing? (but that could just be how your VPN works - I look at the local IP address I get assigned by the VPN software.).
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: VPN notification

Post by Ivan »

LNK, my ON VPN and OFF VPN are totaly different, but I just log on VPN and last number that was 100 now is 101. Same as your situation :) So I like to extract first 123.12.123.100 or first two 123.12.123.100 sets of numbers for IfMatch.