It is currently April 19th, 2024, 10:43 am

Conditional Images? Is This Possible?

Get help with creating, editing & fixing problems with skins
tjhuntley
Posts: 17
Joined: December 2nd, 2019, 3:10 pm

Re: Conditional Images? Is This Possible?

Post by tjhuntley »

Thanks. I don't know much about the code but again, I am learning from you guys. I tried to replace this:

[

Code: Select all

[MeasureActive1]
Measure=Calc
Formula=#CurrentFeed#=1
DynamicVariables=1
Group=FeedData | Tab2
Disabled=1
With what Yincognito sent. I also tried what balala said but I feel like I am doing something wrong. After trying to figure it out I thought maybe the feed was part of the problem, and I think it was but there has to be another. My feed wasn't a pure number. Instead of "1400" and "0" the feed was actually "$1400.00" and "$0". I changed the feed to 1400 and tried everything again but I am still getting the original White Gcal.W.png. I added the Gcal.R.png to the same folder, but can't figure out what I am doing wrong.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Conditional Images? Is This Possible?

Post by Yincognito »

tjhuntley wrote: March 28th, 2020, 10:20 am Thanks. I don't know much about the code but again, I am learning from you guys. I tried to replace this:

[

Code: Select all

[MeasureActive1]
Measure=Calc
Formula=#CurrentFeed#=1
DynamicVariables=1
Group=FeedData | Tab2
Disabled=1
With what Yincognito sent. I also tried what balala said but I feel like I am doing something wrong. After trying to figure it out I thought maybe the feed was part of the problem, and I think it was but there has to be another. My feed wasn't a pure number. Instead of "1400" and "0" the feed was actually "$1400.00" and "$0". I changed the feed to 1400 and tried everything again but I am still getting the original White Gcal.W.png. I added the Gcal.R.png to the same folder, but can't figure out what I am doing wrong.
I see now what is wrong with it. It's not about my code (which was tested against [MeasureActive1] using a reddish image, so I know it works) or balala's. You need to tell us exactly what measure provides those "$1400.00" and "$0" values. In other words, what measure you want to test against that 0 value and stuff.

To do that, in case you don't know it yet, you open Manage Rainmeter -> Open Log, choose the Skins tab and click on Google Calendar to the left. On the right side of the window you'll see a list of measures and variables in your skin. Tell us the name of the measure (or variable, maybe?) that yields those "$1400.00" and "$0" values.

Bottom line, my code works if the measure you want to test is indeed [MeasureActive1], but if you're talking about the value of another measure entirely, then the code will obviously not produce the expected results. It's just a matter of attaching those 3 last lines in the code I posted to the correct measure. The "$" and decimals issue is easy to solve: instead of an IfCondition you'd use an IfMatch, to test the string value of the desired measure.

Preview of currently working code for [MeasureActive1]:
Red Google Calendar.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by Yincognito on March 28th, 2020, 11:30 am, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Conditional Images? Is This Possible?

Post by Yincognito »

balala wrote: March 28th, 2020, 9:46 am Another possible approach to apply different colors to an image is to recolor the image through ColorMatrix options. Not a simple and obvious possibility, but it is one.
Yes, indeed. In this case, more than any other, there are a million ways to achieve the desired result. Rainmeter provides a lot of ways of altering colors in a meter or an image, and there is also the possibility of changing the ImageName option, so lots of ways to eat a cookie, so to speak. :)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Images? Is This Possible?

Post by balala »

tjhuntley wrote: March 28th, 2020, 10:20 am but can't figure out what I am doing wrong.
The easiest way we to help you, is to pack the whole config you have and upload the resulting package. This way we'd have all needed files in order to can test the skin (for instance Reader.lua, Tabs.lua and the image which has to be recolored). Beside this, Yincognito is right when he says that:
Yincognito wrote: March 28th, 2020, 11:12 am You need to tell us exactly what measure provides those "$1400.00" and "$0" values. In other words, what measure you want to test against that 0 value and stuff.
No one will figure out which is the measure we should work with, especially that we can't test your code.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Conditional Images? Is This Possible?

Post by Yincognito »

balala wrote: March 28th, 2020, 12:35 pmThis way we'd have all needed files in order to can test the skin (for instance Reader.lua, Tabs.lua and the image which has to be recolored).
I already mentioned what skin the OP is using, it's Google Calendar. The Lua files are there, in the skin (i.e. @Resources\Measures folder). Or, are you talking about the modifications he made to those files? Cause, you know, I doubt the OP made any modification to the Lua files, since he's a beginner in Rainmeter code in the first place, let alone Lua...

Just trying to understand how not having those files (even though they exist in the skin, probably unaltered) is preventing debugging the OP's process. I may be missing something here, maybe?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Images? Is This Possible?

Post by balala »

Yincognito wrote: March 28th, 2020, 12:45 pm I already mentioned what skin the OP is using, it's Google Calendar. The Lua files are there, in the skin (i.e. @Resources\Measures folder). Or, are you talking about the modifications he made to those files? Cause, you know, I doubt the OP made any modification to the Lua files, since he's a beginner in Rainmeter code in the first place, let alone Lua...
Oh, sorry, I missed this detail in meantime. Yep, now I we have the skin to test. Yes, I also believe there are no relevant modifications.
But the same question what both you and me have asked is still there: what is the measure we should work with? Can't identify it...
Yincognito wrote: March 28th, 2020, 12:45 pm Just trying to understand how not having those files (even though they exist in the skin, probably unaltered) is preventing debugging the OP's process. I may be missing something here, maybe?
Because before identifying the skin (after reading your reply), had no idea about how the skin is working. Saw the Script measures with the .lua files and thought they are needed to can work with the skin and could identify the measure which we have to work with. And they indeed are, right?
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Conditional Images? Is This Possible?

Post by Yincognito »

balala wrote: March 28th, 2020, 1:17 pm Oh, sorry, I missed this detail in meantime. Yep, now I we have the skin to test. Yes, I also believe there are no relevant modifications.
But the same question what both you and me have asked is still there: what is the measure we should work with? Can't identify it...

Because before identifying the skin (after reading your reply), had no idea about how the skin is working. Saw the Script measures with the .lua files and thought they are needed to can work with the skin and could identify the measure which we have to work with. And they indeed are, right?
Yes, the question is still there, indeed. I'm not sure we could identify the measure producing the values the OP wants to be tested, as none of those measures are yielding something close to "$1400.00" and such. Unless, of course, he added some events in his actual (i.e. the online service, not the skin) Google calendar (that the Lua measures may be retrieving), along the lines of "Today, 28.03.2020, I have to give my employee John his income of $1400.00 and thank him for the good job he's done" (just an example)...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Images? Is This Possible?

Post by balala »

Yincognito wrote: March 28th, 2020, 1:36 pm Yes, the question is still there, indeed. I'm not sure we could identify the measure producing the values the OP wants to be tested, as none of those measures are yielding something close to "$1400.00" and such. Unless, of course, he added some events in his actual (i.e. the online service, not the skin) Google calendar (that the Lua measures may be retrieving), along the lines of "Today, 28.03.2020, I have to give my employee John his income of $1400.00 and thank him for the good job he's done" (just an example)...
Yep, we'll have to wait for his reply, to let us know the relevant detail...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Conditional Images? Is This Possible?

Post by eclectic-tech »

tjhuntley wrote: March 25th, 2020, 11:58 am I guess I should have said calendar because I am doing a workaround to get the spreadsheet's info onto my desktop. I am using Google Sheets and sending the info to my Google Calendar and then I have modified the Gcal meter to get the info.

That is EXACTLY what I need above. I have tried to add this to my existing code but I have limited knowledge of Rainmeter and how it works. If you have time, maybe you can tell me if there is something in my code preventing this from changing to red when the value goes above zero... Here is the code I am using:

Code: Select all

[Rainmeter]
MiddleMouseUpAction=!Refresh
LeftMouseDoubleClickAction=!ActivateConfig #CURRENTCONFIG#

[Variables]



;-----------------------
; FEEDS

; GoogleCalendar1=https://calendar.google.com/calendar/ical/.../full.ics
GoogleCalendar1=https://calendar.google.com/calendar/ical/cduyrrt80kkabc123abc123abc123%33group.calendar.google.com/private-31555abv67yyyyabc123abc123abc123/basic.ics

;--------------------------------------------------------------------------------------------


; ENIGMA DARK

Color1=255,255,255
Color2=#Color1#,160
Color3=#Color1#,108
Color4=#Color1#,25
ColorLink=128,192,255
ColorLink2=#ColorLink#,217
ColorLink3=#ColorLink#,160
ColorBorder=192, 192, 192
ColorBorder2=#ColorBorder#, 128
ColorBorder3=#ColorBorder#, 92
ColorBorder4=#ColorBorder#, 64
ColorPanel=24,24,24
ColorPanel2=#ColorPanel#,128
ColorFilter=0,0,0
ColorFilter2=#ColorFilter#,192
ColorFilter3=#ColorFilter#,128
ColorEvent=255,0,0
ColorEvent2=#ColorEvent#,92
ColorTransparent=0,0,0,2
ColorImage=W


Size1=23
Size4=11
Size3=9
Size2=10
Font=Open Sans
SkinBackgroundAlpha=0
HideBordersTop=1
HideBordersBottom=1

SidebarWidth=275
SidebarSpacingFixed=1
SidebarAlpha=128
SidebarImage=#@#Images\Sidebar\SidebarLeft.#ColorImage#.jpg
SecondSidebarImage=#@#Images\Sidebar\SidebarRight.#ColorImage#.jpg

;-----------------------
; GENERAL

TriptychInterval=30
TriptychDisabled=0
ProcessInterval=5

SkinMouseOver=0
Reset=1
SwitcherInterval=30
SwitcherDisabled=0
SwitcherInterval=#TriptychInterval#
SwitcherAction=!CommandMeasure "MeasureScriptReader" "ShowNext()"
SwitcherDisabled=#TriptychDisabled#

GoogleCalendarWriteEvents=0
CurrentFeed=1

; 1~3 tabs
NumberOfTabs=1
; 1~8 items
NumOfItems=8
ReaderURL1=#GoogleCalendar1#?futureevents=true&singleevents=true&orderby=starttime&sortorder=a
ReaderURL2=#GoogleCalendar2#?futureevents=true&singleevents=true&orderby=starttime&sortorder=a
ReaderURL3=#GoogleCalendar3#?futureevents=true&singleevents=true&orderby=starttime&sortorder=a
ReaderUpdateRate=60
ReaderWriteEvents=#GoogleCalendarWriteEvents#
ReaderEventFile=#@#User\Calendars\GoogleCalendar1.xml|#@#User\Calendars\GoogleCalendar2.xml|#@#User\Calendars\GoogleCalendar3.xml

FeedTitle=Loading...
Item1Title=
Item1Date=



; WebParserSubstitute="<![CDATA[":"","]]>":"","/PRE&gt;":"","PRE&gt;":"","&nbsp;":" ","'s Facebook Notifications":"","Top Stories - Google ":""

; Alternate substitution
WebParserSubstitute="<![CDATA[":"","]]>":"","/PRE&gt;":"","PRE&gt;":"","&nbsp;":" ","'s Facebook Notifications":"","Top Stories - Google ":"","&quot;":'"',"&amp;":"&","&apos;":"'","&lt;":"<","&gt;":">","&nbsp;":" ","&iexcl;":"¡","&cent;":"¢","&pound;":"£","&curren;":"¤","&yen;":"¥","&brvbar;":"¦","&sect;":"§","&uml;":"¨","&copy;":"©","&ordf;":"ª","&laquo;":"«","&not;":"¬","&shy;":" ","&reg;":"®","&macr;":"¯","&deg;":"°","&plusmn;":"±","&sup2;":"²","&sup3;":"³","&acute;":"´","&micro;":"µ","&para;":"¶","&middot;":"·","&cedil;":"¸","&sup1;":"¹","&ordm;":"º","&raquo;":"»","&frac14;":"¼","&frac12;":"½","&frac34;":"¾","&iquest;":"¿","&Agrave;":"À","&Aacute;":"Á","&Acirc;":"Â","&Atilde;":"Ã","&Auml;":"Ä","&Aring;":"Å","&AElig;":"Æ","&Ccedil;":"Ç","&Egrave;":"È","&Eacute;":"É","&Ecirc;":"Ê","&Euml;":"Ë","&Igrave;":"Ì","&Iacute;":"Í","&Icirc;":"Î","&Iuml;":"Ï","&ETH;":"Ð","&Ntilde;":"Ñ","&Ograve;":"Ò","&Oacute;":"Ó","&Ocirc;":"Ô","&Otilde;":"Õ","&Ouml;":"Ö","&times;":"×","&Oslash;":"Ø","&Ugrave;":"Ù","&Uacute;":"Ú","&Ucirc;":"Û","&Uuml;":"Ü","&Yacute;":"Ý","&THORN;":"Þ","&szlig;":"ß","&agrave;":"à","&aacute;":"á","&acirc;":"â","&atilde;":"ã","&auml;":"ä","&aring;":"å","&aelig;":"æ","&ccedil;":"ç","&egrave;":"è","&eacute;":"é","&ecirc;":"ê","&euml;":"ë","&igrave;":"ì","&iacute;":"í","&icirc;":"î","&iuml;":"ï","&eth;":"ð","&ntilde;":"ñ","&ograve;":"ò","&oacute;":"ó","&ocirc;":"ô","&otilde;":"õ","&ouml;":"ö","&divide;":"÷","&oslash;":"ø","&ugrave;":"ù","&uacute;":"ú","&ucirc;":"û","&uuml;":"ü","&yacute;":"ý","&thorn;":"þ","&yuml;":"ÿ","&OElig;":"Œ","&oelig;":"œ","&Scaron;":"Š","&scaron;":"š","&Yuml;":"Ÿ","&fnof;":"ƒ","&circ;":"ˆ","&tilde;":"˜","&Alpha;":"?","&Beta;":"?","&Gamma;":"G","&Delta;":"?","&Epsilon;":"?","&Zeta;":"?","&Eta;":"?","&Theta;":"T","&Iota;":"?","&Kappa;":"?","&Lambda;":"?","&Mu;":"?","&Nu;":"?","&Xi;":"?","&Omicron;":"?","&Pi;":"?","&Rho;":"?","&Sigma;":"S","&Tau;":"?","&Upsilon;":"?","&Phi;":"F","&Chi;":"?","&Psi;":"?","&Omega;":"O","&alpha;":"a","&beta;":"ß","&gamma;":"?","&delta;":"d","&epsilon;":"e","&zeta;":"?","&eta;":"?","&theta;":"?","&iota;":"?","&kappa;":"?","&lambda;":"?","&mu;":"µ","&nu;":"?","&xi;":"?","&omicron;":"?","&pi;":"p","&rho;":"?","&sigmaf;":"?","&sigma;":"s","&tau;":"t","&upsilon;":"?","&phi;":"f","&chi;":"?","&psi;":"?","&omega;":"?","&thetasym;":"?","&upsih;":"?","&piv;":"?","&ensp;":" ","&emsp;":" ","&thinsp;":" ","&zwnj;":" ","&zwj;":" ","&lrm;":" ","&rlm;":" ","&ndash;":"–","&mdash;":"—","&lsquo;":"‘","&rsquo;":"’","&sbquo;":"‚","&ldquo;":"“","&rdquo;":"”","&bdquo;":"„","&dagger;":"†","&Dagger;":"‡","&bull;":"•","&hellip;":"…","&permil;":"‰","&prime;":"'","&Prime;":"?","&lsaquo;":"‹","&rsaquo;":"›","&oline;":"?","&frasl;":"/","&euro;":"€","&image;":"I","&weierp;":"P","&real;":"R","&trade;":"™","&alefsym;":"?","&larr;":"?","&uarr;":"?","&rarr;":"?","&darr;":"?","&harr;":"?","&crarr;":"?","&lArr;":"?","&uArr;":"?","&rArr;":"?","&dArr;":"?","&hArr;":"?","&forall;":"?","&part;":"?","&exist;":"?","&empty;":"Ø","&nabla;":"?","&isin;":"?","&notin;":"?","&ni;":"?","&prod;":"?","&sum;":"?","&minus;":"-","&lowast;":"*","&radic;":"v","&prop;":"?","&infin;":"8","&ang;":"?","&and;":"?","&or;":"?","&cap;":"n","&cup;":"?","&int;":"?","&there4;":"?","&sim;":"~","&cong;":"?","&asymp;":"˜","&ne;":"?","&equiv;":"=","&le;":"=","&ge;":"=","&sub;":"?","&sup;":"?","&nsub;":"?","&sube;":"?","&supe;":"?","&oplus;":"?","&otimes;":"?","&perp;":"?","&sdot;":"·","&vellip;":"?","&lceil;":"?","&rceil;":"?","&lfloor;":"?","&rfloor;":"?","&lang;":"<","&rang;":">","&loz;":"?","&spades;":"?","&clubs;":"?","&hearts;":"?","&diams;":"?"


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

[StyleReaderText]
;*SLIDES TEXT LEFT AND RIGHT*
Meter=String
StringAlign=Center
X=37
ClipString=1
StringStyle=NORMAL
FontColor=#Color1#
FontSize=#Size3#
FontFace=#Font#
AntiAlias=1
DynamicVariables=1


[StyleReaderTextSubheading]
;*CHANGE LINE SPACING*
Y=23r
;*ITALIC OR BOLD*
StringStyle=NORMAL
[StyleReaderTextFirst]
;*SLIDES ALL TEXT UP AND DOWN*
Y=47

[StyleReaderSubtext]
X=22
Y=14r
H=14
W=(#SidebarWidth#-34)
ClipString=1
StringStyle=NORMAL
FontColor=#Color2#
FontSize=#Size4#
FontFace=#Font#
AntiAlias=1
ToolTipWidth=#SidebarWidth#
DynamicVariables=1


;-----------------------
; GRABBERS

[StyleReaderGrabber]
X=R
Y=r
H=15
W=15
DynamicVariables=1

[StyleReaderGrabberFirst]
X=(#SidebarWidth#-(#NumberOfTabs#*15)-10)
Y=-7r

[StyleReaderGrabber0]
ImageName=#@#Images\Grabber.#ColorImage#.png
ImageAlpha=128
ToolTipWidth=#SidebarWidth#
ToolTipText=Click to switch to this page.

[StyleReaderGrabber1]
ImageName=#@#Images\GrabberActive.#ColorImage#.png

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

;-----------------------

[MeasureScriptReader]
Measure=Script
ScriptFile="#@#Measures\Reader.lua"
MeasureName=MeasureFeed1
MinItems=#NumOfItems#
WriteEvents=#ReaderWriteEvents#
EventFile=#ReaderEventFile#
FinishAction=[!UpdateMeasureGroup "FeedData"][!UpdateMeterGroup "FeedData"][!Redraw][!SetVariable Reset 0]

[MeasureActivateTabs]
Measure=Script
ScriptFile=#@#Measures\Tabs.lua
UpdateDivider=-1
Type=Reader
TotalTabs=1

[MeasureFeed1]
Measure=Plugin
Plugin=WebParser
UpdateRate=#ReaderUpdateRate#
URL=#ReaderURL1#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
FinishAction=!CommandMeasure MeasureScriptReader Refresh(1)

[MeasureFeed2]
Measure=Plugin
Plugin=WebParser
UpdateRate=#ReaderUpdateRate#
URL=#ReaderURL2#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
FinishAction=!CommandMeasure MeasureScriptReader Refresh(2)
Group=Tab2
Disabled=1

[MeasureFeed3]
Measure=Plugin
Plugin=WebParser
UpdateRate=#ReaderUpdateRate#
URL=#ReaderURL3#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
FinishAction=!CommandMeasure MeasureScriptReader Refresh(3)
Group=Tab3
Disabled=1

[MeasureActive1]
Measure=Calc
Formula=#CurrentFeed#=1
DynamicVariables=1
Group=FeedData | Tab2
Disabled=1

[MeasureActive2]
Measure=Calc
Formula=#CurrentFeed#=2
DynamicVariables=1
Group=FeedData | Tab2
Disabled=1

[MeasureActive3]
Measure=Calc
Formula=#CurrentFeed#=3
DynamicVariables=1
Group=FeedData | Tab3
Disabled=1

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

[Background]
Meter=IMAGE
ImageName=#@#Images\SkinBackground.#ColorImage#.png
ScaleMargins=12,12,12,12
ImageAlpha=1
MouseOverAction=[!SetOption #CURRENTSECTION# ImageAlpha #SkinBackgroundAlpha#][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageAlpha 1][!UpdateMeter #CURRENTSECTION#][!Redraw]
W=#SidebarWidth#
H=(39 * #NumOfItems#)

[Border]
Meter=IMAGE
SolidColor=#ColorBorder4#
X=10
Y=0
W=(#SidebarWidth#-26)
H=1
Hidden=#HideBordersTop#

[Icon]
Meter=IMAGE
Group=FeedData
ImageName=#@#Images\Gcal.#ColorImage#.png
X=0
Y=6
W=73
H=73


[Title]
Meter=STRING
Group=FeedData
X=11
Y=28
H=15
W=(#SidebarWidth#-0)
ClipString=1
StringStyle=NORMAL
FontColor=#Color1#
FontSize=#Size3#
FontFace=#Font#
AntiAlias=1
ToolTipWidth=#SidebarWidth#
DynamicVariables=1
Text=#FeedTitle#
LeftMouseUpAction=["https://docs.google.com/spreadsheets/d/1234567890abcdefghijklmnopqrstuvwxyzebrasarecool"]
ToolTipText=#FeedLink#

;-----------------------
; ITEMS

[ItemWhat1]
Meter=STRING
Group=FeedData
MeterStyle=StyleReaderText | StyleReaderTextSubheading | StyleReaderTextFirst
Text=#Item1Title#



;-----------------------
; BORDER & GRABBERS

[BorderBottom]
Meter=IMAGE
SolidColor=#ColorBorder4#
X=10
Y=40r
W=(#SidebarWidth#-26)
H=1
Hidden=#HideBordersBottom#

[Grabber1]
Meter=IMAGE
MeterStyle=StyleReaderGrabber | StyleReaderGrabber[MeasureActive1] | StyleReaderGrabberFirst
LeftMouseUpAction=!CommandMeasure "MeasureScriptReader" "Show(1)"
Group=FeedData | Tab2
Hidden=1

[Grabber2]
Meter=IMAGE
MeterStyle=StyleReaderGrabber | StyleReaderGrabber[MeasureActive2]
LeftMouseUpAction=!CommandMeasure "MeasureScriptReader" "Show(2)"
Group=FeedData | Tab2
Hidden=1

[Grabber3]
Meter=IMAGE
MeterStyle=StyleReaderGrabber | StyleReaderGrabber[MeasureActive3]
LeftMouseUpAction=!CommandMeasure "MeasureScriptReader" "Show(3)"
Group=FeedData | Tab3
Hidden=1

[Switcher]
Measure=CALC
Formula=((Switcher+1-#SkinMouseOver#) % (#SwitcherInterval#+2)) * #Reset#
IfBelowValue=1
IfBelowAction=!SetVariable Reset 1
IfAboveValue=#SwitcherInterval#
IfAboveAction=#SwitcherAction#
DynamicVariables=1
Disabled=#SwitcherDisabled#



;---------------------------------------------------------------------
; METADATA

[Metadata]
Name=Google Calendar
Information=Shows upcoming events on your Google Calendars in rotating tabs. Based on Enigma GCal by Kaelri
Version=5.0
License=Creative Commons BY-NC-SA 3.0
You have only 1 text item showing [ItemWhat1] and that text value is #Item1Title# coming from the Reader.lua script. The color of the icon is based on the Enigma theme colors ('W' or 'B'), so you will need to tint the icon rather than change it's color.

To change the icon color, you can add GreyScale=1 and ImageTint=255,255,255 to the the [Icon] image meter.
Then create a new String Measure [MeasureItemWhat1] to test the value of #Item1Title#.
If it is not 0, set the [Icon] option for ImageTint to RED (255,0,0), otherwise the ImageTint is set to WHITE (255,255,255).

Code: Select all

; Modify:
[Icon]
Meter=IMAGE
Group=FeedData
ImageName=#@#Images\Gcal.#ColorImage#.png
X=0
Y=6
W=73
H=73
GreyScale=1
ImageTint=255,255,255

; Add:
[MeasureItemWhat1]
Measure=String
String=#Item1Title#
IfMatch=^0$
IfMatchAction=[!SetOption Icon ImageTint "255,255,255"][!UpdateMeter Icon][!Redraw]
IfNotMatchAction=[!SetOption Icon ImageTint "255,0,0"][!UpdateMeter Icon][!Redraw]

This should work if the value is simply the number '0' and nothing else.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Images? Is This Possible?

Post by balala »

eclectic-tech wrote: March 28th, 2020, 7:11 pm To change the icon color, you can add GreyScale=1 and ImageTint=255,255,255 to the the [Icon] image meter.
Then create a new String Measure [MeasureItemWhat1] to test the value of #Item1Title#.
If it is not 0, set the [Icon] option for ImageTint to RED (255,0,0), otherwise the ImageTint is set to WHITE (255,255,255).
Or there is another, a little bit more complicated, but in my opinion, much more elegant solution as well. In such a simple case, when the tint color is either white or red (with the appropriate color codes, 255,255,255 and respectively 255,0,0), the ImageTint option might work dynamically as well. For instance you could replace the ImageTint=255,255,255 option of the [Icon] meter with the following one: ImageTint=255,(255-255*Clamp(#Item1Title#,0,1)),(255-255*Clamp(#Item1Title#,0,1)) (take care not to forget to add the required DynamicVariables=1 option as well). If you do this, the IfMatch must be removed from the [MeasureItemWhat1] measure, or even better, the whole [MeasureItemWhat1] should be removed (if it's not needed anywhere else).