It is currently October 15th, 2024, 12:50 am

Update Skin from Text File Variables

Discuss the use of Lua in Script measures.
mcpaton
Posts: 27
Joined: March 17th, 2016, 2:18 am

Update Skin from Text File Variables

Post by mcpaton »

Hi

I have a skin that shows some "buttons" on a display screen in a broadcast studio. I have variables stored in a text file, and am using web parser to constantly scan the file, and depending on the variable in it, change the value and colour of the button on the screen.

As this needs to be fairly rapidly updated, it seems to sometimes crash Web Parser, which stops all skins updating without a force refresh. I understand this is not the best use of Web Parser, so I attempted to adapt a Lua script to do this for me. I'm no coder, so butchered up something based on a Lyrics script I found on the forum.

What I ended up with, kind of works for a bit, but then crashes Rainmeter completely. As this doesnt show anything up in the rainmeter log, I'm not sure where I have gone wrong, and why it's crashing. I have pasted in the files below, please go easy on me for the bad code :)

File 1: Variables file that is updated via AutoIT script UDP commands:

Code: Select all

[Pathfinder Config]
Service=SVC3,
Studio=ON,
Delay=OFF,
Sat=OFF,
Audio=OFF,
Clip=OFF,
Hotline=OFF,
Caller=OFF,
Mic=OFF,
Security=OFF,
Meeting=OFF,
File 2: Skin:

Code: Select all

[Metadata]
Name=Alarm Display

[Rainmeter]
Update=500
AccurateText=1
DynamicWindowSize=1
W=170
H=100

[Variables]
@include=#@#\Variables.inc
BoxColourOFF=192,192,192,100
BoxColourON=0,234,102,255
BoxColourALARM=247,13,18,[MeasureBlinkString]
BoxColourCALLER=0,152,234,[MeasureBlinkString]

FontSize=20

WIDTH=(#SCREENAREAWIDTH#-14)
HEIGHT=#SCREENAREAHEIGHT#
;WIDTH=1360
;Height=800

[MeasureReadPathfinderInfo]
Measure=Script
ScriptFile=#CURRENTPATH#Pathfinder.lua
FileToRead=#configpath#
DynamicVariables=1

; Measures - Definitions of Data

[BoxSize]
Measure=Calc
Formula=#WIDTH#*0.125
DynamicVariables=1

[BoxHeight]
Measure=Calc
Formula=#HEIGHT#*0.12
DynamicVariables=1

[MeasureBlinkString]
Measure=Calc
Formula=MeasureBlinkString = 0 ? 255 : 0
UpdateDivider=2

; Meter Section - Display of Data from Measures. These are updated by Pathfinder Lua Script

[StudioBackground]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=0
Y=100

[StudioText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]/2)
Y=130

[DelayBackground]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=([BoxSize]+2)
Y=100

[DelayText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*1.51)
Y=130

[SatBackground]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*2)
Y=100

[SatText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*2.52)
Y=130

[AudioBackground0]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*3)
Y=100

[AudioBackground]
Meter=Image
W=[BoxSize]
H=100
X=(([BoxSize]+2)*3)
Y=100

[AudioText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*3.52)
Y=130

[ClipBackground0]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*4)
Y=100

[ClipBackground]
Meter=Image
W=[BoxSize]
H=100
X=(([BoxSize]+2)*4)
Y=100

[ClipText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*4.53)
Y=130

[HotlineBackground0]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*5)
Y=100

[HotlineBackground]
Meter=Image
W=[BoxSize]
H=100
X=(([BoxSize]+2)*5)
Y=100

[HotlineText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*5.54)
Y=130

[CallerBackground0]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*6)
Y=100

[CallerBackground]
Meter=Image
W=[BoxSize]
H=100
X=(([BoxSize]+2)*6)
Y=100

[CallerText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*6.57)
Y=130

[MicBackground0]
Meter=Image
SolidColor=#BoxColourOFF#
W=[BoxSize]
H=100
X=(([BoxSize]+2)*7)
Y=100

[MicBackground]
Meter=Image
W=[BoxSize]
H=100
X=(([BoxSize]+2)*7)
Y=100

[MicText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=([BoxSize]*7.58)
Y=130

[MeetingAlarmBackground]
Meter=Image
W=#SCREENAREAWIDTH#
H=100
X=0
Y=0

[MeetingAlarmText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=(#SCREENAREAWIDTH#/2)
Y=15

[SecurityAlarmBackground]
Meter=Image
W=#SCREENAREAWIDTH#
H=100
X=0
Y=0

[SecurityAlarmText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=(#SCREENAREAWIDTH#/2)
Y=15

[AudioAlarmBackground]
Meter=Image
W=#SCREENAREAWIDTH#
H=100
X=0
Y=0

[AudioAlarmText]
Meter=String
FontSize=#FontSize#
FontColor=#FontColor#
FontFace=#DataFont#
AntiAlias=1
StringStyle=Bold
StringAlign=Center
X=(#SCREENAREAWIDTH#/2)
Y=15
File 3: Lua Script

Code: Select all

function Initialize()

end

function Update()
   
   sFileToRead = SELF:GetOption('FileToRead')
   
   hReadingFile = io.open(sFileToRead)
   if not hReadingFile then
      print('LuaTextFile: unable to open file at ' .. sFileToRead)
      return
   end
   
   sAllText = hReadingFile:read('*all')
   sAllText = string.gsub(sAllText, '\t', '     ')
   
   sService = string.match(sAllText, 'Service=(.-),')
   
   sStudio = string.match(sAllText, 'Studio=(.-),')
   Meter = SKIN:GetMeter('StudioBackground')
      if sStudio == 'ON' then
         SKIN:Bang('!SetOption', 'StudioBackground', 'SolidColor', '#BoxColourON#')
      else
         SKIN:Bang('!SetOption', 'StudioBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('StudioText')
      if sStudio == 'ON' then
		 SKIN:Bang('!SetOption', 'StudioText', 'Text', 'STUDIO ON')
      else
		 SKIN:Bang('!SetOption', 'StudioText', 'Text', 'STUDIO OFF')
      end

  sDelay = string.match(sAllText, 'Delay=(.-),')
     Meter = SKIN:GetMeter('DelayBackground')
      if sDelay == 'ON' then
         SKIN:Bang('!SetOption', 'DelayBackground', 'SolidColor', '#BoxColourON#')
      else
         SKIN:Bang('!SetOption', 'DelayBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('DelayText')
      if sDelay == 'ON' then
		 SKIN:Bang('!SetOption', 'DelayText', 'Text', 'DELAY ON')
      else
		 SKIN:Bang('!SetOption', 'DelayText', 'Text', 'DELAY OFF')
      end
 
    sSat = string.match(sAllText, 'Sat=(.-),')
     Meter = SKIN:GetMeter('SatBackground')
      if sSat == 'ON' then
         SKIN:Bang('!SetOption', 'SatBackground', 'SolidColor', '#BoxColourON#')
      else
         SKIN:Bang('!SetOption', 'SatBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('SatText')
      if sSat == 'ON' then
		 SKIN:Bang('!SetOption', 'SatText', 'Text', 'Sat ON')
      else
		 SKIN:Bang('!SetOption', 'SatText', 'Text', 'Sat OFF')
      end
   
      sAudio = string.match(sAllText, 'Audio=(.-),')
     Meter = SKIN:GetMeter('AudioBackground')
      if sAudio == 'ON' then
         SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourALARM#')
		 SKIN:Bang('!SetOption', 'AudioAlarmBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourOFF#')
		 SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourON#')
		 SKIN:Bang('!SetOption', 'AudioAlarmBackground', 'SolidColor', '0,0,0,0')
      end

      Meter = SKIN:GetMeter('AudioText')
      if sAudio == 'ON' then
		 SKIN:Bang('!SetOption', 'AudioText', 'Text', 'AUDIO FAIL')
      else
		 SKIN:Bang('!SetOption', 'AudioText', 'Text', 'AUDIO OK')
      end
      
	  Meter = SKIN:GetMeter('AudioAlarmText')
      if sAudio == 'ON' then
		 SKIN:Bang('!SetOption', 'AudioAlarmText', 'Text', "AUDIO FAIL! #CRLF# Please Check Console Levels Immediately!")
		 SKIN:Bang('!SetOption', 'AudioAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
      else
		 SKIN:Bang('!SetOption', 'AudioAlarmText', 'Text', "")
      end
  
        sClip = string.match(sAllText, 'Clip=(.-),')
     Meter = SKIN:GetMeter('ClipBackground')
      if sClip == 'ON' then
         SKIN:Bang('!SetOption', 'ClipBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'ClipBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('ClipText')
      if sClip == 'ON' then
		 SKIN:Bang('!SetOption', 'ClipText', 'Text', 'TOO LOUD!')
      else
		 SKIN:Bang('!SetOption', 'ClipText', 'Text', 'LEVELS OK')
      end
  
  
        sHotline = string.match(sAllText, 'Hotline=(.-),')
     Meter = SKIN:GetMeter('HotlineBackground')
      if sHotline == 'ON' then
         SKIN:Bang('!SetOption', 'HotlineBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'HotlineBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('HotlineText')
      if sHotline == 'ON' then
		 SKIN:Bang('!SetOption', 'HotlineText', 'Text', 'HOTLINE!')
      else
		 SKIN:Bang('!SetOption', 'HotlineText', 'Text', 'HOTLINE!')
      end

        sCaller = string.match(sAllText, 'Caller=(.-),')
     Meter = SKIN:GetMeter('CallerBackground')
      if sCaller == 'ON' then
         SKIN:Bang('!SetOption', 'CallerBackground', 'SolidColor', '#BoxColourCALLER#')
      else
         SKIN:Bang('!SetOption', 'CallerBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('CallerText')
      if sCaller == 'ON' then
		 SKIN:Bang('!SetOption', 'CallerText', 'Text', 'CALLER!')
      else
		 SKIN:Bang('!SetOption', 'CallerText', 'Text', 'NO CALLS')
      end	  
	  
        sMic = string.match(sAllText, 'Mic=(.-),')
     Meter = SKIN:GetMeter('MicBackground')
      if sMic == 'ON' then
         SKIN:Bang('!SetOption', 'MicBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'MicBackground', 'SolidColor', '#BoxColourOFF#')
      end

      Meter = SKIN:GetMeter('MicText')
      if sMic == 'ON' then
		 SKIN:Bang('!SetOption', 'MicText', 'Text', "MIC'S ON")
      else
		 SKIN:Bang('!SetOption', 'MicText', 'Text', "MIC'S OFF")
      end	  

 
        sSecurity = string.match(sAllText, 'Security=(.-),')
     Meter = SKIN:GetMeter('SecurityBackground')
      if sSecurity == 'ON' then
         SKIN:Bang('!SetOption', 'SecurityAlarmBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'SecurityAlarmBackground', 'SolidColor', '0,0,0,0')
      end

      Meter = SKIN:GetMeter('SecurityAlarmText')
      if sSecurity == 'ON' then
		 SKIN:Bang('!SetOption', 'SecurityAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
		 SKIN:Bang('!SetOption', 'SecurityAlarmText', 'Text', "SECURITY SYSTEM ARMING! #CRLF# Please swipe card at nearest reader immediately to remain in building.")

      else
		 SKIN:Bang('!SetOption', 'SecurityAlarmText', 'Text', "")
      end	  
	  
        sMeeting = string.match(sAllText, 'Meeting=(.-),')
     Meter = SKIN:GetMeter('MeetingBackground')
      if sMeeting == 'ON' then
         SKIN:Bang('!SetOption', 'MeetingAlarmBackground', 'SolidColor', '#BoxColourALARM#')
      else
         SKIN:Bang('!SetOption', 'MeetingAlarmBackground', 'SolidColor', '0,0,0,0')
      end

      Meter = SKIN:GetMeter('MeetingAlarmText')
      if sMeeting == 'ON' then
		 SKIN:Bang('!SetOption', 'MeetingAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
		 SKIN:Bang('!SetOption', 'MeetingAlarmText', 'Text', "ALL STAFF MEETING ON NOW! #CRLF# Please head to the staff cafe for an all staff meeting.")

      else
		 SKIN:Bang('!SetOption', 'MeetingAlarmText', 'Text', "")
      end		  
	  

   io.close(hReadingFile)
   
   return tostring(sService)   
   
end
Any assistance that you could offer on why Rainmeter is crashing for me would be appreciated. If there is a better way of achieving what I am trying to do - please enlighten me I would appreciate any assistance.

Even better, if there's a way to take strings via UDP and push them straight into Rainmeter rather than via the text file, that would be awesome.

Thanks
Matt
User avatar
balala
Rainmeter Sage
Posts: 16658
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Update Skin from Text File Variables

Post by balala »

First please post the content of the Variables.inc, which you didn't.
Then a few errors of your code (these probably won't cause Rainmeter to crash, but however you should fix them):
  • W and H are options of a meter, you can't use them into the [Rainmeter] section. What can be used there, are the SkinWidth and SkinHeight.
  • The BoxColourALARM=247,13,18,[MeasureBlinkString] and BoxColourCALLER=0,152,234,[MeasureBlinkString] variables used in the [Variables] section probably won't work, because they would need to set the dynamic variables, but this isn't supported in the [Variables] section.
mcpaton
Posts: 27
Joined: March 17th, 2016, 2:18 am

Re: Update Skin from Text File Variables

Post by mcpaton »

HI

Thanks for looking over this, I've removed the W & H. The BoxColor variables do work, they make the buttons flash. If I remove those I get a solid white box rather than a flashing red / blue box.

99% of the variables file is in relation to other skins I have in the pack. The only variable that is relevent is:

Code: Select all

ConfigPath=file://C:\Data\PathfinderCommand\pathfinder.ini
Which is just the path back to the config file I have listed the contents of.

Thanks
Matt
RiseUp
Posts: 6
Joined: November 3rd, 2017, 8:08 pm

Re: Update Skin from Text File Variables

Post by RiseUp »

mcpaton wrote:<clipped>
If there is a better way of achieving what I am trying to do - please enlighten me I would appreciate any assistance.

Even better, if there's a way to take strings via UDP and push them straight into Rainmeter rather than via the text file, that would be awesome.

Thanks
Matt
Hi Matt,

Did you end up finding another way of doing this? I have a very similar need, and I'd like to know what is the best way of getting multiple, dynamic variable values into Rainmeter.

My first thought was to use WebParser with a local text file that was repeatedly updated by the source program (in my case, EventGhost). If Lua will be easier on the processor, then maybe I shall do something similar to what you posted.
mcpaton
Posts: 27
Joined: March 17th, 2016, 2:18 am

Re: Update Skin from Text File Variables

Post by mcpaton »

I tried using Lua scripts, but found that my (crude) code made Rainmeter unstable, and it would often crash.

I ended up slowing down the read rate a bit and left Web Parser scanning the local text file.

I'd love to write a UDP receive plugin, but don't have the time nor skill to do it properly.
User avatar
khanhas
Posts: 40
Joined: October 26th, 2016, 5:00 pm

Re: Update Skin from Text File Variables

Post by khanhas »

mcpaton wrote:I tried using Lua scripts, but found that my (crude) code made Rainmeter unstable, and it would often crash.

I ended up slowing down the read rate a bit and left Web Parser scanning the local text file.

I'd love to write a UDP receive plugin, but don't have the time nor skill to do it properly.
1. You used string.match totally 11 times. As my experience with Lua, string.match costs performance more than anything else.
2. GetMeter but never use them
3. if-else to check same variables twice, sometimes thrice.
With your patterned data file, there's a simpler and probably faster solution:

Code: Select all

function Initialize()
	dataTable = {
		Service = "",
		Studio = "",
		Delay = "",
		Sat = "",
		Audio = "",
		Clip = "",
		Hotline = "",
		Caller = "",
		Mic = "",
		Security = "",
		Meeting = "",
	}
end

function Update()
	sFileToRead = SELF:GetOption('FileToRead')
	
	hReadingFile = io.open(sFileToRead, "r")
	if not hReadingFile then
		print('LuaTextFile: unable to open file at ' .. sFileToRead)
		return
	end
	
	sAllText = hReadingFile:read('*all')
	hReadingFile:close() --Close file right after you read it.

	for k, v in sAllText.gmatch("(.-)=(.-),")
		if k ~= "Service" then
			dataTable[k] = (v == "ON") --true or false
		else
			dataTable[k] = v
		end
	end
	
	if dataTable.Studio then
		SKIN:Bang('!SetOption', 'StudioBackground', 'SolidColor', '#BoxColourON#')
		SKIN:Bang('!SetOption', 'StudioText', 'Text', 'STUDIO ON')
	else
		SKIN:Bang('!SetOption', 'StudioBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'StudioText', 'Text', 'STUDIO OFF')
	end

	if dataTable.Delay then
		SKIN:Bang('!SetOption', 'DelayBackground', 'SolidColor', '#BoxColourON#')
		SKIN:Bang('!SetOption', 'DelayText', 'Text', 'DELAY ON')
	else
		SKIN:Bang('!SetOption', 'DelayBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'DelayText', 'Text', 'DELAY OFF')
	end

	if dataTable.Sat then
		SKIN:Bang('!SetOption', 'SatBackground', 'SolidColor', '#BoxColourON#')
		SKIN:Bang('!SetOption', 'SatText', 'Text', 'Sat ON')
	else
		SKIN:Bang('!SetOption', 'SatBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'SatText', 'Text', 'Sat OFF')
	end

	if dataTable.Audio then
		SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'AudioAlarmBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'AudioText', 'Text', 'AUDIO FAIL')
		SKIN:Bang('!SetOption', 'AudioAlarmText', 'Text', "AUDIO FAIL! #CRLF# Please Check Console Levels Immediately!")
		SKIN:Bang('!SetOption', 'AudioAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
	else
		SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'AudioBackground', 'SolidColor', '#BoxColourON#')
		SKIN:Bang('!SetOption', 'AudioAlarmBackground', 'SolidColor', '0,0,0,0')
		SKIN:Bang('!SetOption', 'AudioText', 'Text', 'AUDIO OK')
		SKIN:Bang('!SetOption', 'AudioAlarmText', 'Text', "")
	end
 
	if dataTable.Clip then
		SKIN:Bang('!SetOption', 'ClipBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'ClipText', 'Text', 'TOO LOUD!')
	else
		SKIN:Bang('!SetOption', 'ClipBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'ClipText', 'Text', 'LEVELS OK')
	end

	if dataTable.Hotline then
		SKIN:Bang('!SetOption', 'HotlineBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'HotlineText', 'Text', 'HOTLINE!')
	else
		SKIN:Bang('!SetOption', 'HotlineBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'HotlineText', 'Text', 'HOTLINE!')
	end

	if dataTable.Caller then
		SKIN:Bang('!SetOption', 'CallerBackground', 'SolidColor', '#BoxColourCALLER#')
		SKIN:Bang('!SetOption', 'CallerText', 'Text', 'CALLER!')
	else
		SKIN:Bang('!SetOption', 'CallerBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'CallerText', 'Text', 'NO CALLS')
	end

	if dataTable.Mic then
		SKIN:Bang('!SetOption', 'MicBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'MicText', 'Text', "MIC'S ON")
	else
		SKIN:Bang('!SetOption', 'MicBackground', 'SolidColor', '#BoxColourOFF#')
		SKIN:Bang('!SetOption', 'MicText', 'Text', "MIC'S OFF")
	end

	if dataTable.Security then
		SKIN:Bang('!SetOption', 'SecurityAlarmBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'SecurityAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
		SKIN:Bang('!SetOption', 'SecurityAlarmText', 'Text', "SECURITY SYSTEM ARMING! #CRLF# Please swipe card at nearest reader immediately to remain in building.")
	else
		SKIN:Bang('!SetOption', 'SecurityAlarmBackground', 'SolidColor', '0,0,0,0')
	 	SKIN:Bang('!SetOption', 'SecurityAlarmText', 'Text', "")
	end 
	
	if dataTable.Meeting then
		SKIN:Bang('!SetOption', 'MeetingAlarmBackground', 'SolidColor', '#BoxColourALARM#')
		SKIN:Bang('!SetOption', 'MeetingAlarmText', 'FontColor', '255,255,255,[MeasureBlinkString]')
		SKIN:Bang('!SetOption', 'MeetingAlarmText', 'Text', "ALL STAFF MEETING ON NOW! #CRLF# Please head to the staff cafe for an all staff meeting.")
	else
		SKIN:Bang('!SetOption', 'MeetingAlarmBackground', 'SolidColor', '0,0,0,0')
		SKIN:Bang('!SetOption', 'MeetingAlarmText', 'Text', "")
	end

	return dataTable.Service
end
Reread the code to see if it fit your need.
TrippleT
Posts: 4
Joined: May 28th, 2018, 9:57 pm

Re: Update Skin from Text File Variables

Post by TrippleT »

Hi, I am reading date (dd MMM yy) from a text files to display on the skins, which is quite easy with Lua script to parse the text into date, compare date to work out if a date is in the future or the past

What I need to achieve is if the date is in the past then it is overdue hence I want to change the skin font (or background) to red. How do I do this with Rainmeter?
User avatar
balala
Rainmeter Sage
Posts: 16658
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Update Skin from Text File Variables

Post by balala »

TrippleT wrote:What I need to achieve is if the date is in the past then it is overdue hence I want to change the skin font (or background) to red. How do I do this with Rainmeter?
Please pack the config and upload it to can check.
TrippleT
Posts: 4
Joined: May 28th, 2018, 9:57 pm

Re: Update Skin from Text File Variables

Post by TrippleT »

All good, I got it work by using SKIN:Bang to change the meter value, quite simple actually. I was doing it wrong at first attempt, using the skin to call the lua script.
User avatar
balala
Rainmeter Sage
Posts: 16658
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Update Skin from Text File Variables

Post by balala »

TrippleT wrote:All good, I got it work by using SKIN:Bang to change the meter value, quite simple actually. I was doing it wrong at first attempt, using the skin to call the lua script.
Ok, great...