It is currently April 19th, 2024, 10:02 am

2 Handy to have cycle functions

Tips and Tricks from the Rainmeter Community
User avatar
Jkon
Posts: 185
Joined: December 4th, 2009, 2:05 am

2 Handy to have cycle functions

Post by Jkon »

Just thought I'd throw these out here.I find them very handy and they both function reasonably smooth.The first one is an infinite cycle I use for cycling through the months of the year in calendars .Left click to adavance 1 month or left click and hold down to continue cycling through.When you go past December it will return to January and vica versa.

Code: Select all

 

[Variables]

Month=mCycle

; ====================


[Measures]

[mMonth]
Measure		=Time
Format		=%#m

[mX]
Measure		=Calc
Formula		=mY#V#
DynamicVariables=1

[mY]
Measure		=Calc
Formula		=mZ

[mZ]
Measure		=Calc
Formula		=#Calc#
DynamicVariables=1

[mCycle]
Measure		=Calc
Formula		=mY + mMonth

; ====================

[Meters]

[Back]
Meter=Image
ImageName=#CurrentPath#Left.png
X=0
Y=5
LeftMouseDownAction=!Execute [!RainmeterSetVariable V -1] [!RainmeterSetVariable Calc "((mX + mMonth) < 0) ? 11 - mMonth : mX"]
LeftMouseUpAction=!RainmeterSetVariable V 0

[Forward]
Meter=Image
ImageName=#CurrentPath#Right.png
X=120
Y=5
LeftMouseDownAction=!Execute [!RainmeterSetVariable V +1] [!RainmeterSetVariable Calc "((mX + mMonth) > 11) ? 0 - mMonth : mX"]
LeftMouseUpAction=!RainmeterSetVariable V 0 
By adding the above measures to your calendar and then replacing each instance of mMonth in the existing measures with mCycle you should be good to go.

The second is a capped cycle thats good for volume control.Same button controls except when you reach a min or max volume state the cycle stops.

Code: Select all

 [Measures]

[mX]
Measure		=Calc
Formula		=(mY#V#)
DynamicVariables=1

[mY]
Measure		=Calc
Formula		=mZ

[mZ]
Measure		=Calc
Formula		=(mX > 100) ? 0 : mX

[mVolumeUp]
Measure		=Calc
Formula		=((mY = 5) || (mY = 10) || (mY = 15) || (mY = 20) || (mY = 25) || (mY = 30) || (mY = 35) || (mY = 40) || (mY = 45)) || (mY = 50) || (mY = 55) || (mY = 60) || (mY = 65) || (mY = 70) || (mY = 75) || (mY = 80) || (mY = 85) || (mY = 90) || (mY = 95) || (mY = 100) ? 1 : 0
IfEqualValue	=1
IfEqualAction	=!Execute ["#CurrentPath#NirCmd\nircmd.exe" changesysvolume +3276 master] ["#CurrentPath#RainVolume.exe"]
Disabled	=1

[mVolumeDown]
Measure		=Calc
Formula		=((mY = 5) || (mY = 10) || (mY = 15) || (mY = 20) || (mY = 25) || (mY = 30) || (mY = 35) || (mY = 40) || (mY = 45)) || (mY = 50) || (mY = 55) || (mY = 60) || (mY = 65) || (mY = 70) || (mY = 75) || (mY = 80) || (mY = 85) || (mY = 90) || (mY = 95) || (mY = 100) ? 1 : 0
IfEqualValue	=1
IfEqualAction	=!Execute ["#CurrentPath#NirCmd\nircmd.exe" changesysvolume -3276 master] ["#CurrentPath#RainVolume.exe"]
Disabled	=1

[mVolume]
Measure		=Registry
RegKey		=Software\RainVolume
RegHKey		=HKEY_CURRENT_USER
RegValue	=CurrentVolume
MaxValue	=100
MinValue	=0

; ====================

[Meters]

[VolumeDown]
Meter=Image
ImageName=#CurrentPath#Left.png
X=0
Y=20
LeftMouseDownAction=!Execute [!RainmeterSetVariable V +2.5] [!RainmeterDisableMeasure mvolumeUp] [!RainmeterEnableMeasure mvolumeDown]
LeftMouseUpAction=!RainmeterSetVariable V 0

[VolumeUp]
Meter=Image
ImageName=#CurrentPath#Right.png
X=120
Y=20
LeftMouseDownAction=!Execute [!RainmeterSetVariable V +2.5] [!RainmeterDisableMeasure mvolumeDown] [!RainmeterEnableMeasure mvolumeUp]
LeftMouseUpAction=!Execute [!RainmeterSetVariable V 0] 
Unfortunately both cycles require low update rates,atleast 300 to function smoothly.I'm posting a basic working example of the volume cycle and a sample of the month cycle that just shows the month names cycling.Hope these are of some use to you.Let me know if you have any questions.
You do not have the required permissions to view the files attached to this post.
Image
dcrutgers
Posts: 2
Joined: February 10th, 2010, 1:31 am

Re: 2 Handy to have cycle functions

Post by dcrutgers »

Very cool. it would be great if the volume skin reflected level changes when made directly to the system volume. This seems to only show the correct volume level when you only use the skin to change to volume.

Thoughts?
User avatar
Jkon
Posts: 185
Joined: December 4th, 2009, 2:05 am

Re: 2 Handy to have cycle functions

Post by Jkon »

The volume control exe. by jsmorley supplied with the example can read the system volume at set intervals,I didnt include the measure for it as i was only giving an example of the cycle function.Have a read here http://rainmeter.net/forum/viewtopic.php?f=5&t=683 to make the needed changes.
Image
osmanvielma
Posts: 3
Joined: April 20th, 2013, 10:25 pm

Re: 2 Handy to have cycle functions

Post by osmanvielma »

dcrutgers wrote:it would be great if the volume skin reflected level changes when made directly to the system

Thoughts?

Indeed Many Thoughts on this topic my friend, just me and my head thinking about this all afternoon... I finally gave up... no dreamed knob showing the sound level of a windows xp


it's sad