It is currently May 2nd, 2024, 10:56 am

Swapping text every X seconds

Get help with creating, editing & fixing problems with skins
Unjustified
Posts: 6
Joined: August 4th, 2012, 10:26 pm

Swapping text every X seconds

Post by Unjustified »

Hey guys, Im quite new to Rainmeter, but not to programming, so I've gotten used to the basics, but Im stuck with one thing. I've created a skin to show cpu / ram / swap / hard drives / network usage, and on the top of it there is a Meter showing the computer name and OS... I also have a seperate MEter showing which user in logged on, and what I want to do is set it to rotate between the 2 meters every 30 seconds or so. Jusat to ease things, I've cut out the coding for everything that works...

My Measures

Code: Select all

[MeasureOS]
MEasure=Plugin
Plugin=SysInfo
SysInfoType=OS_VERSION

[MeasureOSBits]
MEasure=Plugin
Plugin=SysInfo
SysInfoType=OS_BITS

[MeasurePCName]
MEasure=Plugin
Plugin=SysInfo
SysInfoType=COMPUTER_NAME

[MeasureUser]
MEasure=Plugin
Plugin=SysInfo
SysInfoType=USER_NAME

[MeasureChanger]
Measure=Script
ScriptFile=Script.lua
and my Meters

Code: Select all

[MeterOS]
Meter=String
MeasureName=MeasureOS
MeasureName2=MeasureOSBits
MeasureName3=MeasurePCName
X=132
Y=5
W=190
H=15
AutoScale=1
FontColor=#FontColor#
AntiAlias=1
NumOfDecimals=0
Text=%3: %1 - %2Bit
Hidden=0

[MeterUser]
Meter=String
MeasureName=MeasurePCName
MeasureName2=MeasureUser
X=132
Y=5
W=190
H=15
AutoScale=1
FontColor=#FontColor#
AntiAlias=1
Text=%1: %2 is logged in
Hidden=0

[MeterChanger]
Meter=String
MeasureName=MeasureChanger
X=132
Y=5
W=190
H=15
AutoScale=1
UpdateDivider=10
FontColor=#FontColor#
AntiAlias=1
Text=" "
Script.lua is as follows

Code: Select all

function Initialize()
	Meter1 = SKIN:GetMeter('MeterOS')
	Meter1:Hide()
	Meter2 = SKIN:GetMeter('MeterUser')
	Meter2:Show()
end

function Update()
	Meter1 = SKIN:GetMeter('MeterOS')
	Shown1 = Meter1:GetOption('Hidden')
	Meter2 = SKIN:GetMeter('MeterUser')
	Shown2 = Meter2:GetOption('Hidden')
	if Shown1 == 1 then
		Meter1:Show()
		Meter2:Hide()
	elseif Shown2 == 1 then
		Meter1:Hide()
		Meter2:Show()
	end
end
If anyone could offer any hlep, I want the [MeterOS] and [MeterUser] to change every 30 seconds or so.

Thanks guys!
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Swapping text every X seconds

Post by smurfier »

Code: Select all

[Rainmeter]
Update=100

[MeasureChanger]
Measure=Calc
Formula=MeasureChanger%30+1
IfEqualValue=30
IfEqualAction=!ToggleMeterGroup Changer

[MeterOS]
...
Group=Changer
Hidden=1

[MeterUser]
...
Group=Changer
Hidden=0
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Unjustified
Posts: 6
Joined: August 4th, 2012, 10:26 pm

Re: Swapping text every X seconds

Post by Unjustified »

Thanks, this works perfectly!