function Initialize()
end
local data = SEFT:GetOption('TestOption')
SKIN:Bang('!SetOption', 'MeasureString', 'String', data)
SKIN:Bang('!UpdateMeasure', 'MeasureScript')
SKIN:Bang('!UpdateMeter', 'MeterTrendLabel')
SKIN:Bang('!Redraw')
But I got the error message: Script: test.lua:5: attempt to index global 'SEFT' (a nil value)
and also "Script: test.lua:5: attempt to index global 'SKIN' (a nil value)" when I tried to use SKIN object in script.
I could not figure it out , and looking for your support.
Many thanks.
CreativeMomoiro wrote:But I got the error message: Script: test.lua:5: attempt to index global 'SEFT' (a nil value)
and also "Script: test.lua:5: attempt to index global 'SKIN' (a nil value)" when I tried to use SKIN object in script.
There are a few issues with the posted code(s):
In the local data = SE[color=#FF0000]FT[/color]:GetOption('TestOption') line of the script code there is a miswriting: it should have to be local data = SE[color=#00AA00]LF[/color]:GetOption('TestOption'). Fix it.
I'm not sure how a standalone lua code works, but when used into a Rainmeter skin, you can't use the lines as you did. You have to include them into a function, like Initialize() or Update(). I suppose you wanted to include those lines into the Initialize() function, but finally you didn't. So include them:
function Initialize()
local data = SELF:GetOption('TestOption')
SKIN:Bang('!SetOption', 'MeasureString', 'String', data)
SKIN:Bang('!UpdateMeasure', 'MeasureScript')
SKIN:Bang('!UpdateMeter', 'MeterTrendLabel')
SKIN:Bang('!Redraw')
end
And finally don't update the [MeasureScript] Script measure of your code into the code of the .lua script itself. It!s not a good idea. Again I think what you wanted would be to update the [MeasureString] measure, not the [MeasureScript]. Am I right? If I am, here is the final update of the code:
function Initialize()
local data = SELF:GetOption('TestOption')
SKIN:Bang('!SetOption', 'MeasureString', 'String', data)
SKIN:Bang('!UpdateMeasure', 'MeasureString')
SKIN:Bang('!UpdateMeter', 'MeterTrendLabel')
SKIN:Bang('!Redraw')
end
Thanks a lot for your help . I have changed the script as your suggest, it worked perfect .
Btw I want to get WebParser measure value in the script as below:
function Initialize()
end
function setData()
MyMeasure = SKIN:GetMeasure('MeasureSite')
SKIN:Bang('!SetOption', 'MeterTrendLabel', 'Text', MyMeasure::GetStringValue())
SKIN:Bang('!UpdateMeter', 'MeterTrendLabel')
SKIN:Bang('!Redraw')
end
But it didn't work. Although measure has value but the meter displayed nothing
CreativeMomoiro wrote:But it didn't work. Although measure has value but the meter displayed nothing
You've doubled the colon in the SKIN:Bang('!SetOption', 'MeterTrendLabel', 'Text', MyMeasure:[color=#FF0000]:[/color]GetStringValue()) line. Remove one of them: SKIN:Bang('!SetOption', 'MeterTrendLabel', 'Text', MyMeasure:GetStringValue())