eronic wrote:I want to repeat a text with current date and time to cover whole screen.
I think a lua script could be used to achieve something like you'd like. As eclectich-tech said, natively Rainmeter can't do this (it definitely is not a programming language, so it doesn't support looping), but because Lua is a programing language, it can be used to create a loop.
Try the following codes:
First create a skin, with the following code:
Code: Select all
[Rainmeter]
Update=16
OnRefreshAction=[!Move "0" "0"]
DynamicWindowSize=1
[Variables]
[MeasureLua]
Measure=Script
ScriptFile=#@#MyLua.lua
[MeasureTime]
Measure=Time
Format=%A, %Y-%m-%d %#I:%M %p
[MeasureHeight]
Measure=Calc
Formula=[MeterString:H]
IfCondition=(#CURRENTSECTION#>=#WORKAREAHEIGHT#)
IfTrueAction=[!DisableMeasure "MeasureLua"][!DisableMeasure "MeasureTime"][!SetOption MeterString UpdateDivider "-1"][!UpdateMeter "MeterString"]
DynamicVariables=1
[MeterString]
MeasureName=MeasureTime
Meter=STRING
X=5
Y=5
W=(#WORKAREAWIDTH#-10)
ClipString=1
FontColor=220,220,220
FontSize=18
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
See that the above code uses a MyLua.lua script file, which also have to be created (into the @Resources folder). Use the following (extremely simple) code for it:
Code: Select all
function Initialize()
Str = ''
end
function Update()
Str = Str..' %1'
SKIN:Bang('!SetOption', 'MeterString', 'Text', Str)
end
The basic idea is to extent the Text option of the [MeterString] meter on each update cycle, adding once again the same string (
%1, which is in fact the date and time, returned by the [MeasureTime] measure).
The height of the [MeterString] meter is continually compared with the height of the work area (
#WORKAREAHEIGHT# variable). Once the height of the meter reaches the height of the screen, the measures are disabled and the meter is paused (setting its UpdateDivider to -1).
The disadvantage of this code is the used low Update value. For a first try this is ok, but if you find this code useful enough, we can rewrite it a bit, to use the default update value and an ActionTimer plugin measure, to set the string appropriately. Probably this would be a much better approach, having more advantages.
So, does the above code working well?