I've seen this answered in the forums before when I was searching for another answer but typically, now I need to know the answer I can't find it despite searching for ages.
I am trying to write a skin with a lua script that takes the current air pressure, writes it to a file x times and then reads back x number of values to create a histogram showing the changes in the pressure over time.
The issue I have now is that when I place an UpdateDivider in the lua measure to make it run at the same frequency as the parser, I have to wait for the first update before any values are returned.
My skin has the following related to the timing and passing the value to the lua script
Code: Select all
[Rainmeter]
Update=1000
;======================================================================================
; Pass pressure reading to Lua and return it
;======================================================================================
[MeasurePasspressureToLua]
Measure=Script
ScriptFile=#CURRENTPATH#writepressure.lua
CurrentPressure=[MeasureCurrentPressure]
UpdateDivider=540
[MeterGetPressureFromLua]
Meter=String
MeasureName=MeasurePasspressureToLua
MeterStyle=TextStyle
X=10
Y=R
Text=Pressure: %1
Code: Select all
function Initialize()
end -- function Initialize
function Update()
sMyPressure = SELF:GetOption('CurrentPressure')
writetofile(sMyPressure)
return sMyPressure
end -- function Update
function writetofile(CurrentPressure)
file = io.open("C:\\Users\\Hedley\\Documents\\Rainmeter\\Skins\\SimplyNova\\Wunderground\\pressures.txt", "a")
-- file:write("hello", "\n")
file:write(CurrentPressure, "\n")
file:close()
end
The answer I saw before but can't find showed how to get round this issue. Apologies for my poor search skills and not being able to find it again.
Thanks.