It is currently April 27th, 2024, 11:08 am

Help with Rainmeter Teamspeak Skin

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Rainmeter Teamspeak Skin

Post by balala »

jsmorley wrote: November 16th, 2018, 3:23 pm That won't change the output of Windows API error messages, which that fetch error is...
enderep12 said that message appears in Rainmeter log, that's why I thought to change the language to English. Sorry if I was mistaken...
enderep12
Posts: 15
Joined: November 15th, 2018, 2:47 pm

Re: Help with Rainmeter Teamspeak Skin

Post by enderep12 »

All good, I figured it out! After adding DynamicVariables=1 to the channelname meter this one is now working as well!

With WebParser the performance problems are gone, and the special chars are also encoded correctly now!

Thanks everyone for helping!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with Rainmeter Teamspeak Skin

Post by jsmorley »

enderep12 wrote: November 16th, 2018, 3:15 pm Yup, that did it in part with moving the io.close after the for loops for the if/else. Thanks! The file is now properly closed after each write (which happens on a "onChannelMove" event (which is when somebody on the server changes channels):

Working Code:

Code: Select all

	if channelID == ownChannel then
		local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w+")
		io.output(file)
		io.write("".. channelName .."\n")
		for i=1, #clientList do
			local tempClientId = clientList[i]
			local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
			io.write("".. tempClientName .."\n")
		end
		io.close()
	else
		local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w+")
		io.output(file)
		io.write("".. ownChannelName .."\n")
		for i=1, #clientList do
			local tempClientId = clientList[i]
			local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
			io.write("".. tempClientName .."\n")
		end
		io.close()
	end
Now balalas snippet is working as well and parsing the username correctly in my skin! Now for the channel name :D
Doesn't matter, but just for information's sake, adding the extra io.close() statements didn't change anything, only the "w+" (open for create/write in non-exclusive mode) did.

Only one of any If / else statements will ever be executed. So the file can only ever be opened once in this code, and only a single io.close() is really needed after the if / else / end block. It won't hurt to have it the way you do now though.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with Rainmeter Teamspeak Skin

Post by jsmorley »

balala wrote: November 16th, 2018, 3:28 pm enderep12 said that message appears in Rainmeter log, that's why I thought to change the language to English. Sorry if I was mistaken...
No reason why anyone would easily be able to tell what error text is generated by Rainmeter, and what might just be an error from Windows that Rainmeter is just passing along. Your assumption was not at all unreasonable.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Rainmeter Teamspeak Skin

Post by balala »

enderep12 wrote: November 16th, 2018, 3:25 pm EDIT: FIXED IT, I was missing a DynamicVariables=1 in the meter for channel name!
To avoid the need of using dynamic variables, replace the Text option with Text=%1 and add a MeasureName=MeasureUsers option to the [meterTSViewer] meter. Now you can freely remove the DynamicVariables=1 option.
Additional tip: even if you use the Text="[MeasureUsers]" form of the option, the quotes are not needed.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Rainmeter Teamspeak Skin

Post by balala »

jsmorley wrote: November 16th, 2018, 3:35 pm Your assumption was not at all unreasonable.
Thanks!
enderep12
Posts: 15
Joined: November 15th, 2018, 2:47 pm

Re: Help with Rainmeter Teamspeak Skin

Post by enderep12 »

I have another one now, sorry for bothering you guys so much :Whistle

So, as mentioned I currently have the Skin running and everything is parsing fine.

There's two more things I'd like to clarify (which is not entirely clear to me from the documentation):
1st: Is it possible to update the meter only when the text file has changed? With the quote plugin this was possible with OnChangeAction=[!UpdateMeter "meterName"][!Redraw] - Does this still apply to the Webparser and where would I need to add this within my skin?

Because right now the skin does not update at all.. Even when the .txt file changes. If I do a manual skin reload, it shows the updated .txt file again. Shouldn't it normally update via the Update=1000 I set in [Rainmeter]?

2nd: If my channel name is very long, it draws over the skin, is it possible to change the size of the text dynamically accordingly? Or can I only use the ClipString option to make the text wrap around?

Current .ini:
TSViewer.ini
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with Rainmeter Teamspeak Skin

Post by jsmorley »

enderep12 wrote: November 16th, 2018, 3:52 pm I have another one now, sorry for bothering you guys so much :Whistle

So, as mentioned I currently have the Skin running and everything is parsing fine.

There's two more things I'd like to clarify (which is not entirely clear to me from the documentation):
1st: Is it possible to update the meter only when the text file has changed? With the quote plugin this was possible with OnChangeAction=[!UpdateMeter "meterName"][!Redraw] - Does this still apply to the Webparser and where would I need to add this within my skin?

Because right now the skin does not update at all.. Even when the .txt file changes. If I do a manual skin reload, it shows the updated .txt file again. Shouldn't it normally update via the Update=1000 I set in [Rainmeter]?

2nd: If my channel name is very long, it draws over the skin, is it possible to change the size of the text dynamically accordingly? Or can I only use the ClipString option to make the text wrap around?

Current .ini:
TSViewer.ini
First, WebParser updates based on the UpdateRate setting on it, which defaults to 600, which with Update=1000 on the skin, is every 10 minutes. You can change that setting on the parent WebParser measure to have it update more often.

Second, it's difficult to base FontSize on the length of a string in characters, as Rainmeter has no way to know how many characters are in a string. All it can know is how wide in pixels a meter is that contains the string. So you would need something like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureText]
Measure=String
String=Hello World
OnChangeAction=[!UpdateMeasure AdjustFont]

[AdjustFont]
Measure=Calc
IfCondition=[MeterOne:W] <= 100
IfTrueAction=[!SetOption MeterOne FontSize "15"][!UpdateMeter *][!Redraw]
IfCondition2=[MeterOne:W] > 100
IfTrueAction2=[!SetOption MeterOne FontSize "12"][!UpdateMeter *][!Redraw]
DynamicVariables=1
UpdateDivider=-1

[MeterOne]
Meter=String
MeasureName=MeasureText
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
You would need an IfCondition to account for every length, so it always reacts properly. There can be as few or as many as you want for granularity of size.

It's a bit complicated, as if you don't restrict it to only when the measure getting the string "changes", it will get into an endless loop of the string being too long, changing the font size, then the string is short enough, so it changes the font size back, and so on forever.

To be honest, I'd be tempted to just ClipString it, and have a ToolTipText that shows the entire thing when you hover over it.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Rainmeter Teamspeak Skin

Post by balala »

jsmorley wrote: November 16th, 2018, 4:22 pm First, WebParser updates based on the UpdateRate setting on it, which defaults to 600, which with Update=1000 on the skin, is every 10 minutes. You can change that setting on the parent WebParser measure to have it update more often.
Although not recommended, the WebParser measure updates based on both, UpdateRate and UpdateDivider, if both are set. I think I never seen something like this, but practically can be set both, although as I said (and the Update Guide describes it, under the What about UpdateRate? section), in such cases, issues can occur. That's why it's not recommended to use both, instead use just the UpdateRate.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with Rainmeter Teamspeak Skin

Post by jsmorley »

balala wrote: November 16th, 2018, 4:42 pm Although not recommended, the WebParser measure updates based on both, UpdateRate and UpdateDivider, if both are set. I think I never seen something like this, but practically can be set both, although as I said (and the Update Guide describes it, under the What about UpdateRate? section), in such cases, issues can occur. That's why it's not recommended to use both, instead use just the UpdateRate.
Correct. You want the skin to react immediately to any change in the values that WebParser gets when it "goes out" and retrieves the resource based on UpdateRate. Using UpdateDivider on the measure only risks a "lag" from the time the value is retrieved, and when the measure(s) use it.

UpdateDivider is risky and uneeded on WebParser parent measures, and entirely ignored (as far as the value is concerned) on WebParser child measures. The parent measure "forces" the value on the child measures, UpdateDivider on them won't do anything.

The only thing UpdateDivider would control on a WebParser child measure is how often measure actions like IfCondition or IfMatch are fired, and I simply can't see a use case for when that wouldn't be the same as the skin update. You also want those to react immediately to any change in the value from the parent.

The long and the short of it is that I would NEVER use UpdateDivider on any WebParser parent or child measure. I would use UpdateRate on the parent, and that's it...