It is currently May 3rd, 2024, 7:44 am

Refresh a external Variable

Get help with creating, editing & fixing problems with skins
WezzLee
Posts: 35
Joined: June 11th, 2012, 5:29 pm

Refresh a external Variable

Post by WezzLee »

Hello, I am having a small problem, I want to refresh the display of some NowPlaying.dll variables depending on the PlayerName= variable.
In short if someone changes media player, how do I incorporate a button to refresh the Measures/Meters. I have tried using both !UpdateMeter and !UpdateMeasure both do not seem to work.
[MeterMediaRefresh]
Meter=IMAGE
ImageName=#SKINSPATH#Dota Menu\Resources\Images\mediarefresh.png
X=1155
Y=100
Hidden=1
AntiAlias=1
LeftMouseUpAction=!execute [!UpdateMeter MeterArtist][!UpdateMeter MeterTitle][!UpdateMeter
MeterPosition][!UpdateMeter MeterState][!UpdateMeasure MeasureState][!UpdateMeasure
MeasurePosition][!UpdateMeasure MeasureTitle][!UpdateMeasure MeasureArtist][!
RainmeterRedraw]
That is the Meter for a small refresh button.
[MeasureTitle]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#MediaPlayerName#
PlayerType=TITLE
DisableLeadingZero=0
That is an example of one of the Measures I want to refresh.
[MeterTitle]
Meter=String
X=1000
Y=70
Hidden=1
MeasureName=MeasureTitle
MeterStyle=TextStyleTitle
If needed the corresponding Meter

PS. I don't want to refresh the entire skin!
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Refresh a external Variable

Post by dragonmage »

To start I'm pretty sure that to have any chance of this working you are going to need DynamicVariables=1 on all your measures and meters that need to change when #MediaPlayerName# changes.
WezzLee
Posts: 35
Joined: June 11th, 2012, 5:29 pm

Re: Refresh a external Variable

Post by WezzLee »

dragonmage wrote:To start I'm pretty sure that to have any chance of this working you are going to need DynamicVariables=1 on all your measures and meters that need to change when #MediaPlayerName# changes.
Can I just put that under [Rainmeter] or do I need to have it on every single one?
Well putting that didn't seem to do much. When I change WMP to CAD, save, then press refresh it should change the display to say nothing, but they stay on WMPers now playing info. :(
Is this even possible?
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Refresh a external Variable

Post by dragonmage »

If you can package up the whole skin and provide a link to download it someone will likely take a look to help you out.
WezzLee
Posts: 35
Joined: June 11th, 2012, 5:29 pm

Re: Refresh a external Variable

Post by WezzLee »

http://www.filedropper.com/dotamenuwipbywezz
That's it all, I have another question though How would I incorporate a saved state, I have a kind of setting feature, if you click on the left red dot you can change the buttons, but it doesn't persist though shutdown/startup. There is another little project on there, a background of some kind, just ignore it I haven't even properly started with it yet
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Refresh a external Variable

Post by dragonmage »

Before we get to your question, Update= in the [Rainmeter] section is measured in milliseconds. Your Update=1 means everything in the skin is updating 1000 times a second, which made my CPU run away screaming.
Second, instead of using #SKINSPATH#YourSkin\ use #ROOTCONFIGPATH#. The name of the folder you had in the archive did not match the paths you had used for everything, so I had to rename the root folder before any resources could be accessed.

Now to your issue. Includes are only read when a skin is loaded/refreshed. That means changing a value in an .inc will never be treated dynamically in a skin, you must refresh in order for the skin to know the .inc has changed. What you can do is use !SetVariable in conjunction with DynamicVariables=1 on every measure and every meter that you want to be updated by this change. You could then have buttons in the skin that will change the MediaPlayerName= to different values. Also, only the first measure should use the variable for PlayerName= all subsequent measures should use PlayerName=[MainMeasureName].

Try this for your player section

Code: Select all

[MeasureTitle]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#MediaPlayerName#
PlayerType=TITLE
DisableLeadingZero=0
DynamicVariables=1


[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasureTitle]
PlayerType=ARTIST
DynamicVariables=1

[MeasurePosition]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasureTitle]
PlayerType=POSITION
DynamicVariables=1

[MeasureState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasureTitle]
PlayerType=STATE
Substitute="0":"Stopped","1":"Playing","2":"Paused"
DynamicVariables=1

[MeterArtist]
Meter=String
X=1000
Y=55
Hidden=1
MeasureName=MeasureArtist
MeterStyle=TextStyleTitle
DynamicVariables=1

[MeterTitle]
Meter=String
X=1000
Y=70
Hidden=1
MeasureName=MeasureTitle
MeterStyle=TextStyleTitle
DynamicVariables=1

[MeterPosition]
Meter=String
X=1000
Y=85
Hidden=1
MeasureName=MeasurePosition
MeterStyle=TextStyleTitle
Hidden=0
DynamicVariables=1

[MeterState]
Meter=String
X=1103
Y=85
Hidden=1
MeasureName=MeasureState
MeterStyle=TextStyleTitle
DynamicVariables=1

[MeterMediaRefresh]
Meter=IMAGE
ImageName=#SKINSPATH#Dota Menu\Resources\Images\mediarefresh.png
X=1155
Y=100
Hidden=1
AntiAlias=1
LeftMouseUpAction=[!SetVariable MediaPlayerName WINAMP]
MiddleMouseUpAction=[!SetVariable MediaPlayerName WMP]
RightMouseUpAction=[!SetVariable MediaPlayerName CAD]
WezzLee
Posts: 35
Joined: June 11th, 2012, 5:29 pm

Re: Refresh a external Variable

Post by WezzLee »

Thank you so much and WOW, I did not know any of this, I had a feeling the thing I wanted wouldn't be possible the way I wanted but you suggested a much easier way! The middle/right/left click to set the player name is a great idea! I can't imagine why the folder was named incorrectly, but I did a quick replace tool and changed it all anyway.

Also I thought the update was a type of version indicator, I didn't have any problems running this skin throughout all my activities, however I set it to 999 milliseconds, so that there is the longest time without noticing breaks in the song time.

edit; I'm having problems with the Refresh button, it doesn't seem to be changing the variable, I have moved the variable to the ini file but nothing seems to change.
I will look up for the answer in-case you don't respond.

edit2;
Right I have a idea, I am just going to have it refresh the skin, but will have to do something to save the state of each tab, probably through variable checks. Can the !SetVariable bang change a variable in a inc?