It is currently April 24th, 2024, 10:07 pm
Get help with creating, editing & fixing problems with skins
poisonborz
Posts: 10 Joined: November 25th, 2009, 6:52 pm
Post
by poisonborz » January 10th, 2020, 11:20 pm
I have a Measure (MeasurePCCode), that gets its value from a Webparser regexp.
However, I want to modify this in a way that if the computer's name matches with a string, a fixed value should be the result there, not the regexp value. Is it possible to alter a measure's output in this way?
[MeasurePCName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=COMPUTER_NAME
IfMatch=PC1
IfMatchAction=[!SetVariable PCCodeVar 1]
IfMatch2=PC2
IfMatch2=[!SetVariable PCCodeVar 2]
[MeasurePCCode]
Measure=Plugin
Plugin=WebParser
DynamicVariables=1
URL=[PCCode]
StringIndex=1
Or reversed, is it possible to conditionally change the input in another Measure?
Like URL=
https://example.com/search/?q= [&PCCodeVar || MeasurePCCode]
jsmorley
Developer
Posts: 22629 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » January 11th, 2020, 12:08 am
I may not understand exactly, but something like this?
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasurePCName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=COMPUTER_NAME
IfMatch=(?i)TOwER
IfMatchAction=[!SetOption MeasureString String "[*MeasurePCName*]"]
IfNotMatchAction=[!SetOption MeasureString String "[*MeasurePCCode*]"]
[PCCode]
Measure=WebParser
URL=file://#CURRENTPATH#Test.html
RegExp=(?siU)<item>(.*)</item>
[MeasurePCCode]
Measure=Plugin
Plugin=WebParser
URL=[PCCode]
StringIndex=1
DynamicVariables=1
[MeasureString]
Measure=String
String=[MeasurePCCode]
DynamicVariables=1
[MeterString]
Meter=String
MeasureName=MeasureString
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
https://docs.rainmeter.net/manual/variables/#Escape
Test.html:
poisonborz
Posts: 10 Joined: November 25th, 2009, 6:52 pm
Post
by poisonborz » January 13th, 2020, 6:04 pm
Yes, thank you! SetOption was what I was looking for, I previously tried to solve this with variables.
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » January 13th, 2020, 6:32 pm
poisonborz wrote: ↑ January 13th, 2020, 6:04 pm
Yes, thank you! SetOption was what I was looking for, I previously tried to solve this with variables.
Although possible, I doubt it worth:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
MyVariable=0
[MeasurePCName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=COMPUTER_NAME
IfMatch=(?i)TOwER
IfMatchAction=[!SetVariable MyVariable "1"][!UpdateMeasure "MeasureComputerName"]
IfNotMatchAction=[!SetVariable MyVariable "0"][!UpdateMeasure "MeasureComputerName"]
[MeasureComputerName]
Measure=Calc
Formula=#MyVariable#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!SetOption MeasureString String "[*MeasurePCName*]"]
IfFalseAction=[!SetOption MeasureString String "[*MeasurePCCode*]"]
[PCCode]
Measure=WebParser
URL=file://#CURRENTPATH#Test.html
RegExp=(?siU)<item>(.*)</item>
[MeasurePCCode]
Measure=Plugin
Plugin=WebParser
URL=[PCCode]
StringIndex=1
DynamicVariables=1
[MeasureString]
Measure=String
String=[MeasurePCCode]
DynamicVariables=1
[MeterString]
Meter=String
MeasureName=MeasureString
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1