I'd need some help again for my skin.
I'm currently using this script to read my iCue log File.
Code: Select all
[Variables]
FiletoRead=E:\Documents\Skins\SideBAR4\@Resources\iCue logs\corsair_cue_20210825_12_53_37.csv
LinesToTail=1
SecondsBetweenRead=5
ChildPrefix=MeasureLine
Code: Select all
function Initialize()
fileToRead = SKIN:GetVariable('FileToRead')
linesToTail = tonumber(SKIN:GetVariable('LinesToTail'))
childPrefix = SKIN:GetVariable('ChildPrefix')
end
function Update()
local inputFile = io.open(fileToRead, 'r')
local text, ch
local pos = -1
local i = 1
repeat
inputFile:seek("end", pos - 1)
ch = inputFile:read(1)
if ch == '\n' then
text = inputFile:read(-pos)
if text ~= nil then
SKIN:Bang('!SetOption', childPrefix..i, 'String', string.match(text, "^(.-)\n"))
SKIN:Bang('!UpdateMeasure', childPrefix..i)
i = i + 1
pos = pos - 1
end
end
pos = pos - 1
until (i > linesToTail)
io.close(inputFile)
SKIN:Bang('!UpdateMeter', '*')
SKIN:Bang('!Redraw')
return 0
end
Now I'm trying to make it automatically get the right file to read.
I use the Fileview plugin to get the latest file then put it in my Variables like below
Code: Select all
[Variables]
FileName=[mIndex1Name]
FiletoRead=E:\Documents\Skins\SideBAR4\@Resources\iCue logs\#FileName#
LinesToTail=1
SecondsBetweenRead=5
ChildPrefix=MeasureLine
Code: Select all
FiletoRead=E:\Documents\Skins\SideBAR4\@Resources\iCue logs\[mIndex1Name]
Currently: E:\Documents\Skins\SideBAR4\@Resources\iCue logs\corsair_cue_20210825_12_53_37.csv
I suspect that the script is not able to get the output of [mIndex1Name] or #FileName# and would need to have it directly defined in it s own file, maybe like this :
Code: Select all
function Initialize()
fileName = SKIN:GetVariable('FileName')
filePath = SKIN:GetVariable('FilePath')
I just don't know how to do it correctly. Or even if I'm right somehow.