It is currently March 28th, 2024, 3:21 pm

Help with Replacing Text with Greetings

Get help with creating, editing & fixing problems with skins
tegra
Posts: 6
Joined: September 6th, 2022, 6:47 am

Re: Help with Replacing Text with Greetings

Post by tegra »

tass_co wrote: September 6th, 2022, 4:52 pm We use Substitute to edit the incoming string.
We have to use IfCondition at your request.
Because to take action based on incoming data.

In [MeasureTime] measure;
I used Substitute to remove the "0" in the incoming data.
I set conditions based on data with IfCondition.
I passed the result of the IfCondition to varTrack variable.
I told the Substitute section in the [Track] measure section to add the varTrack variable if the incoming string is empty.


Sorry for that :confused:


Glad If I could help :thumbup:
Here is the end result on my PC.
https://imgur.com/a/9GPiR6N

Also, I tried to shorten the [MeasureTime] measure like this, and it's working.

Code: Select all

[MeasureTime]
Measure=Time
Format=%S
RegExpSubstitute=1
Substitute="^([0-9])$":"\1"
IfCondition=((MeasureTime>=0)&&(MeasureTime<1))
IfTrueAction=[!SetVariable varTrack "It's Midnight"]
IfCondition2=((MeasureTime>=1)&&(MeasureTime<2))
IfTrueAction2=[!SetVariable varTrack "Getting late"]
IfCondition3=((MeasureTime>=2)&&(MeasureTime<3))
IfTrueAction3=[!SetVariable varTrack "Getting even later"]
IfCondition4=((MeasureTime>=3)&&(MeasureTime<4))
IfTrueAction4=[!SetVariable varTrack "Go to bed"]
IfCondition5=((MeasureTime>=4)&&(MeasureTime<5))
IfTrueAction5=[!SetVariable varTrack "What are you doing with your life?"]
IfCondition6=((MeasureTime>=5)&&(MeasureTime<12))
IfTrueAction6=[!SetVariable varTrack "Good Morning"]
IfCondition7=((MeasureTime>=12)&&(MeasureTime<13))
IfTrueAction7=[!SetVariable varTrack "It's Midday"]
IfCondition8=((MeasureTime>=13)&&(MeasureTime<18))
IfTrueAction8=[!SetVariable varTrack "Good afternoon"]
IfCondition9=((MeasureTime>=18)&&(MeasureTime<24))
IfTrueAction9=[!SetVariable varTrack "Good evening"]
IfConditionMode=1
I kept everything else unchanged. :bow: :bow: :bow: :D
User avatar
tass_co
Posts: 511
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Help with Replacing Text with Greetings

Post by tass_co »

tegra wrote: September 6th, 2022, 5:09 pm Here is the end result on my PC.
Also, I tried to shorten the [MeasureTime] measure like this, and it's working.
Shortening the conditions made a lot of sense.
I skipped it because I did copy/paste :D
tegra wrote: September 6th, 2022, 5:09 pm I kept everything else unchanged. :bow: :bow: :bow: :D
Glad to solve your problem :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Replacing Text with Greetings

Post by balala »

tegra wrote: September 6th, 2022, 5:09 pm Also, I tried to shorten the [MeasureTime] measure like this, and it's working.
Sorry being so late to party, however I saw now something which doesn't quite make sense. I assume that has only testing purposes, so just asking.
In the last posted code, the Format=%S option of the [MeasureTime] measure makes the measure to return the second. But the IfConditions are calibrated for hours, being tested how the value returned by the measure is related to 24.
Sorry if as said, this has been written / modified only for testing.
And one more: the IfConditionMode=1 option also doesn't really make sense. If this option is used, the appropriate IfTrueAction is executen ON EVERY update of the measure, but why to do this? I'd tend to renounce to this option. Once an IfCondition becomes true, the appropriate IfTrueAction is executed. If the measure really returns the second, this means up to a few executions for each interval. But if the measure in reality is returning the hours (as I assumed), this means many - many unnecessary executions of the appropriate IfTrueAction on each interval (why to set a variable thousands of times for each interval?). As said doesn't really makes sense. And additionally, this option is good to be treated carefully (see the Note here, even if in this case it's not the case).
User avatar
tass_co
Posts: 511
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Help with Replacing Text with Greetings

Post by tass_co »

balala wrote: September 6th, 2022, 6:28 pm Sorry being so late to party, however I saw now something which doesn't quite make sense. I assume that has only testing purposes, so just asking.
In the last posted code, the Format=%S option of the [MeasureTime] measure makes the measure to return the second. But the IfConditions are calibrated for hours, being tested how the value returned by the measure is related to 24.
Sorry if as said, this has been written / modified only for testing.
And one more: the IfConditionMode=1 option also doesn't really make sense. If this option is used, the appropriate IfTrueAction is executen ON EVERY update of the measure, but why to do this? I'd tend to renounce to this option. Once an IfCondition becomes true, the appropriate IfTrueAction is executed. If the measure really returns the second, this means up to a few executions for each interval. But if the measure in reality is returning the hours (as I assumed), this means many - many unnecessary executions of the appropriate IfTrueAction on each interval (why to set a variable thousands of times for each interval?). As said doesn't really makes sense. And additionally, this option is good to be treated carefully (see the Note here, even if in this case it's not the case).
My bad balala
To avoid the hassle of typing, sometimes I copy/paste codes from other skins I have.
Then I forget to check :oops:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Replacing Text with Greetings

Post by balala »

tass_co wrote: September 6th, 2022, 8:13 pm My bad balala
To avoid the hassle of typing, sometimes I copy/paste codes from other skins I have.
Then I forget to check :oops:
Don't worry, we all do the same. And we all (me at least definitely) do forget from time to time to fix... :thumbup:
User avatar
tass_co
Posts: 511
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Help with Replacing Text with Greetings

Post by tass_co »

balala wrote: September 6th, 2022, 8:35 pm Don't worry, we all do the same. And we all (me at least definitely) do forget from time to time to fix... :thumbup:
I promise one day I will learn to code in Rainmeter :D :D
Post Reply