Hey,
I've been trying to make a skin, this skin would show Image1 most of the times, but I want it to show a other image when my pc is in a certain IP range, for example 192.168.0.0/24
I can read my IP with sysinfo. When I try to do a if then else nothing seems to work and I've not been able to find much info on how this works in rainmeter, also I've not found how to for example remove the last 3 characters from my string so I could compare it in this if then else ...
If anyone can help me I'd apreciate it.
Kind regards,
Sliph
It is currently May 13th, 2024, 7:55 am
Image depending on IP
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
-
- Developer
- Posts: 22632
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image depending on IP
Something like this would work:
http://rainmeter.net/cms/Measures-Substitute_beta
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureSysInfo]
Measure=Plugin
Plugin=SysInfo.dll
SysInfoType=IP_ADDRESS
UpdateDivider=3600
RegExpSubstitute=1
Substitute="^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$":"\4"
[MeterImage]
Meter=Image
ImageName=#@#Images\[MeasureSysInfo].png
DynamicVariables=1
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
Re: Image depending on IP
This example learned me a few new things, however it wouldn't solve my problem.
Your example takes the last 3 digits of my ip adres, I need the reverse but I guess I'll be able to figure that out myself ... but then I guess I would need a image for every possible combination?
What I'd like to do is have one image for 192.168.0.0/24 and one for the rest ...
Your example takes the last 3 digits of my ip adres, I need the reverse but I guess I'll be able to figure that out myself ... but then I guess I would need a image for every possible combination?
What I'd like to do is have one image for 192.168.0.0/24 and one for the rest ...
-
- Developer
- Posts: 22632
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image depending on IP
So if the range is 0 to 24 one image if 25 or higher then another? Your LAN IP address is presumable always going to be 192.168.0.something, or did you want to detect when you have moved to another router and have a different base address? I'm trying to figure out exactly what you are trying to do.Sliph wrote:This example learned me a few new things, however it wouldn't solve my problem.
Your example takes the last 3 digits of my ip adres, I need the reverse but I guess I'll be able to figure that out myself ... but then I guess I would need a image for every possible combination?
What I'd like to do is have one image for 192.168.0.0/24 and one for the rest ...
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
Re: Image depending on IP
What I'd like to do is show ImageX when my IP is anywhere from 192.168.0.0-192.168.0.254, but ImageY if I'm at 192.168.1.x or 192.168.2.x or 10.x.x.x or ....
Sorry to be confusing with the /24, I use that notation at work. Basicly means the subnet mask is 255.255.255.0 ...
Sorry to be confusing with the /24, I use that notation at work. Basicly means the subnet mask is 255.255.255.0 ...
-
- Developer
- Posts: 22632
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image depending on IP
Sliph wrote:What I'd like to do is show ImageX when my IP is anywhere from 192.168.0.0-192.168.0.254, but ImageY if I'm at 192.168.1.x or 192.168.2.x or 10.x.x.x or ....
Sorry to be confusing with the /24, I use that notation at work. Basicly means the subnet mask is 255.255.255.0 ...
So to be sure I understand, you want ImageX if your IP address starts with 192.168.0 and ImageY if it is anything else.
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
Re: Image depending on IP
That's exactly it.
-
- Developer
- Posts: 22632
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image depending on IP
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureSysInfo]
Measure=Plugin
Plugin=SysInfo.dll
SysInfoType=IP_ADDRESS
UpdateDivider=3600
RegExpSubstitute=1
Substitute="^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$":"\1\2\3"
[MeasureCalc]
Measure=Calc
Formula=[MeasureSysInfo] = 1921680 ? 1 : -1
IfAboveValue=0
IfAboveAction=!SetOption MeterImage ImageName #@#Images\ImageX.png
IfBelowValue=0
IfBelowAction=!SetOption MeterImage ImageName #@#Images\ImageY.png
DynamicVariables=1
[MeterImage]
Meter=Image
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
Re: Image depending on IP
This is perfect!!!
Many many thanks. This is exactly what I wanted.
Many many thanks. This is exactly what I wanted.
-
- Posts: 6
- Joined: June 12th, 2012, 8:16 pm
Re: Image depending on IP
I figured it would be nice if this did the same thing for LAN and Wifi ... so I came up with this ... works fine not sure if there is no better way but this works ...
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureSysInfo]
Measure=Plugin
Plugin=SysInfo.dll
SysInfoData=1
SysInfoType=IP_ADDRESS
UpdateDivider=3600
RegExpSubstitute=1
Substitute="^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$":"\1\2\3"
[MeasureSysInfoLan]
Measure=Plugin
Plugin=SysInfo.dll
SysInfoData=0
SysInfoType=IP_ADDRESS
UpdateDivider=3600
RegExpSubstitute=1
Substitute="^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$":"\1\2\3"
[MeasureCalc]
Measure=Calc
Formula=[MeasureSysInfo] = 102030 ? 1 : -1
IfAboveValue=0
IfAboveAction=!SetOption MeterImage2 ImageTint 255,255,255,255
IfBelowValue=0
IfBelowAction=!SetOption MeterImage2 ImageTint 255,255,255,0
DynamicVariables=1
[MeasureCalcLan]
Measure=Calc
Formula=[MeasureSysInfoLan] = 102030 ? 1 : -1
IfAboveValue=0
IfAboveAction=!SetOption MeterImage ImageName c:\IT1.jpg
IfBelowValue=0
IfBelowAction=!SetOption MeterImage ImageName c:\bg.jpg
DynamicVariables=1
DynamicVariables=1
[MeterImage]
Meter=Image
W=1600
H=860
ImageName=c:\bg.jpg
[MeterImage2]
Meter=Image
W=1600
H=860
ImageName=c:\IT1.jpg
[MeterText]
Meter=String
MeasureName=MeasureSysInfo
X=5
Y=5
W=105
H=15
Text="Result1: %1"
FontColor=#Color2#
DynamicVariables=1
[MeterText2]
Meter=String
MeasureName=MeasureSysInfoLAN
X=5
Y=25
W=105
H=15
Text="Result2: %1"
FontColor=#Color2#
DynamicVariables=1