It is currently June 27th, 2024, 8:35 pm

[!Refreshapp] when skin loaded?

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Thanks :thumbup:

Appreciate what you've done. Sorry for the narrative, I get impatient and frustrated easily! Found out recently I have ADHD as well as insomnia! O.O I'm not talkative by nature, just the opposite tbh! :oops: Didn't realise you were following, thought you were just on and off the forum helping others. :Whistle

What was wrong though? I couldn't see what was wrong with what I did. I think there were conflicts with changing the MicIcon colour, it works one minute but then another issue arose where I have to click on the Line In twice to Mute, but trouble is, though the skin doesn't react to the first click, the PC does. Meaning it's always opposite to what it shows! That was with my code though.

I got a bit further since posting that whole code before. Was going to update it but you beat me to it.
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

I think those RegExSubstitutes are hiding the meter text so I can't click or scroll to change any settings. :lol:
Also, BarMeters aren't working. :thumbdown:

EDIT: Forgot to change the devices Variables back to my own! :oops: :rolmfao:
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Got Bar meters working but still can't figure out why the string percent meters don't show, Any idea what's causing that?

What are these? FinishAction=[!SetOption LineVol Formula [mRunLineVol]]
Is it meant to be a !SetVariable, not !SetOption?
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Btw, I think the Mic Input and Line In use the same port on laptops. You should check. I could be wrong though, it may be Mic and Line Out? Long time ago now but I had a laptop with one port and found it was a combi jack.
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Mostly sorted. Just two issues as far as I can tell...

1. After Loading or a Refresh, middle click on Line In actually Mutes the system Line In, but it isn't registered on Rainmeter as being Muted until you click a second time. This then Unmutes the System and Rainmeter now shows that it is Muted. This worked before and I have no idea why that stopped working.

2. Disconnecting the Mic doesn't set the icon to #White60#, it just stays green. This is what I tried, but it doesn't work now you've changed things. Now, it stays grey...

Code: Select all

[Variables]
MicColor=

[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
IfMatch="#Mic#"
IfMatchAction=[!SetOption MicIcon FontColor "#MicColor#"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MicIcon FontColor "#White60#"][!UpdateMeter *][!Redraw]

[mRunMicMute]
IfMatch=1
IfMatchAction=[!SetVariable MicColor "#Red#"][!UpdateMeter MicIcon][!Redraw]
IfNotMatchAction=[!SetVariable MicColor "#Green#"][!UpdateMeter MicIcon][!Redraw]
So, the way it's supposed to work is:
1. Mic Disconnected = #White60#
2. Mic Connected and Active = #Green#
3. Mic Connected and Muted = #Red#

I just can't seem to get both working, one measure always takes priority. My idea was to have the icon turn grey when disconnected by changing the MicIcon meter FontColor=#White60#. But when I plug it in, set that meter to FontColor=#MicColor#. The fact it is connected, changes the variable used to one that the IfMatch uses separately from the [mRunMicMute] one, meaning it shouldn't conflict. Then I could use the IfMatch to set the new variable to Red or Green, but it does conflict for some reason I can't figure out.

Hope that makes sense. :D
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Here's the latest code:

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure mRunMicVol "Run"][!CommandMeasure mRunLineVol "Run"][!CommandMeasure mRunMicMute "Run"][!CommandMeasure mRunLineMute "Run"]
SkinHeight=44

[Metadata]
Name=RoundVolume
Author=sl23
Information=Adjust Mic volume.||Credits:||Help via forum: JSMorley, death.crafter, Yincognito.||Thanks to JSMorley for the AudioDeviceList skin. Massive thanks to Yincognito, without whom, this wouldn't have happened!
Version=2024.06.18
License=CC BY 3.0

[Variables]
Aqua=0,255,255
AquaDark=64,191,167,200
AquaDark2=0,255,255,150
Green=128,255,0,220
Orange=255,170,0
Red=255,100,100
Trans=0,0,0,1
White=255,255,255,200
White20=255,255,255,20
White60=255,255,255,60
Yellow=255,255,0,200

BgFill=0,0,0,150
VolBar=64,191,167,200

VolLow=25
VolMax=80
InputStep=5
MicVol=
LineVol=
MicMute=
LineMute=

NAME1=Low
NAME2=Mute
NAME3=Hi

; CmdFriendlyID=DeviceName\Type\Name\Direction
; CmdFriendlyID=USB Audio\Device\Microphone\Capture
Mic=USB Audio\Device\Microphone\Capture
Line=Realtek(R) Audio\Device\Line In\Capture

---Background---

[Bg]
Meter=Shape
Shape=Rectangle 0,0,170,40,5 | FillColor #BgFill# | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color #White60#
UpdateDivider=-1
X=1
Y=1

---Styles---

[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=12
FontColor=#White#
AntiAlias=1
DynamicVariables=1

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Green#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

[sBar]
BarOrientation=Horizontal
BarColor=#Yellow#
SolidColor=#White60#
DynamicVariables=1
W=150
H=1

---Set Audio In Volume---

[mMicdbLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Input
RMSAttack=50
RMSDecay=300
RMSGain=10

[mDeviceStatus]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceStatus
Substitute="0":"Off","1":"On"

[mDeviceList]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceList
Substitute="}: ":"}		"
OnChangeAction=[!Refresh]

;One way to do this:
;- set a numerical variable in the [mDeviceName]'s IfMatch actions, by replacing the existing actions
;- test both the MicMute measure and (using && or || as needed) the above variable in the IfCondition from [MicMute] and set FontColor directly in the meter

[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
Substitute="(Realtek(R) Audio)":"(R)","(USB Audio)":"(USB)","Microphone":"Mic"

IfMatch="Mic"
IfMatchAction=[!EnableMeasure MicMute][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!DisableMeasure MicMute][!UpdateMeter *][!Redraw]

[mDeviceID]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceID
RegExpSubstitute=1
Substitute="{.*}\.":""

[mDeviceFormat]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=Format

---Get Audio In Status---

[mRunMicVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicVol Formula [mRunMicVol]][!UpdateMeasure MicVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1

[MicVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1

[mRunMicMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicMute Formula [mRunMicMute]][!UpdateMeasure MicMute][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MicMute]
Measure=Calc
Formula=0
IfCondition=(MicMute=1)
IfTrueAction=[!SetOption MicIcon Text "[\xEC54]"][!SetOption MicIcon FontColor "#Red#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MicIcon Text "[\xE720]"][!SetOption MicIcon FontColor "#Green#"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[mRunLineVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineVol Formula [mRunLineVol]][!UpdateMeasure LineVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1

[LineVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1

[mRunLineMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineMute Formula [mRunLineMute]][!UpdateMeasure LineMute][!UpdateMeter *][!Redraw]
DynamicVariables=1

[LineMute]
Measure=Calc
Formula=0
Substitute="0":"UnMuted","1":"Muted"
IfCondition=(LineMute=1)
IfTrueAction=[!SetOption LineIcon Text "[\xEC54]"][!SetOption LineIcon FontColor "#Red#"] [!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption LineIcon Text "[\xE720]"][!SetOption LineIcon FontColor "#Yellow#"] [!UpdateMeter *][!Redraw]
DynamicVariables=1

---METERS---

[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
FontColor=#White60#
Text=

LeftMouseUpAction=[Play "#@#Volume\Copy.wav"][!SetClip "; Windows Default Input Device:#CRLF##CRLF#; Device Name:      [mDeviceName]#CRLF#; Device ID:        [mDeviceID]#CRLF#; Device Format:    [mDeviceFormat]#CRLF#; Device Status:    [mDeviceStatus]#CRLF##CRLF#; Device List:#CRLF##CRLF#[mDeviceList]"]
MiddleMouseUpAction=[!Refresh]
RightMouseUpAction=[!CommandMeasure mRunMicVol "Run"]

X1MouseUpAction=ms-settings:sound
X2MouseUpAction=[control mmsys.cpl]

ToolTipIcon=Info
ToolTipTitle=[mDeviceName] - [mDeviceStatus]
ToolTipText=L - Copy Device List#CRLF#M - Refresh#CRLF#R - #CRLF#X1 - CP Sound Settings#CRLF#X2 - Main Sound Settings

X=30
Y=8

[MicPercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Text=[MicVol]

LeftMouseUpAction=[!SetVariable MicVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 25][!CommandMeasure mRunMicVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Mic#"][!CommandMeasure mRunMicMute "Run"][!Update]
RightMouseUpAction=[!SetVariable MicVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 80][!CommandMeasure mRunMicVol "Run"][!Update]

TooltipIcon=Info
ToolTipTitle=Mic - [mRunMicMute]
ToolTipText=.

MouseScrollUpAction=[!SetVariable MicVol (Clamp(#MicVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" 5][!CommandMeasure mRunMicVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable MicVol (Clamp(#MicVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" -5][!CommandMeasure mRunMicVol "Run"][!Update]
X=25r
Y=-2r

[LineIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
Text=[\xE720]

X=55r
Y=8

[LinePercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Text=[LineVol]

LeftMouseUpAction=[!SetVariable LineVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 25][!CommandMeasure mRunLineVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Line#"][!CommandMeasure mRunLineMute "Run"][!Update][!Refresh]
RightMouseUpAction=[!SetVariable LineVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 80][!CommandMeasure mRunLineVol "Run"][!Update]

TooltipIcon=Info
ToolTipTitle=Line In - [mRunLineMute]
ToolTipText=.

MouseScrollUpAction=[!SetVariable LineVol (Clamp(#LineVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" 5][!CommandMeasure mRunLineVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable LineVol (Clamp(#LineVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" -5][!CommandMeasure mRunLineVol "Run"][!Update]
X=25r
Y=-2r

[MicBar]
Meter=Bar
MeasureName=MicVol
MeterStyle=sBar
BarColor=#Green#
X=11
Y=30

[LineBar]
Meter=Bar
MeasureName=LineVol
MeterStyle=sBar
BarColor=#Yellow#
X=11
Y=34

[LevelBar]
Meter=Bar
MeasureName=mMicdbLevel
MeterStyle=sBar
BarColor=#AquaDark#
X=11
Y=38

Last edited by sl23 on June 21st, 2024, 1:30 pm, edited 1 time in total.
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Sorry, doing it again! :oops: I've just noticed that scrolling the Line In makes it jump on occasion, giving the wrong value compared to the system value.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7547
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [!Refreshapp] when skin loaded?

Post by Yincognito »

sl23 wrote: June 20th, 2024, 9:15 pm What are these? FinishAction=[!SetOption LineVol Formula [mRunLineVol]]
Is it meant to be a !SetVariable, not !SetOption?
Nope. It's a SetOption, since I used identically named measures instead of variables, like already explained here:
Yincognito wrote: June 20th, 2024, 8:25 pm I mainly adjusted the measures, didn't touch the meters, so there might be some mistakes left on the latter. Don't forget to set stuff on the MicVol MEASURE and not VARIABLE in the meters, since I used a measure because it was needed for percentual values (you can't have percentual values on a variable, duh).
So, the fact that you didn't correspondingly modify the meters to act on the MicVol, MicMute, LineVol and LineMute measures instead of variables (already mentioned as well) could explain the scrolling jump.
I just can't seem to get both working, one measure always takes priority.
One way to do this:
- set a numerical variable in the [mDeviceName]'s IfMatch actions, by replacing the existing actions
- test both the MicMute measure and (using && or || as needed) the above variable in the IfCondition from [MicMute] and set FontColor directly in the meter
After Loading or a Refresh, middle click on Line In actually Mutes the system Line In
Are you sure? I only see switching to #Line# and getting (not setting) the #Line#'s mute state in that middle mouse action ...

Time to get sleepy now, maybe you'll get the ideas above until tomorrow. :sly:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Oh jeez! Sorry. Think I need a break! Can't see the wood for the trees! Just so tired finding it hard to do this stuff now. Thanks for explaining. Appreciate you're help. A lot! :rosegift: :yahoo:
Last edited by sl23 on June 21st, 2024, 9:41 am, edited 2 times in total.
- MuLab -
User avatar
sl23
Posts: 1225
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [!Refreshapp] when skin loaded?

Post by sl23 »

Scrolling fast on the Mic volume does create a jump occasionally, but corrects itself on the next adjust. Same with Line In, though Mic only seems to do this if adjusted too quickly, Line In does it regularly. Perhaps this is the unreliability you mentioned? Is it a NirSoft issue or a Microsoft one?

Also, the Mutes work, do their job each time they are clicked, again, only Line In suffers here. It very often doesn't update the Mute status and shows the Mute icon when it's not muted and then every click shows the opposite icon. I can't tell if it's the code or another NirSoft/MS issue. Every click performs a change in state, but doesn't always update the skin. Sometimes it can take several clicks to update it.
Are you sure? I only see switching to #Line# and getting (not setting) the #Line#'s mute state in that middle mouse action ...
Yes, sure, but it doesn't update Rainmeter. Every single Refresh is the same, M-click Line In changes the system Mute status, but doesn't update Rainmeter. The only way to get it working properly is to set [!Refresh] at the end of the MiddleMouseUpAction. Tried [!Redraw], same result, doesn't work.

All Bar meters work well too. I may change these to roundline though for this skin. The idea was to merge this code with another skin and will need the meters set as bars I think. Space is tight on the TaskBar, especially in the skin I want to merge this with!

If there's any chance of getting the Line In Mute status working, that would be great. It should run the command to get the info each time it's muted but that just doesn't seem to be the case. Refreshing the skin will always update it correctly, so I'm thinking Ive missed something?

All the Mouse action commands are identical to the Mic versions, obviously changed to suit Line In, and the Mic works, so I'm thinking this can't be a Rainmeter issue then?

The only difference is the LineVol calc measure, where this line is not in the MicVol calc measure: Substitute="0":"UnMuted","1":"Muted". These words are not used in the skin anywhere and are only mentioned here in the code. They are shown in the About/Skins window. Disabling it doesn't break or fix anything though.

Lastly, the MicIcon...
One way to do this:
- set a numerical variable in the [mDeviceName]'s IfMatch actions, by replacing the existing actions
- test both the MicMute measure and (using && or || as needed) the above variable in the IfCondition from [MicMute] and set FontColor directly in the meter
Trying to wrap my poor brain around this! :rofl:
I am curious, why my approach doesn't work though? Logically, it made sense, so I can't understand why! One sets a variable and one sets the meter, no conflicts, yet it doesn't work, why?

My attempts:
So, I get the first line, I think:

Code: Select all

IfMatchAction=[!SetVariable MicIconColor 1][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetVariable MicIconColor 2][!UpdateMeter *][!Redraw]
Test both MicMute and Above Variable, you mean the one I just specified, or the original one?
IfMatch=[MicMute] || "#MicIconColor#"
Set Icon Colour:

Code: Select all

[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
FontColor=#White60#
Also, tried this logic, which, to me, seems right. Maybe I'm not expressing it the right way though?

Code: Select all

[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
IfMatchAction=[MicMute][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MicIcon FontColor "#White60#"][!UpdateMeter *][!Redraw]

[MicMute]
Measure=Calc
Formula=0
IfCondition=(MicMute=1)
IfTrueAction=[!SetOption MicIcon Text "[\xEC54]"][!SetOption MicIcon FontColor "#Red#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MicIcon Text "[\xE720]"][!SetOption MicIcon FontColor "#Green#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
This one, doesn't even show the MicIcon meter at all:

Code: Select all

[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
Substitute="(Realtek(R) Audio)":"(R)","(USB Audio)":"(USB)","Microphone":"Mic"
IfMatch="Mic"
IfMatchAction=[!EnableMeasure MicMute][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!DisableMeasure MicMute][!UpdateMeter *][!Redraw]
Nah! Sorry, I just really don't understand why you're saying to test MicMute state when I need device name to see if it's connected? :???:
I don't see the logic of how your proposal works. Essentially, there are three states of the MicIcon:
1. Disconnected
2. Connected and UnMuted
3. Connected and Muted.
IfMatch doesn't register more than two options. IfAbove, IfEqual and IfBelow seem more appropriate. But I would need to use both the IfMatch and IfActions in the same measure to work. Wouldn't I?

This is how I previously saw it, and still do, and how it should work, but doesn't:

Code: Select all

             Yes = Use [MicMute] (ie: 'Muted' below) to set icon colour and text
           /
MatchName =
           \
             No = Set colour to #White60# (Grey)


             Yes = Set icon colour to #Red# & set icon text to [\xEC54]
           /
 Muted =
           \
             No = Set icon colour to #Green# & set icon text to [\xE720]
Plugging/unplugging the Mic does change the String in About/Skins, from Mic to Line. So that is working, but it won't change the IfMatch for mDeviceName to false, ie: not match.

Other than all that, it's great! Thank you again for saving my sanity! :D :thumbup:
EDIT: Edited latest code above to most recent.
Last edited by sl23 on June 21st, 2024, 1:30 pm, edited 21 times in total.
- MuLab -