It is currently March 28th, 2024, 7:59 pm

Help for Action.

Get help with creating, editing & fixing problems with skins
raziel_albinus
Posts: 10
Joined: May 28th, 2015, 6:51 pm

Help for Action.

Post by raziel_albinus »

Hi, I create a skin list with scrollbar. I want when press key ENTER, hide the skin and show another skin. and when i'm on this last, press backspace and return to the previous skin. i think i need to use "!Show, !Hide, !Toggle" bangs but i don't know anything in programming.

Thank for your help.

Code: Select all

[Rainmeter]
Update=0.1
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "(#SCREENAREAWIDTH#-[MeterImage0:W]-30)" "0"]

[Variables]
textColor=249,155,30,255
textFont=Gibson
textSize=35
FontCase=Upper
ImgNo=0
Action0= ???????????????????

[MeterScrollDown/Up]
Meter=Image
X=0
Y=0
W=280
H=40
ImageName=#@#\Images\Scroll.png
StringAlign=CENTERCENTER
ImageAlpha=1
MouseScrollDownAction=[!SetVariable ImgNo "((#ImgNo#+1)%10)"]
MouseScrollUpAction=[!SetVariable ImgNo "((#ImgNo#-1)%10)"]
DynamicVariables=1

[MeasureImgNo]
Measure=Calc
Formula=(( #ImgNo# < 0 ) ? ( Abs ( 10 - Abs ( #ImgNo# ))) : ( Abs ( #ImgNo# )))
DynamicVariables=1

[MeterImage0]
Meter=String
Text=Musiques
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0
Y=0
W=280
H=40
LeftMouseUpAction=#Action0#
Hidden=([MeasureImgNo]<>0)
DynamicVariables=1

[MeterImage1]
Meter=String
Text=Films
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0r
Y=0r
W=280
H=40
LeftMouseUpAction=#Action1#
Hidden=([MeasureImgNo]<>1)
DynamicVariables=1
P.s.: i'm french sorry for my bad usage language.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for Action.

Post by balala »

raziel_albinus wrote:Hi, I create a skin list with scrollbar. I want when press key ENTER, hide the skin and show another skin. and when i'm on this last, press backspace and return to the previous skin. i think i need to use "!Show, !Hide, !Toggle" bangs but i don't know anything in programming.
Let's clarify first what and how would you like to achieve: you want to hide and show the appropriate skins when you press Enter / Backspace, or when you click? Because looking to your code, it seems to me that you want to hide and show the skins with clicks (the Action0 / Action1 are associated to clicks).
Another: to can use the !Show / !Hide bangs, the appropriate skins must be loaded. The !Show bang don't loads an unloaded skin.
So, first let us (me) know the followings:
  • what is the needed action to show the second skin (pressing the Enter, or clicking)?
  • which is the skin you want to show / load?
raziel_albinus
Posts: 10
Joined: May 28th, 2015, 6:51 pm

Re: Help for Action.

Post by raziel_albinus »

Hi, thanks for your reply.


Now i know that work only if skin is loaded.

I create this :

Code: Select all

[Rainmeter]
Update=0.1
DynamicWindowSize=1
AccurateText=1
OnFocusAction=[!CommandMeasure MeasureEnter Start]
OnUnfocusAction=[!CommandMeasure MeasureEnter Stop]
OnRefreshAction=[!Show "Raziel Menu\Menu"][!Hide "Raziel Menu\Films"]

[Variables]
textColor=249,155,30,255
textFont=Gibson
textSize=35
FontCase=Upper
ImgNo=0
Action0=[!Show "Raziel Menu\Films"][!Hide "Raziel Menu\Menu"]

[MeterScrollDown/Up]
Meter=Image
X=0
Y=0
W=280
H=40
ImageName=#@#\Images\Scroll.png
StringAlign=CENTERCENTER
ImageAlpha=1
MouseScrollDownAction=[!SetVariable ImgNo "((#ImgNo#+1)%10)"]
MouseScrollUpAction=[!SetVariable ImgNo "((#ImgNo#-1)%10)"]
DynamicVariables=1

[MeasureImgNo]
Measure=Calc
Formula=(( #ImgNo# < 0 ) ? ( Abs ( 10 - Abs ( #ImgNo# ))) : ( Abs ( #ImgNo# )))
DynamicVariables=1

[MeasureEnter]
Measure=Plugin
Plugin=HotKey
HotKey=Enter
KeyUpAction=#Action0#

[MeasureBackSpace]
Measure=Plugin
Plugin=HotKey
HotKey=BackSpace
KeyUpAction=#Action1#

[MeterImage0]
Meter=String
Text=Films
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0
Y=0
W=280
H=40
Hidden=([MeasureImgNo]<>0)
DynamicVariables=1

[MeterImage1]
Meter=String
Text=Musiques
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0r
Y=0r
W=280
H=40
Hidden=([MeasureImgNo]<>1)
DynamicVariables=1
But work every time i press the key (in any softwares or games). How can i fix for work only when i'm on the desktop ?

Thanks for your help
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for Action.

Post by balala »

You'll have to add to the OnFocusAction and OnUnfocusAction options the appropriate bangs to start / stop the [MeasureBackSpace] measure, along with [MeasureEnter]:

Code: Select all

[Rainmeter]
...
OnFocusAction=[!CommandMeasure MeasureEnter Start][!CommandMeasure MeasureBackSpace Start]
OnUnfocusAction=[!CommandMeasure MeasureEnter Stop][!CommandMeasure MeasureBackSpace Stop]
Also don't forget to define the Action1 variable, if it isn't yet (I suppose it'll be something like: Action0=[!Hide "Raziel Menu\Films"][!Show "Raziel Menu\Menu"]).
For me it's working well, with these new OnFocusAction and OnUnfocusAction options.
And don't use an Update=0.1 value in the [Rainmeter] section, because the Update must be an integer, greater than 16 (see the second paragraph here). I'd be tempted to use the default Update=1000.
raziel_albinus
Posts: 10
Joined: May 28th, 2015, 6:51 pm

Re: Help for Action.

Post by raziel_albinus »

I modify the update to 500 because 1000 is not fast with mousewheel.
And everytime i press a key (in any softwares or games), the action is apply. How can i fix for work only when i'm on the desktop ?

Thanks for your help
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for Action.

Post by balala »

raziel_albinus wrote:I modify the update to 500 because 1000 is not fast with mousewheel.
That's ok, but not 0.1!
raziel_albinus wrote:And everytime i press a key (in any softwares or games), the action is apply. How can i fix for work only when i'm on the desktop ?
The following code is working well for me. Using it, the Enter and Backspace key press are not taken into account when unfocus the skin (clicking outside of it):

Code: Select all

[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1
OnFocusAction=[!CommandMeasure MeasureEnter Start][!CommandMeasure MeasureBackSpace Start]
OnUnfocusAction=[!CommandMeasure MeasureEnter Stop][!CommandMeasure MeasureBackSpace Stop]
OnRefreshAction=[!Show "Raziel Menu\Menu"][!Hide "Raziel Menu\Films"]

[Variables]
textColor=249,155,30,255
textFont=Gibson
textSize=35
FontCase=Upper
ImgNo=0
Action0=[!Show "Raziel Menu\Films"][!Hide "Raziel Menu\Menu"]

[MeterScrollDown/Up]
Meter=Image
X=0
Y=0
W=280
H=40
ImageName=#@#\Images\Scroll.png
StringAlign=CENTERCENTER
ImageAlpha=1
MouseScrollDownAction=[!SetVariable ImgNo "((#ImgNo#+1)%10)"]
MouseScrollUpAction=[!SetVariable ImgNo "((#ImgNo#-1)%10)"]
DynamicVariables=1

[MeasureImgNo]
Measure=Calc
Formula=(( #ImgNo# < 0 ) ? ( Abs ( 10 - Abs ( #ImgNo# ))) : ( Abs ( #ImgNo# )))
DynamicVariables=1

[MeasureEnter]
Measure=Plugin
Plugin=HotKey
HotKey=Enter
KeyUpAction=#Action0#

[MeasureBackSpace]
Measure=Plugin
Plugin=HotKey
HotKey=BackSpace
KeyUpAction=#Action1#

[MeterImage0]
Meter=String
Text=Films
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0
Y=0
W=280
H=40
Hidden=([MeasureImgNo]<>0)
DynamicVariables=1

[MeterImage1]
Meter=String
Text=Musiques
FontFace=#textFont#
FontSize=#textSize#
FontColor=#textColor#
StringCase=#FontCase#
AntiAlias=1
X=0r
Y=0r
W=280
H=40
Hidden=([MeasureImgNo]<>1)
DynamicVariables=1
The only differences, beside the Update value, are in the OnFocusAction and OnUnfocusAction options of the [Rainmeter] section. This code should work well for you, too. Please let me know if it is.
tjhuntley
Posts: 17
Joined: December 2nd, 2019, 3:10 pm

Re: Help for Action.

Post by tjhuntley »

Is there a way to insert this scrollbar into my meter? I have a meter that is limited to 8 lines but I have found a way to increase it to 50. The problem is that it stretches the meter too far so I figured a scrollbar would solve this issue. I am new to this so any help is appreciated.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for Action.

Post by balala »

tjhuntley wrote: December 4th, 2019, 5:08 am Is there a way to insert this scrollbar into my meter? I have a meter that is limited to 8 lines but I have found a way to increase it to 50. The problem is that it stretches the meter too far so I figured a scrollbar would solve this issue. I am new to this so any help is appreciated.
After more then three years after the last post? Yeah, probably there is, but first you should post a sample code of your skin, in order to can better help.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help for Action.

Post by eclectic-tech »

tjhuntley wrote: December 4th, 2019, 5:08 am Is there a way to insert this scrollbar into my meter? I have a meter that is limited to 8 lines but I have found a way to increase it to 50. The problem is that it stretches the meter too far so I figured a scrollbar would solve this issue. I am new to this so any help is appreciated.
https://forum.rainmeter.net/viewtopic.php?f=5&t=34101&p=168763#p168763 :welcome:
tjhuntley
Posts: 17
Joined: December 2nd, 2019, 3:10 pm

Re: Help for Action.

Post by tjhuntley »