It is currently April 26th, 2024, 8:45 am

Displaying certain meter at one time?

Get help with creating, editing & fixing problems with skins
DelosX
Posts: 7
Joined: July 1st, 2013, 12:01 am

Displaying certain meter at one time?

Post by DelosX »

Hi, I'm a little new to making Rainmeter skins, I've been looking at the docs for a guide, but I've gotten a little stuck.

Just for a little testing, I'm trying to make a skin that opens up files. But, instead of them just being static, I'd like it so you can switch between the one that is displayed, click it, and open the file or folder that was selected.

I've gotten the counter working, 1 to 8, but now I'm having trouble displaying the 'Shortcut'. I just can't get it to display on a certain value, and not display on the rest.

Here's my whole script so far, I know the counter may be inefficient, but it works, and I'm fine with that.

Code: Select all

[Rainmeter]
Update=100


[Buttonleft]
Meter=Image
X=70
y=50
ImageName=buttonleft.png
LeftMouseDownAction=!execute [!SetOption bCounter Formula [bCounter]-1]

[Buttonright]
Meter=Image
X=95
y=50
ImageName=buttonright.png
LeftMouseDownAction=!execute [!SetOption bCounter Formula [bCounter]+1]

[numCount]
Meter=string
x=88
y=70
Text=[bCounter]
FontColor=255,255,255,100
DynamicVariables=1

[bCounter]
Measure=calc
Formula=bCounter
IfEqualValue=0
IfEqualAction=!execute [!SetOption bCounter Formula 8]
IfAboveValue=8
IfAboveAction=!execute [!SetOption bCounter Formula 1]



[1Documents]
Meter=String
X=5
Y=5
FontFace=Trebuchet MS
FontSize=25
FontColor=255,255,255,255
AntiAlias=1
SolidColor=0,0,0,1
LeftMouseUpAction=["C:\Users\Name\Documents"]
Text=Documents
After 'Text=Documents' I'd like a part that determines if it should be hidden or not, I've tried multiple things, but it doesn't seem to work. I've got the other ones (Music, Steam, etc.) ready, I just need to set them up so they display on the certain values. This is probably really easy to you all, but I only just started (about 2 hours ago) making my own skins.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

If I understand you correctly, something like this might work for you:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
1Name="Programs"
2Name="Programs x86"
3Name="Documents"
4Name="Skins"
5Name="Rainmeter"
6Name="Control Panel"
7Name="Network"
8Name="Calculator"
1Path=""C:\Program Files""
2Path=""C:\Program Files (x86)""
3Path="C:\Users\Jeffrey\Documents"
4Path="C:\Users\Jeffrey\Documents\Rainmeter\Skins"
5Path=""C:\Program Files\Rainmeter""
6Path="Shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"
7Path="Shell:::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"
8Path="C:\Windows\System32\calc.exe"

[MeterLeft]
Meter=Image
X=0
Y=0
W=20
H=20
SolidColor=173,240,176,255
LeftMouseUpAction=[!SetOption MeasureCurrent Formula ([MeasureCurrent]-1)][!UpdateMeasure *]
DynamicVariables=1

[MeterRight]
Meter=Image
X=30
Y=0
W=20
H=20
SolidColor=173,215,240,255
LeftMouseUpAction=[!SetOption MeasureCurrent Formula ([MeasureCurrent]+1)][!UpdateMeasure *]
DynamicVariables=1

[MeasureCurrent]
Measure=Calc
Formula=1
IfBelowValue=1
IfBelowAction=[!SetOption MeasureCurrent Formula 8][!UpdateMeasure *][!UpdateMeter *][!Redraw]
IfAboveValue=8
IfAboveAction=[!SetOption MeasureCurrent Formula 1][!UpdateMeasure *][!UpdateMeter *][!Redraw]
OnUpdateAction=[!SetOption MeterCurrent Text "#[MeasureCurrent]Name#"][!SetOption MeterCurrent LeftMouseUpAction "[#[MeasureCurrent]Path#]"][!UpdateMeter *][!Redraw]
UpdateDivider=-1

[MeterCurrent]
Meter=String
X=10R
Y=2
FontSize=13
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=#1Name#
LeftMouseUpAction=[#1Path#]
What I am doing is setting variables for the 8 "names" and "paths". NOTICE that paths that require quotes around them in Windows due to spaces in the folder names have TWO quotes around them. Rainmeter will strip off one of the sets of quotes when it uses the variable, but leave the second. Paths that don't have spaces in them, or ones like the shell command for Control Panel that don't need (and will hate) quotes, just have one set of quotes.

http://docs.rainmeter.net/tips/launching-windows-special-folders

Now the "Left" and "Right" meters increment the formula in a Calc measure, much as you were doing. IFActions are used to reset the "current" value if it falls below 1 or above 8. This means you can scroll through the numbers going either way (left or right) in a loop.

I update the Calc measure manually with [!UpdateMeasure *] when you click one of the left or right meters, so the measure can be set with UpdateDivider=-1. That way it just sits there quietly using no resources unless you are actually clicking.

So when that Calc measure is updated the OnUpdateAction sets the Text option of the string meter to the variable #xName#, where "x" is the current value of the measure. It then sets the LeftMouseUpAction of the string meter to the variable #xPath#, where "x" is again the current value of the measure. Those #xName# and #xPath# variables are obviously the ones we set at the top, so voila!

All done with one meter to display the item to launch and react to the mouse click. No need for eight meters and some complicated "hide / show" strategy.

Doubling back a bit, the reason for the double sets of quotes around the variable paths that have spaces in them (and thus will require quotes in Windows) is so we can use that one vanilla LeftMouseUpAction=[#xPath#] (again where "x" is the current value of the Calc measure) without having to actually put quotes on the bang in the LeftMouseUpAction= option itself. That would just cause issues when Windows DIDN'T want quotes.

Try this out, and see if some approach like this can't be modified to fit your needs.

P.S. Nothing says you have to do this with a String meter. The #xName# variables could just was well be #xImage# variables, set like 1Image="#@#Images\FirstImage.png" and then just use an Image meter and instead of using !SetOption on the Text= option, just set the ImageName= option on the Image meter instead.
DelosX
Posts: 7
Joined: July 1st, 2013, 12:01 am

Re: Displaying certain meter at one time?

Post by DelosX »

Thank you so much! It works perfectly. I'll be fiddling with this to fit it in, but just wondering, is there any way to 'center' the text, instead of it being on the left side?

EDIT: Nevermind, I just found that out. StringAlign=Center. After messing about I set it up and it works just fine!

Here's my now-not-messed-up desktop:
Image
Last edited by DelosX on July 1st, 2013, 12:04 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

DelosX wrote:Thank you so much! It works perfectly. I'll be fiddling with this to fit it in, but just wondering, is there any way to 'center' the text, instead of it being on the left side?
Centering text is done by setting the W (width) and X (horizontal position) of the meter, with the X at the center of the W. Then you set StringAlign=Center on the meter and the text will automatically "center" on the position defined by X. Just make sure W is large enough to hold the longest possible text.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

DelosX wrote: EDIT: Nevermind, I just found that out. StringAlign=Center. After messing about I set it up and it works just fine!

Here's my now-not-messed-up desktop:
Image
Very cool.
DelosX
Posts: 7
Joined: July 1st, 2013, 12:01 am

Re: Displaying certain meter at one time?

Post by DelosX »

Thank you a lot, you really saved a lot of time by helping ^^
Uhm, I just tried to switch the font to a custom one, orbitron, I have it in the directory as .ttf, and I've set the font face to 'Orbitron', but it doesn't seem to be working.
Also, should I make a new topic for this or should I just keep it all on this one?
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

DelosX wrote:Thank you a lot, you really saved a lot of time by helping ^^
Uhm, I just tried to switch the font to a custom one, orbitron, I have it in the directory as .ttf, and I've set the font face to 'Orbitron', but it doesn't seem to be working.
Also, should I make a new topic for this or should I just keep it all on this one?
It is important that it be in a folder under the "root" of your skin, called @Resources
\Fonts

So C:\Users\YourName\Documents\Rainmeter\Skins\YourSkin\@Resources\Fonts
DelosX
Posts: 7
Joined: July 1st, 2013, 12:01 am

Re: Displaying certain meter at one time?

Post by DelosX »

Image
Doesn't seem to be working. I also tried moving the resources folder into the 'Customskin' directory, but that makes no difference. Taking out the 'StringStyle=Light' makes no difference either.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

DelosX wrote:
Image
Doesn't seem to be working. I also tried moving the resources folder into the 'Customskin' directory, but that makes no difference. Taking out the 'StringStyle=Light' makes no difference either.
@Resources\Fonts must be in the "root" folder for your skin under the main Rainmeter\Skins folder in Documents. So in this case, yes, under Customskin. Then, the option is FontFace=, not Font=

http://docs.rainmeter.net/tips/fonts-guide

In addition, there is NO such StringStyle value as "light".

http://docs.rainmeter.net/manual/meters/string#StringStyle
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Displaying certain meter at one time?

Post by jsmorley »

BTW, I liked this idea and solution so much I put it out as a stand-alone skin at: http://rainmeter.net/forum/viewtopic.php?p=89326#p89326. I credited you in the skin as co-author, since it was really your idea.