It is currently April 27th, 2024, 7:39 am

Help with getting HueShift based on Process Uptime instead of System Uptime

Get help with creating, editing & fixing problems with skins
WandererTJ
Posts: 3
Joined: March 2nd, 2024, 3:42 pm

Help with getting HueShift based on Process Uptime instead of System Uptime

Post by WandererTJ »

First Post!
I've been working to modify the TimeWeather skin from the Thrivery pack so that the color of the Date has a RGB HueShift that cycles over time to match my lively wallpaper that does the same.

I've got the color shift working (YAY) but not exactly how I would like it to run. (That said, hopefully my code below should be enough to help someone else implement this).
Presently, HueStart is based upon SystemUptime, which in Windows 11, continues to run on a normal shutdown with FastBoot/Fast Startup enabled.
(Yes, turning that setting off would probably be the easiest option, but let's ignore that haha).
Instead, I would like to base HueStart based on the uptime that Explorer.EXE has been running, especially since Lively crashes anyways if you restart Explorer.

I'm definitely a C- student with coding, not a C++ student (yay puns) and would appreciate the help.
Based on my conversations with ChatGPT, I'm supposed to have DLL plugins for both SysInfo and Processes, but I can't seem to find those available to download anywhere. Are those something needed or are the integrated into Rainmeter by default?

The following link works for pulling information of uptime of a process using PowerShell, I'm just not sure how to do it and tie it to what I'm trying for Rainmeter.
https://superuser.com/questions/890464/how-to-find-out-how-long-a-process-has-been-running-for

Here is my code so far, again, the HueShift works, I just want HueStart to pull from something other than Time/mTime or whatever.

Variables.inc (From Thrivery Suite)

Code: Select all

[Variables]

Latitude=40.4681367
Longitude=-99.4264104
APIKey=21d8a80b3d6b444998a80b3d6b1449d3
URL=https://api.weather.com/v3/aggcommon/v3-wx-observations-current;v3-location-point;v3-wx-forecast-daily-15day?format=json&geocode=#Latitude#,#Longitude#&units=#Units#&language=#Language#&apiKey=#APIKey#

Language=en-US

Units=e

SpeedUnit=Mph

TimeFormat=%I:%M %p
LineClockW=450

HiddenDrives=1

FontFace=Segoe UI

FontColor=255,255,255
FontColor2=255,255,255,200
FontColor3=191,216,242,255
FontEffectColor=0,0,0,50

;Weather
FontWeather=ITC Avant Garde Std Bk Cn
WeatherColor=255,255,255

;System
FontSystem=ITC Avant Garde Std Bk Cn
SystemColor=255,255,255

FrameColor=245,245,245

Drive1=C:
Drive2=D:
Drive3=E:


;TIME 

TimeFontTime=ITC Avant Garde Pro Md
TimeFontMonth=ITC Avant Garde Pro Md
TimeFontWeekDay=ITC Avant Garde Pro Md
TimeFontDay=Bebas Neue Bold
TimeColorTime=255,255,255
TimeColorMonth=255,255,255
TimeColorWeekDay=255,255,255
TimeColorLine=255,255,255




;The Color shift for "TimeColorDay" is the entirety of the code below
;The Peroid of time is currently set at a value intended to match a 13m10s video cycle (Period=0.219444444)
;HueStart can be edited on the fly so you can dial the setting in without rebooting constantly, just refresh the widget afterwards


; Starting color/hue [0 - 5]
; 0 = Red, 1 = Orange, 2 = Yellow, 3 = Green, 4 = Blue, 5 = Magenta
; In-between values permitted (e.g. 3.5 would be a cyan color)
HueStart=2.35

; Value [0 - 255]
Val=255

; Saturation [0 - 1]
Sat=1.0

; Chroma
C=#Val#*#Sat#

; Direction of hue rotation
; (1) = Forward, (-1) = Backward
HueDir=(1)

; Range of hue rotation [0 - 6]
; 6 = full spectrum, 1 = one color, 2 = two colors, etc. 
; (of the 6 primary/secondary colors)
HueRange=6

; Period of time (in hours) over which the color rotates [0-24]
Period=0.219444444

; colors (hue rotation)
TimeColorDay="[R1:0],[G1:0],[B1:0]"


[mTime]
Measure=Time

[cHue1]
Group=Hue
Measure=Calc
Formula=(#HueStart#+6+#HueDir#*#HueRange#*FRAC(mTime/(3600*#Period#)))%6

[X1]
Measure=Calc
Formula=(#C#*(1-ABS(cHue1%2-1)))
[R1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#) : ((cHue1<2) ? (X1+#Val#-#C#) : ((cHue1<3) ? (#Val#-#C#) : ((cHue1<4) ? (#Val#-#C#) : ((cHue1<5) ? (X1+#Val#-#C#) : (#Val#) ))))
[G1]
Measure=Calc
Formula=(cHue1<1) ? (X1+#Val#-#C#) : ((cHue1<2) ? (#Val#) : ((cHue1<3) ? (#Val#) : ((cHue1<4) ? (X1+#Val#-#C#) : ((cHue1<5) ? (#Val#-#C#) : (#Val#-#C#) ))))
[B1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#-#C#) : ((cHue1<2) ? (#Val#-#C#) : ((cHue1<3) ? (X1+#Val#-#C#) : ((cHue1<4) ? (#Val#) : ((cHue1<5) ? (#Val#) : (X1+#Val#-#C#) ))))
Any help would be appreciated.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by Yincognito »

WandererTJ wrote: March 2nd, 2024, 4:04 pmInstead, I would like to base HueStart based on the uptime that Explorer.EXE has been running, especially since Lively crashes anyways if you restart Explorer.
I'm gonna skip the skin you mentioned or the hue shift method you use since you already got that covered. Forget about asking ChatGPT, it can't compare to a human and the whole AI thing is mostly hype, it's more or less Cortana enhanced at this point (and for a long time afterwards). Now, on the how-to approach, you don't necessarily need PowerShell for this (PS commands can be used with the help of a RunCommand measure, by the way):
- Process measure: https://docs.rainmeter.net/manual/measures/process/
- IfConditions options in a measure: https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
- Time measure: https://docs.rainmeter.net/manual/measures/time/
- SysInfo measure: https://docs.rainmeter.net/manual/measures/sysinfo/
- RunCommand plugin: https://docs.rainmeter.net/manual/plugins/runcommand/
In basic, general terms, assuming your skin always runs while the computer is on, you'd:
- check if the Explorer process is running in an IfCondition added to your Process measure
- if so (by default this would mean Explorer just started), set a variable to the "now" timestamp of a Time measure, to have the start time stored in that variable
- use another Time measure for the current "now" time
- based on the timestamp difference between your 2nd Time measure and the 1st (which you can compute in a Calc measure), do your hue shift process as usual

Let us know if you need further assistance with the implementation. I suggest starting from scratch with this in a simple skin and use the notepad.exe process instead, until you get the idea and make things work as desired. After that, you can switch to explorer.exe easily.

EDIT: A basic sample computing the number of seconds while notepad.exe is running, with 0 otherwise (in the end, a single Time measure was needed):

Code: Select all

[Variables]
StartTimestamp=0
ElapsedSeconds=0

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

---Measures---

[MeasureTime]
Measure=Time
Format=%a, %Y-%b-%d, %H:%M:%S
OnUpdateAction=[!SetVariable ElapsedSeconds (#StartTimestamp#=0?0:[MeasureTime:Timestamp]-#StartTimestamp#)]
DynamicVariables=1

[MeasureProcess]
Measure=Process
ProcessName=Notepad.exe
IfCondition=(MeasureProcess=1)
IfTrueAction=[!SetVariable StartTimestamp [MeasureTime:Timestamp]][!UpdateMeasure *][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable StartTimestamp 0][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1

---Meters---

[Result]
Meter=String
FontFace=Consolas
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
Text=Current Time      = [MeasureTime]#CRLF#Start   Timestamp = #StartTimestamp##CRLF#Current Timestamp = [MeasureTime:Timestamp]#CRLF#Elapsed Seconds   = #ElapsedSeconds#
DynamicVariables=1
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
WandererTJ
Posts: 3
Joined: March 2nd, 2024, 3:42 pm

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by WandererTJ »

I'm not sure what the Current Timestamp is pulling, but it's at a value of 13353880373
Which is over 400 years... O.O

I quickly changed Notepad to Explorer.exe with the skin running the code.
Saved.
Refreshed Skin.
No change.

Restarted Explorer.exe.
Refreshed Skin.
No change.

Elapsed Seconds is at least giving me proper numbers from the time the skin is refreshed.

I tried adding more text to get a line that reported uptime for Explorer, as I assumed it to be missing, but I've not been able to figure out anything that puts out a time and not just what I typed in.

I am still lost. I did read through the links, I actually had a few of them open before posting the thread, but I guess I'm just dense tonight.

I tried MeasureProcess, ElapsedSeconds, and a few other things in substitute to mTime in the HueShift equation, but I'm only getting a static color. Sometimes Red (value=0) and sometimes a yellowish green.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by Yincognito »

WandererTJ wrote: March 3rd, 2024, 1:39 am I'm not sure what the Current Timestamp is pulling, but it's at a value of 13353880373
Which is over 400 years... O.O
Of course it is, since it's the number of seconds since Jan 1, 1601.
WandererTJ wrote: March 3rd, 2024, 1:39 am Elapsed Seconds is at least giving me proper numbers from the time the skin is refreshed.
Yes, it's giving the proper number of seconds, but from the time notepad.exe (or whatever process you use in MeasureProcess) was last started. This is the number you should use in your hue shift math. How, I don't know, you said that you "got the color shift working", so I assumed you knew how to handle it. :confused:

EDIT:
WandererTJ wrote: March 3rd, 2024, 1:39 am I tried MeasureProcess, ElapsedSeconds, and a few other things in substitute to mTime in the HueShift equation, but I'm only getting a static color. Sometimes Red (value=0) and sometimes a yellowish green.
I replaced mTime with #ElapsedSeconds# after combining the relevant parts of your code with mine, and I definitely see the color (slowly) changing:

Code: Select all

[Variables]
StartTimestamp=0
ElapsedSeconds=0

;The Color shift for "TimeColorDay" is the entirety of the code below
;The Period of time is currently set at a value intended to match a 13m10s video cycle (Period=0.219444444)
;HueStart can be edited on the fly so you can dial the setting in without rebooting constantly, just refresh the widget afterwards

; Starting color/hue [0 - 5]
; 0 = Red, 1 = Orange, 2 = Yellow, 3 = Green, 4 = Blue, 5 = Magenta
; In-between values permitted (e.g. 3.5 would be a cyan color)
HueStart=2.35

; Value [0 - 255]
Val=255

; Saturation [0 - 1]
Sat=1.0

; Chroma
C=#Val#*#Sat#

; Direction of hue rotation
; (1) = Forward, (-1) = Backward
HueDir=(1)

; Range of hue rotation [0 - 6]
; 6 = full spectrum, 1 = one color, 2 = two colors, etc. 
; (of the 6 primary/secondary colors)
HueRange=6

; Period of time (in hours) over which the color rotates [0-24]
Period=0.219444444

; colors (hue rotation)
TimeColorDay="[R1:0],[G1:0],[B1:0]"

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

---Measures---

[MeasureProcess]
Measure=Process
ProcessName=Notepad.exe
IfCondition=(MeasureProcess=1)
IfTrueAction=[!SetVariable StartTimestamp [MeasureTime:Timestamp]][!UpdateMeasure *][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable StartTimestamp 0][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasureTime]
Measure=Time
Format=%a, %Y-%b-%d, %H:%M:%S
OnUpdateAction=[!SetVariable ElapsedSeconds (#StartTimestamp#=0?0:[MeasureTime:Timestamp]-#StartTimestamp#)]
DynamicVariables=1

[cHue1]
Group=Hue
Measure=Calc
Formula=(#HueStart#+6+#HueDir#*#HueRange#*FRAC(#ElapsedSeconds#/(3600*#Period#)))%6
DynamicVariables=1

[X1]
Measure=Calc
Formula=(#C#*(1-ABS(cHue1%2-1)))
DynamicVariables=1
[R1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#) : ((cHue1<2) ? (X1+#Val#-#C#) : ((cHue1<3) ? (#Val#-#C#) : ((cHue1<4) ? (#Val#-#C#) : ((cHue1<5) ? (X1+#Val#-#C#) : (#Val#) ))))
DynamicVariables=1
[G1]
Measure=Calc
Formula=(cHue1<1) ? (X1+#Val#-#C#) : ((cHue1<2) ? (#Val#) : ((cHue1<3) ? (#Val#) : ((cHue1<4) ? (X1+#Val#-#C#) : ((cHue1<5) ? (#Val#-#C#) : (#Val#-#C#) ))))
DynamicVariables=1
[B1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#-#C#) : ((cHue1<2) ? (#Val#-#C#) : ((cHue1<3) ? (X1+#Val#-#C#) : ((cHue1<4) ? (#Val#) : ((cHue1<5) ? (#Val#) : (X1+#Val#-#C#) ))))
DynamicVariables=1

---Meters---

[Result]
Meter=String
FontFace=Consolas
FontSize=14
SolidColor=[R1],[G1],[B1],255
FontColor=255,255,255,255
AntiAlias=1
Text=Current Time      = [MeasureTime]#CRLF#Start   Timestamp = #StartTimestamp##CRLF#Current Timestamp = [MeasureTime:Timestamp]#CRLF#Elapsed Seconds   = #ElapsedSeconds#
DynamicVariables=1
For example, the meter background starts at light green when elapsed seconds is at 0, then goes to cyan at 60, light blue at 120, and so on. I have no idea how you want this to go or at what pace, but it's clear that it's working. By the way, a couple DynamicVariables=1 lines were added to your measures, so that the changed value of the elapsed seconds variable is "seen" by Rainmeter and reacted to accordingly.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
WandererTJ
Posts: 3
Joined: March 2nd, 2024, 3:42 pm

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by WandererTJ »

Yincognito wrote: March 3rd, 2024, 1:58 am How, I don't know, you said that you "got the color shift working", so I assumed you knew how to handle it.
Well, I grabbed this: https://forum.rainmeter.net/viewtopic.php?t=16055
and then I kinda just tried beating the two codes together with a hammer until something worked.
I learned some C# in a semester over a decade ago, so I can definitely tell you that what is inside Notepad that I'm looking at, is definitely some form of code.

My original goal was to see if there was a way to pull the color value from a single pixel based on set coordinates within the active desktops , and I found some code that kinda did that, but I had no idea how to smoosh that one in with everything.

Anyways.....
Okay, so definitely got some forward progress. It's not what the original goal was, but it's something that works.
OnUpdateAction is providing me with the ability to reset the color. So when I rapidly restart Explorer and then refresh the skin, they are now in tune with one another. It's NOT doing it like the code seems to be telling it to do. It's ignoring Explorer, but I think this helps.

For whatever reason, I still don't think MeasureProcess is doing anything inside the code. Still no change between Notepad to Explorer as well as no difference when they're restarted and the skin is refreshed.
Not to be a broken record, but is there a Process.DLL that I need to download and put in my directories in order to make this work?


I didn't have to change things so much as I just had to remove things by process of elimination until it worked with the existing code.
Pasting the code that comes after "TimeColorLine=255,255,255" from the OP.

Code: Select all

StartTimestamp=0
ElapsedSeconds=0

;The Color shift for "TimeColorDay" is the entirety of the code below
;The Period of time is currently set at a value intended to match a 13m10s video cycle (Period=0.219444444)
;HueStart can be edited on the fly so you can dial the setting in without rebooting constantly, just refresh the widget afterwards

; Starting color/hue [0 - 5]
; 0 = Red, 1 = Orange, 2 = Yellow, 3 = Green, 4 = Blue, 5 = Magenta
; In-between values permitted (e.g. 3.5 would be a cyan color)
HueStart=0.85

; Value [0 - 255]
Val=255

; Saturation [0 - 1]
Sat=1.0

; Chroma
C=#Val#*#Sat#

; Direction of hue rotation
; (1) = Forward, (-1) = Backward
HueDir=(1)

; Range of hue rotation [0 - 6]
; 6 = full spectrum, 1 = one color, 2 = two colors, etc. 
; (of the 6 primary/secondary colors)
HueRange=6

; Period of time (in hours) over which the color rotates [0-24]
Period=0.219444444

; colors (hue rotation)
TimeColorDay="[R1:0],[G1:0],[B1:0]"


[MeasureProcess]
Measure=Process
ProcessName=Explorer.exe
IfCondition=(MeasureProcess=1)
IfTrueAction=[!SetVariable StartTimestamp [MeasureTime:Timestamp]][!UpdateMeasure *][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable StartTimestamp 0][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasureTime]
Measure=Time
Format=%a, %Y-%b-%d, %H:%M:%S
OnUpdateAction=[!SetVariable ElapsedSeconds (#StartTimestamp#=0?0:[MeasureTime:Timestamp]-#StartTimestamp#)]
DynamicVariables=1

[cHue1]
Group=Hue
Measure=Calc
Formula=(#HueStart#+6+#HueDir#*#HueRange#*FRAC(#ElapsedSeconds#/(3600*#Period#)))%6
DynamicVariables=1

[X1]
Measure=Calc
Formula=(#C#*(1-ABS(cHue1%2-1)))
DynamicVariables=1
[R1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#) : ((cHue1<2) ? (X1+#Val#-#C#) : ((cHue1<3) ? (#Val#-#C#) : ((cHue1<4) ? (#Val#-#C#) : ((cHue1<5) ? (X1+#Val#-#C#) : (#Val#) ))))
DynamicVariables=1
[G1]
Measure=Calc
Formula=(cHue1<1) ? (X1+#Val#-#C#) : ((cHue1<2) ? (#Val#) : ((cHue1<3) ? (#Val#) : ((cHue1<4) ? (X1+#Val#-#C#) : ((cHue1<5) ? (#Val#-#C#) : (#Val#-#C#) ))))
DynamicVariables=1
[B1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#-#C#) : ((cHue1<2) ? (#Val#-#C#) : ((cHue1<3) ? (X1+#Val#-#C#) : ((cHue1<4) ? (#Val#) : ((cHue1<5) ? (#Val#) : (X1+#Val#-#C#) ))))
DynamicVariables=1
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by RicardoTM »

WandererTJ wrote: March 3rd, 2024, 4:46 am For whatever reason, I still don't think MeasureProcess is doing anything inside the code. Still no change between Notepad to Explorer as well as no difference when they're restarted and the skin is refreshed.
It is, at least for me it does work. (I changed it to Notepad.exe to test):
sda.jpg
It starts counting when I launch Notepad and stops when I close it. It also was working with Explorer.exe.

The only thing your code is missing (at least the last you posted) is the [Variables] section at the top and any meter, but I guess you're only sharing a part of the code.
WandererTJ wrote: March 3rd, 2024, 4:46 am is there a Process.DLL that I need to download and put in my directories in order to make this work?
No, Process is integrated on Rainmeter, is not a plugin.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with getting HueShift based on Process Uptime instead of System Uptime

Post by Yincognito »

WandererTJ wrote: March 3rd, 2024, 4:46 am Well, I grabbed this: https://forum.rainmeter.net/viewtopic.php?t=16055
and then I kinda just tried beating the two codes together with a hammer until something worked.
I learned some C# in a semester over a decade ago, so I can definitely tell you that what is inside Notepad that I'm looking at, is definitely some form of code.

My original goal was to see if there was a way to pull the color value from a single pixel based on set coordinates within the active desktops , and I found some code that kinda did that, but I had no idea how to smoosh that one in with everything.

Anyways.....
Okay, so definitely got some forward progress. It's not what the original goal was, but it's something that works.
OnUpdateAction is providing me with the ability to reset the color. So when I rapidly restart Explorer and then refresh the skin, they are now in tune with one another. It's NOT doing it like the code seems to be telling it to do. It's ignoring Explorer, but I think this helps.

For whatever reason, I still don't think MeasureProcess is doing anything inside the code. Still no change between Notepad to Explorer as well as no difference when they're restarted and the skin is refreshed.
Not to be a broken record, but is there a Process.DLL that I need to download and put in my directories in order to make this work?


I didn't have to change things so much as I just had to remove things by process of elimination until it worked with the existing code.
Pasting the code that comes after "TimeColorLine=255,255,255" from the OP.

Code: Select all

StartTimestamp=0
ElapsedSeconds=0

;The Color shift for "TimeColorDay" is the entirety of the code below
;The Period of time is currently set at a value intended to match a 13m10s video cycle (Period=0.219444444)
;HueStart can be edited on the fly so you can dial the setting in without rebooting constantly, just refresh the widget afterwards

; Starting color/hue [0 - 5]
; 0 = Red, 1 = Orange, 2 = Yellow, 3 = Green, 4 = Blue, 5 = Magenta
; In-between values permitted (e.g. 3.5 would be a cyan color)
HueStart=0.85

; Value [0 - 255]
Val=255

; Saturation [0 - 1]
Sat=1.0

; Chroma
C=#Val#*#Sat#

; Direction of hue rotation
; (1) = Forward, (-1) = Backward
HueDir=(1)

; Range of hue rotation [0 - 6]
; 6 = full spectrum, 1 = one color, 2 = two colors, etc. 
; (of the 6 primary/secondary colors)
HueRange=6

; Period of time (in hours) over which the color rotates [0-24]
Period=0.219444444

; colors (hue rotation)
TimeColorDay="[R1:0],[G1:0],[B1:0]"


[MeasureProcess]
Measure=Process
ProcessName=Explorer.exe
IfCondition=(MeasureProcess=1)
IfTrueAction=[!SetVariable StartTimestamp [MeasureTime:Timestamp]][!UpdateMeasure *][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable StartTimestamp 0][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasureTime]
Measure=Time
Format=%a, %Y-%b-%d, %H:%M:%S
OnUpdateAction=[!SetVariable ElapsedSeconds (#StartTimestamp#=0?0:[MeasureTime:Timestamp]-#StartTimestamp#)]
DynamicVariables=1

[cHue1]
Group=Hue
Measure=Calc
Formula=(#HueStart#+6+#HueDir#*#HueRange#*FRAC(#ElapsedSeconds#/(3600*#Period#)))%6
DynamicVariables=1

[X1]
Measure=Calc
Formula=(#C#*(1-ABS(cHue1%2-1)))
DynamicVariables=1
[R1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#) : ((cHue1<2) ? (X1+#Val#-#C#) : ((cHue1<3) ? (#Val#-#C#) : ((cHue1<4) ? (#Val#-#C#) : ((cHue1<5) ? (X1+#Val#-#C#) : (#Val#) ))))
DynamicVariables=1
[G1]
Measure=Calc
Formula=(cHue1<1) ? (X1+#Val#-#C#) : ((cHue1<2) ? (#Val#) : ((cHue1<3) ? (#Val#) : ((cHue1<4) ? (X1+#Val#-#C#) : ((cHue1<5) ? (#Val#-#C#) : (#Val#-#C#) ))))
DynamicVariables=1
[B1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#-#C#) : ((cHue1<2) ? (#Val#-#C#) : ((cHue1<3) ? (X1+#Val#-#C#) : ((cHue1<4) ? (#Val#) : ((cHue1<5) ? (#Val#) : (X1+#Val#-#C#) ))))
DynamicVariables=1
For your original goal, I think checking this thread can help:
https://forum.rainmeter.net/viewtopic.php?t=21655

For your current goal as you described it in the OP, the edit from my previous reply does exactly that, as RicardoTM confirmed. Whether it is what you actually want or not, or whether integrating it in your actual code works, only you know, I only worked with what you posted.

Remember, I assumed your skin is active at all times, so if you loaded the skin AFTER your process was already running for some time, the time interval during which the skin was not yet loaded is NOT taken into account in terms of whether the resulting color is in sync with your wallpaper and such, simply because the skin cannot possibly know when the process started if it wasn't active at that time. That goes for refreshing too, unless the start timestamp is written in the skin file using a !WriteKeyValue bang.

So again, if you just want to sync some color in your skin with the color somewhere in your wallpaper, the Chameleon plugin or similar is more suited for it. That being said, in your OP you asked for a different thing, which the code I posted does, as already mentioned. We try to help here the best we can, but a lot depends on what exactly does the user want and how precise the description of his goal is. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth