I suppose that in a perfect world the numeric value of a child measure with Type=DeviceList could be the count.
[MeterDeviceInfo]
Meter=String
FontColor=255,255,255
FontSize=11
AntiAlias=1
Text=Total Devices: [MeasureDeviceList:]#CRLF#[MeasureDeviceList]
DynamicVariables=1
It is currently April 27th, 2024, 4:34 pm
AudioLevel
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
-
- Posts: 424
- Joined: February 8th, 2015, 10:07 pm
- Location: EU, Denmark.
Re: AudioLevel
Code: Select all
[MeasureDeviceList]
Measure=Plugin
Plugin=AudioLevel
Parent=DeviceList
[DeviceNumberInfo]
Meter=String
Text=Total Devices: [MeasureDeviceList:]#CRLF#[MeasureDeviceList]
FontColor=255,255,255
StringAlign=Center
FontFace=GeForce Regular
FontSize=20
AntiAlias=1
X=300r
Y=r
Nope
I've got 4 active devices
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: AudioLevel
Did I say it WAS a perfect world?StArL0rd84 wrote: Nope
I've got 4 active devices
I was actually just suggesting that feature to dgrace...
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: AudioLevel
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
[DeviceList]
Measure=Plugin
Plugin=AudioLevel
Type=DeviceList
OnChangeAction=[!UpdateMeasure DeviceCount]
[DeviceCount]
Measure=Script
ScriptFile=DeviceCount.lua
UpdateDivider=-1
[DeviceNumberInfo]
Meter=String
MeasureName=DeviceList
FontColor=255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=11
AntiAlias=1
DynamicVariables=1
Text=Total Devices: [DeviceCount]#CRLF#Device List:#CRLF#[DeviceList]
Code: Select all
function Initialize()
deviceList = SKIN:GetMeasure('DeviceList')
end
function Update()
dummyValue, deviceCount = string.gsub(deviceList:GetStringValue(), '\n', '')
return (deviceCount + 1)
end
The clever bit is that it returns two values. First, the new string with the replacements done, which we actually don't need at all, and second, the number of "instances" that it was able to replace.
So we replace all occurrences of '\n' (a newline) with '' (an empty string) in the value of the [DeviceList] measure from the skin. That gives me 3 newlines in my system. But wait, there isn't a newline at the end of the last entry, so we need to add 1 to the value to get the real count.
So we return deviceCount + 1 to the skin and use it in our meter.
P.S. Don't forget the DynamicVariables=1 on the meter when you use [SectionVariables], like you did a minute ago...
You do not have the required permissions to view the files attached to this post.
-
- Posts: 424
- Joined: February 8th, 2015, 10:07 pm
- Location: EU, Denmark.
Re: AudioLevel
Oh i am sorry, i misunderstood you.jsmorley wrote:Did I say it WAS a perfect world?
I was actually just suggesting that feature to dgrace...
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: AudioLevel
Not a problem. Be sure to check the Lua solution I posted above. It's really quite simple.StArL0rd84 wrote:Oh i am sorry, i misunderstood you.
-
- Posts: 424
- Joined: February 8th, 2015, 10:07 pm
- Location: EU, Denmark.
Re: AudioLevel
Thank so much for the Lua solution jsmorley, it totally works.jsmorley wrote:Not a problem. Be sure to check the Lua solution I posted above. It's really quite simple.
I disabled all the greyed out devices and it returned the correct number of devices.
Some day i will learn Lua, i hope, because it is so powerful.
I delved into it a bit but i guess for me the learning curve is a bit high.
I really don't like to log on here and just get the answers for free without much work on my part.
But at the same time i really appreciate you guys helpfulness.
A big thank you to all yall is in order.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
-
- Posts: 305
- Joined: August 14th, 2009, 8:04 am
Re: AudioLevel
Whoops, I posted a solution, but didn't realize one was already provided on the last page.
Lua is really easy to learn, it's like Python, or simplified C++, and so much more elegant than building Rube Goldberg machines out of measures in Rainmeter.
http://luatut.com/crash_course.html
Lua is really easy to learn, it's like Python, or simplified C++, and so much more elegant than building Rube Goldberg machines out of measures in Rainmeter.
http://luatut.com/crash_course.html
-
- Posts: 424
- Joined: February 8th, 2015, 10:07 pm
- Location: EU, Denmark.
Re: AudioLevel
So sorry to bother you guys again
but would it be possible to convert the windows string DeviceID to a number value?
but would it be possible to convert the windows string DeviceID to a number value?
Code: Select all
[MeasureCurrentDevice]
Measure=Plugin
Plugin=AudioLevel
Type=DeviceID
[CurrentDeviceInfo]
Meter=String
MeasureName=MeasureCurrentDevice
FontColor=255,255,255
FontSize=11
AntiAlias=1
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: AudioLevel
Sure, but need a slightly different approach than simply counting newlines. More like something killall-q posted a bit ago and then deleted...StArL0rd84 wrote:So sorry to bother you guys again
but would it be possible to convert the windows string DeviceID to a number value?
Skin:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
[Variables]
CurrentDeviceNum=""
[MeasureDeviceList]
Measure=Plugin
Plugin=AudioLevel
Type=DeviceList
[MeasureCurrentDevice]
Measure=Plugin
Plugin=AudioLevel
Type=DeviceID
OnChangeAction=[!UpdateMeasure MeasureDeviceInfo]
[MeasureCurrentDeviceName]
Measure=Plugin
Plugin=AudioLevel
Type=DeviceName
[MeasureDeviceInfo]
Measure=Script
ScriptFile=DeviceInfo.lua
UpdateDivider=-1
[MeterDeviceInfo]
Meter=String
FontColor=255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=11
AntiAlias=1
DynamicVariables=1
Text=Current Device Number: #CurrentDeviceNum##CRLF#Current Device ID: [MeasureCurrentDevice]#CRLF#Current Device Name: [MeasureCurrentDeviceName]#CRLF##CRLF#Total Devices: [MeasureDeviceInfo]#CRLF#Device List:#CRLF#[MeasureDeviceList]
Code: Select all
function Initialize()
deviceList = SKIN:GetMeasure('MeasureDeviceList')
currentDevice = SKIN:GetMeasure('MeasureCurrentDevice')
end
function Update()
local currentNum = 0
local stringList = deviceList:GetStringValue()
local matchDevice = currentDevice:GetStringValue()
for listEntry in string.gmatch(stringList, '{.-}%.{.-}') do
currentNum = currentNum + 1
if listEntry == matchDevice then
SKIN:Bang('!SetVariable', 'CurrentDeviceNum', currentNum)
end
end
return (currentNum)
end
You do not have the required permissions to view the files attached to this post.