It is currently April 20th, 2024, 3:01 am

Two questions about !RainmeterSetVariable

Get help with creating, editing & fixing problems with skins
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Two questions about !RainmeterSetVariable

Post by csm725 »

Hello, and I have some questions about the syntax and usability of !RainmeterSetVariable.
Just to clarify, I call this bang on an event such as LeftMouseDownAction, MouseOverAction, etc., correct?
Assuming so, what is the syntax of !RainmeterSetVariable? Please give an example.
Also, on the Rainmeter 1.3 beta manual under the Bangs section, it says this about !SetVariable:
"Formulas may be used, enclosed in parentheses."
What would be the syntax for using this?
Also, poiru told me that !SetVariable "doesn't support math (yet)". Is this true? If so, what would be a workaround for having a variable called 'x' be raised or lowered 1 when a certain button is pressed and have 'x' be accesible to other measures?
I know I need to put DynamicVariable.

Please answer all of the questions! (Or at least the ones you know the answers to)

Thank you in advance,
csm725 - http://csm725.deviantart.com/#/d2whd5g
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Two questions about !RainmeterSetVariable

Post by JpsCrazy »

csm725 wrote:Just to clarify, I call this bang on an event such as LeftMouseDownAction, MouseOverAction, etc., correct?
Yes, and many others such as IfAbove/Below/Equal in the case of a measure instead of a user's action.
csm725 wrote:What is the syntax of !RainmeterSetVariable? Please give an example.
Also, it says: "Formulas may be used, enclosed in parentheses." What would be the syntax for using this?
Ex:

Code: Select all

[Rainmeter]
DynamicWindowSize=1

[Variables]
Number=0

[mtText]
Meter=String
Text=Click me to my number! #Number#
FontColor=AAAAAA
FontSize=21
SolidColor=00000001
LeftMouseUpAction=!RainmeterSetVariable Number (#Number#+50)
DynamicVariables=1
Why all the extra decimal places? I don't quite know...
If you didn't figure it out, the formula in () can be replaced by a single number or value if you don't want it to keep increasing or just want to set it once.

Hopefully this answered all your questions.
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Two questions about !RainmeterSetVariable

Post by csm725 »

JpsCrazy wrote: Yes, and many others such as IfAbove/Below/Equal in the case of a measure instead of a user's action.
Ex:

Code: Select all

[Rainmeter]
DynamicWindowSize=1

[Variables]
Number=0

[mtText]
Meter=String
Text=Click me to my number! #Number#
FontColor=AAAAAA
FontSize=21
SolidColor=00000001
LeftMouseUpAction=!RainmeterSetVariable Number (#Number#+50)
DynamicVariables=1
Why all the extra decimal places? I don't quite know...
If you didn't figure it out, the formula in () can be replaced by a single number or value if you don't want it to keep increasing or just want to set it once.

Hopefully this answered all your questions.
Thank you very much, this indeed answered all of my questions.
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Two questions about !RainmeterSetVariable

Post by csm725 »

If I copy-paste your code into a fresh ini all works well, but if I try in my skin's ini, it doesn't work. Here's the (messy :P ) code:

Code: Select all

[Rainmeter]
;--------------Deep7 dock by csm725----------------ENJOY!------
Author=csm725
http://csm725.com or http://csm725.deviantart.com
Update=600000
DynamicWindowSize=1

[Variables]
Number=5
;--------include--------------
@include=#SKINSPATH#\deep7dock\UserVariables.inc
;----font look, color, caps-----

;--------------------position helpers-----------
pos=0
;----------------------background------------------------------
[Bg]
Meter=IMAGE
ImageName=bg.png
;---------------------Measures-------------------
[MeasureX]
Measure=FreeDiskSpace
Drive=#Drive1#


;---------------------slider-------------------------

;--------------------Meters-----------------------

[LeftArrow]
Meter=STRING
;-----------Text=« #pos#------for testing purposes
Text=« #pos#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=30
AntiAlias=1
x=27
y=17
LeftMouseDownAction=!RainmeterSetVariable pos (#pos#+1)

[RightArrow]
Meter=STRING
Text=»
FontColor=#FontColor#
FontFace=#FontName#
FontSize=30
AntiAlias=1
x=800
y=r

[App1]
Meter=STRING
Text=#Name1#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
AntiAlias=1
StringAlign=Center
x=103
y=22
StringStyle=Bold
StringCase=#StringTransform#
;Hidden=1
LeftMouseDownAction= !execute ["#Path1#"]

[App1desc]
Meter=STRING
Percentual=1
Postfix=" pct"
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path1#"]

[App2]
Meter=STRING
Text=#Name2#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path2#"]

[App2desc]
Meter=STRING
Text=#Name2desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold
;LeftMouseDownAction=!RainmeterHideMeter "App1desc"
LeftMouseDownAction= !execute ["#Path2#"]

[App3]
Meter=STRING
Text=#Name3#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path3#"]

[App3desc]
Meter=STRING
Text=#Name3desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path3#"]

[App4]
Meter=STRING
Text=#Name4#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path4#"]

[App4desc]
Meter=STRING
Text=#Name4desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path4#"]

[App5]
Meter=STRING
Text=#Name5#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path5#"]

[App5desc]
Meter=STRING
Text=#Name5desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path5#"]

[App6]
Meter=STRING
Text=#Name6#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path6#"]

[App6desc]
Meter=STRING
Text=#Name6desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path6#"]

[App7]
Meter=STRING
Text=#Name7#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path7#"]

[App7desc]
Meter=STRING
Text=#Name7desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path7#"]


[App8]
Meter=STRING
Text=#Name8#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path8#"]

[App8desc]
Meter=STRING
Text=#Name8desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path8#"]


[App9]
Meter=STRING
Text=#Name9#
FontColor=#FontColor#
FontFace=#FontName#
FontSize=#FontSize#
StringStyle=Bold
AntiAlias=1
StringAlign=Center
x=83r
y=-22r
StringCase=#StringTransform#

LeftMouseDownAction= !execute ["#Path9#"]

[App9desc]
Meter=STRING
Text=#Name9desc#
MeasureName=MeasureX
FontColor=#DescFontColor#
FontFace=#DescFontName#
FontSize=#DescFontSize#
AntiAlias=1
StringAlign=Center
x=r
y=22r
StringCase=#DescStringTransform#
StringStyle=Bold

LeftMouseDownAction= !execute ["#Path9#"]

[Refresh]
Meter=IMAGE
ImageName=refresh.png
x=826
y=23

LeftMouseDownAction= !execute [!RainmeterRefresh]

[Config]
Meter=IMAGE
ImageName=config.png
x=814
y=r

LeftMouseDownAction= !execute ["#SKINSPATH#/deep7dock/config.exe]
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Two questions about !RainmeterSetVariable

Post by JpsCrazy »

That's probably because your update is 600000. (That's 10 minutes.) x.x It's taking 10 minutes to update your changes.
Change it to something reasonable, such as... 1000. (That's 1 second.)

Also, two tips. If you plan on changing #pos# more than once, be sure to include DynamicVariables. And number two, if you use LeftMouseUpAction= it provides basically the same functionality, but you can drag the skin as well.
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Two questions about !RainmeterSetVariable

Post by csm725 »

Oh, I'm so stupid. Changing the update rate to 1 second did it. Thank you, and I now use LeftMouseUpAction. Thanks for the help.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Two questions about !RainmeterSetVariable

Post by JpsCrazy »

No problem, we all make mistakes like that.
Your skin looks interesting so far, seeing as all I see are dead variables from the .inc I don't have. :P
Make sure I see this when you finish it.
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Two questions about !RainmeterSetVariable

Post by csm725 »

JpsCrazy wrote:No problem, we all make mistakes like that.

Your skin looks interesting so far, seeing as all I see are dead variables from the .inc I don't have. :P
Make sure I see this when you finish it.
You can download it from dA in the link from the first post.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Two questions about !RainmeterSetVariable

Post by JpsCrazy »

Ahaa, without variables everything is REALLY colorful and completely different looking - including no background.
Good concept I have to say when the sliding comes.
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Two questions about !RainmeterSetVariable

Post by csm725 »

I don't understand exactly what you mean...