It is currently April 20th, 2024, 2:40 am

Conditional Mouse Actions?

Get help with creating, editing & fixing problems with skins
YuriKircovich
Posts: 9
Joined: July 4th, 2017, 4:44 am

Re: Conditional Mouse Actions?

Post by YuriKircovich »

User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Mouse Actions?

Post by balala »

Now I just realized it's not very clear for me what the problem is. Please describe me the issue again.
Sorry for this misunderstanding.
YuriKircovich
Posts: 9
Joined: July 4th, 2017, 4:44 am

Re: Conditional Mouse Actions?

Post by YuriKircovich »

Okay, sorry. It's pretty hard to explain. I'm going to be pretty verbose so I don't forget to explain anything, so sorry if you already understand some of these points.

betta.ini is a config that is a button. When hovered over it shows a background image which disappears when not hovering over it. This is the same case for all the configs in Honeycomb + GGL, such as chrome.ini.

However, chrome.ini, when hovered over, deactivates the TitleCard config in FortCarroll. That title card is an image that rests in the center of my desktop. Every time you hover over the chrome.ini skin, it replaces the big Fort Carroll image with the background image for chrome.ini.

When you click on the chrome.ini skin, it launches the Google Chrome web browser.

betta.ini is a button like chrome.ini, but instead of launching an external application when clicked on, I want to to activate the slideshow.ini skin and replace the TitleCard config (Which I just realised I forgot to add that line to the betta.ini config, so sorry if that might have confused you, that's my fault).

This would work similar to how the background images replace the TitleCard config, but instead the slideshow remains there until I click betta.ini again, thus bringing back to the default state.

Now I need chrome.ini (and eventually the rest of the buttons) to, instead of deactivating and reactivating the Fort Carroll TitleCard config, to deactivate and reactivate the slideshow.ini skin. This is so that when you hover over the other buttons, they will replace the spot for the slideshow instead of the TitleCard.

The problem is that I need betta.ini to tell the rest of the buttons that the slideshow is active and that they need to deactivate and reactivate that to show their background image, not the TitleCard config.

I hope that explains enough.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Mouse Actions?

Post by balala »

I'm sorry but still not very clear (yeah, I know, my English is a bit deficient).
So, you'd like different actions, depending on the fact if the Slideshow is or is not activated? Have I understood this well?
YuriKircovich
Posts: 9
Joined: July 4th, 2017, 4:44 am

Re: Conditional Mouse Actions?

Post by YuriKircovich »

Yeah, I guess that would make sense. I want the actions in the buttons to preform something else if the slideshow is active.

When the slideshow is not active, I want the buttons on the MouseOverAction to activate their respective background config and deactivate the TitleCard config, and on the MouseLeaveAction to deactivate their respective background config and activate the TitleCard config.

When the slideshow is active, I want the buttons on the MouseOverAction to activate their respective background config and deactivate the slideshow config, and on the MouseLeaveAction to deactivate their respective background config and activate the slideshow config.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Mouse Actions?

Post by balala »

YuriKircovich wrote:Yeah, I guess that would make sense. I want the actions in the buttons to preform something else if the slideshow is active.

When the slideshow is not active, I want the buttons on the MouseOverAction to activate their respective background config and deactivate the TitleCard config, and on the MouseLeaveAction to deactivate their respective background config and activate the TitleCard config.

When the slideshow is active, I want the buttons on the MouseOverAction to activate their respective background config and deactivate the slideshow config, and on the MouseLeaveAction to deactivate their respective background config and activate the slideshow config.
Ok, here is a solution, using the WebParser plugin measure. A such measure will be used into the betta.ini, to determin when the Slideshow is loaded. Remove all sections within the betta.ini, except the [betta] image meter, and also remove the LeftMouseUpAction option of the [betta] image meter.
Then add the following measures, to the same betta.ini. The [MeasureSlideshowActive] measure will set up the appropriate LeftMouseUpAction of the [betta] meter, that's why I said previously to remove it from the [betta] meter.

Code: Select all

[MeasureSlideshow]
Measure=Plugin
Plugin=WebParser
Url=file://#SETTINGSPATH#Rainmeter.ini
RegExp=(?siU)\[Honeycomb \+ GGL\\betta\\Slideshow].*Active=(\d{1})
UpdateRate=1

[MeasureSlideshowActive]
Measure=Plugin
Plugin=WebParser
Url=[MeasureSlideshow]
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOptionGroup HoverButton MouseOverAction """[!ActivateConfig "Honeycomb + GGL\chrome\Background" "background.ini"][!DeactivateConfig "FortCarroll\TitleCard"]"""][!SetOptionGroup HoverButton MouseLeaveAction """[!DeactivateConfig "Honeycomb + GGL\chrome\Background"][!ActivateConfig "FortCarroll\TitleCard" "TitleCard.ini"]"""][!UpdateMeterGroup "HoverButton"][!Redraw]
IfFalseAction=[!SetOptionGroup HoverButton MouseOverAction """[!ActivateConfig "Honeycomb + GGL\chrome\Background" "background.ini"][!DeactivateConfig "Honeycomb + GGL\betta\Slideshow"]"""][!SetOptionGroup HoverButton MouseLeaveAction """[!DeactivateConfig "Honeycomb + GGL\chrome\Background"][!ActivateConfig "Honeycomb + GGL\betta\Slideshow" "Slideshow.ini"]"""][!UpdateMeterGroup "HoverButton"][!Redraw]
StringIndex=1
Take care about the RegExp option of the [MeasureSlideshow] measure: there you have to have the name of the config, exactly as in Rainmeter.ini. The reserved characters must be escaped, using backslashes. This is what I did with the bracket ([), the plus (+) and finally the backslash (\) signs (here you can find a list of the reserved characters, which must be escaped). When you paste this measures into your code, please check the config name, within the Rainmeter.ini (if you don't know how to do this, please let me know, for a detailed description), to have the same name into the RegExp option.
The [MeasureSlideshowActive] measure will return a number, according to the state of the Slideshow skin: 0 if the skin is unloaded and a greater value (most probably 1 - at least if you don't have further skins in the Slideshow config) if it is. The IfCondition option checks this and sets the appropriate bangs. At this point, please check the config names and the file names on the IfTrueAction and IfFalseAction options, to make sure they are ok.
Also take care about the UpdateRate=1 option, set on the [MeasureSlideshow] measure. Usually this is not a good idea, but because in this case a local file is parsed, I hope it won't case troubles. If it does, increase its value, but this will make the skin less responsive (a longer interval will pass between closing or opening the skin and the moment when the appropriate action is set up).
YuriKircovich
Posts: 9
Joined: July 4th, 2017, 4:44 am

Re: Conditional Mouse Actions?

Post by YuriKircovich »

I'm sorry, but it has again done nothing for me.

I have a feeling that the trouble is with the group name. The code you gave me makes sense, but I just have a feeling that the !SetGroupOption is not properly affecting the HoverButton group. I checked the logs and can see that the code is properly grabbing the correct information (although, it doesn't appear to be updating appropriately, but I'm unsure if that's the logging process not recording the value change until something refreshes).

That's why I think that the code is simply not changing the options of the HoverButton group.

Edit: Also, without a LeftMouseUpAction, the betta.ini button becomes unclickable. I tried what you said and it did nothing, but then I added the line to say

Code: Select all

LeftMouseUpAction=[!ToggleConfig "Honeycomb + GGL\betta\Slideshow" "slideshow.ini"][!ToggleConfig "FortCarroll\TitleCard" "TitleCard.ini"]
This allowed me to apporpriately enable the slideshow.ini and disable the TitleCard.ini when clicked, but the chrome.ini still remains unchanged and will, on MouseLeaveAction, try to enable the TitleCard.ini when it should be enabling the slideshow.ini.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Mouse Actions?

Post by balala »

YuriKircovich wrote:I have a feeling that the trouble is with the group name. The code you gave me makes sense, but I just have a feeling that the !SetGroupOption is not properly affecting the HoverButton group.
There is no trouble with the group name, but you can't set a MouseOverAction and a MouseLeaveAction options to a group of skins, just to a group of meters. HoverButton being a group of skins, this is why setting the appropriate options doesn't work. But if you know well what skins belong to that group, you can set the actions to each skin of the group, one by one.
If you're interested in a such solution, replace the set of IfCondition options of the [MeasureSlideshowActive] measure, with the following ones:

Code: Select all

IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption chrome MouseOverAction """[!ActivateConfig "Honeycomb + GGL\chrome\Background" "background.ini"][!DeactivateConfig "FortCarroll\TitleCard"]""" "Honeycomb + GGL\chrome"][!SetOption chrome MouseLeaveAction """[!DeactivateConfig "Honeycomb + GGL\chrome\Background"][!ActivateConfig "FortCarroll\TitleCard" "TitleCard.ini"]""" "Honeycomb + GGL\chrome"][!Update "Honeycomb + GGL\chrome"]
IfFalseAction=[!SetOption chrome MouseOverAction """[!ActivateConfig "Honeycomb + GGL\chrome\Background" "background.ini"][!DeactivateConfig "Honeycomb + GGL\betta\Slideshow"]""" "Honeycomb + GGL\chrome"][!SetOption chrome MouseLeaveAction """[!DeactivateConfig "Honeycomb + GGL\chrome\Background"][!ActivateConfig "Honeycomb + GGL\betta\Slideshow" "Slideshow.ini"]""" "Honeycomb + GGL\chrome"][!Update "Honeycomb + GGL\chrome"]
These options will set the appropriate options to the [chrome] meter of the Honeycomb + GGL\chrome config (which must be loaded). Obviously you can add further bangs to set the same options to meters of another (or even more) configs, too.
Sorry for the inconvenience, but I think a better solution isn't possible (at least I couldn't find one).
User avatar
Jaime Méndez
Posts: 98
Joined: August 31st, 2022, 10:00 pm

Re: Conditional Mouse Actions?

Post by Jaime Méndez »

Hi, could you help me to get my conditional to work?

This is what i have done so fa, but not success. I just want to know if a file type is a folder in order to do some mouse actions

Code: Select all

[Variables]
Flag=0

[MeasureFolderType%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=PathToFile
IfMatch=\\$
IfMatchAction=[!SetVariable Flag 1]

[MeterTileSelection%%]
Meter=Shape
Shape=Rectangle (#TILE_%%_X#+(#Tile_Width#-#Tiles_Selection_Width#)/2),#TILE_%%_Y#,(#Tiles_Selection_Width#),(#Tiles_Text_OY#+[MeterTileText%%:H]) | Fill Color #Hover_Selection_Color#,(#Hover_Selection_Opacity#*#TILE_%%_SELECTION#*[MeasureTimerCalc:]) | Stroke Color #Hover_Selection_Color#, (#Hover_Selection_Border_Opacity#*#TILE_%%_SELECTION#*[MeasureTimerCalc:])
DynamicVariables=1
Hidden=(Floor(1-[MeasureTimerCalc:]))
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]
; LeftMouseUpAction=[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%]" "#@#Variables.inc"][!Refresh]
; RightMouseUpAction=["[MeasureFilePath%%]"]

[MeasureMyFlag]
Measure=Calc
Formula=#Flag#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterTileSelection%% LeftMouseUpAction "[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%]" "#@#Variables.inc"][!Refresh]"]
IfFalseAction=[!SetOption MeterTileSelection%% LeftMouseUpAction "["[MeasureFilePath%%]"][!SetVariable Flag 0]"]
DynamicVariables=1
This is the original code, without conditionals

Code: Select all

[Variables]
//
; INDEX_%%={((%%+1)+Clamp(((%%+1)-#Root_Position#),0,1))-1+#Index_Offset#}
TILE_%%_X_O={(#PX#+#Tiles_Step_X#*(       (((%%+1)+Clamp(((%%+1)-#Root_Position#),0,1))-1+#Index_Offset#)       % #Tiles_Len#))}
TILE_%%_Y_O={(#PY#+#Tiles_Step_Y#*Floor(        (((%%+1)+Clamp(((%%+1)-#Root_Position#),0,1))-1+#Index_Offset#)       / #Tiles_Len#))}
TILE_%%_X=({#TILE_F_X#}+(#TILE_%%_X_O#-{#TILE_F_X#})*[MeasureTimerCalc:])
TILE_%%_Y=({#TILE_F_Y#}+(#TILE_%%_Y_O#-{#TILE_F_Y#})*[MeasureTimerCalc:])
TILE_%%_SELECTION=0//
TILE_F_SELECTION=0
Update_Tiles=//[!UpdateMeter "MeterTile%%"][!UpdateMeter "MeterTileIcon%%"][!UpdateMeter "MeterTileText%%"][!UpdateMeter "MeterTileSelection%%"][!UpdateMeter "MeterTileHitbox%%"]//
Update=[!UpdateMeasure "MeasureSlide"][!UpdateMeasure "MeasureTimerCalc"][!UpdateMeter "MeterHitbox"]#Update_Tiles#[!Redraw]
FullyOppened=//[!UpdateMeter "MeterTileHitbox%%"]//[!Redraw]
ClosingStart=//[!UpdateMeter "MeterTileHitbox%%"]//[!Redraw]
//
TILE_F_X_O={#TILE_F_X#}
TILE_F_Y_O={#TILE_F_Y#}

[MeasureFilePath%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FilePath

[MeasureFileType%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FileType
IfMatch=(?i)^(?:png|jpg|jpeg|bmp|gif|tif|webP|ico)$
IfMatchAction=[!CommandMeasure MeasureFileMagi%% "Run"]
; IfMatchMode=1

[MeasureFileIcon%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=Icon
IconSize=Large
OnChangeAction=[!SetOption MeterTileIcon%% ImageName [MeasureFileIcon%%]]

[MeasureFileMagi%%]
Measure=Plugin
Plugin=RunCommand
Program=C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick.exe
Parameter="[MeasureFilePath%%]" -resize 48x48 #CURRENTPATH#icon{%%+1}.ico
State=Hide
DynamicVariables=1

[MeasureFileName%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FileName
OnChangeAction=[!SetOption MeterTileText%% Text [MeasureFileName%%]]

[MeterTile%%]
Meter=Shape
Shape=Rectangle #TILE_%%_X#,#TILE_%%_Y#,{#Tile_Width#},{#Tile_Height#} | Fill Color 0,0,0,(255*[MeasureTimerCalc:]) | Stroke Color 0, 0, 0, (255*[MeasureTimerCalc:])
DynamicVariables=1

[MeterTileHitbox%%]
Meter=Shape
Shape=Rectangle #TILE_%%_X_O#,#TILE_%%_Y_O#,{#Tile_Width#},{#Tile_Height#} | Fill Color 0,0,0,1 | Stroke Color 0, 0, 0, 1
Hidden=(Clamp(Floor(1-[MeasureTimerCalc:]*2),0,1))
DynamicVariables=1

[MeterTileSelection%%]
Meter=Shape
Shape=Rectangle (#TILE_%%_X#+(#Tile_Width#-#Tiles_Selection_Width#)/2),#TILE_%%_Y#,(#Tiles_Selection_Width#),(#Tiles_Text_OY#+[MeterTileText%%:H]) | Fill Color #Hover_Selection_Color#,(#Hover_Selection_Opacity#*#TILE_%%_SELECTION#*[MeasureTimerCalc:]) | Stroke Color #Hover_Selection_Color#, (#Hover_Selection_Border_Opacity#*#TILE_%%_SELECTION#*[MeasureTimerCalc:])
DynamicVariables=1
Hidden=(Floor(1-[MeasureTimerCalc:]))
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]
LeftMouseUpAction=[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%]" "#@#Variables.inc"][!Refresh]
RightMouseUpAction=["[MeasureFilePath%%]"]

[MeterTileIcon%%]
Meter=Image
ImageName=[MeasureFileIcon%%]
X=(#TILE_%%_X#+#Tiles_Icon_OX#)
Y=(#TILE_%%_Y#+#Tiles_Icon_OY#)
W=#Tiles_Icon_Size#
H=#Tiles_Icon_Size#
Container=MeterTile%%
DynamicVariables=1
PreserveAspectRatio=1

[MeterTileText%%]
Meter=String
Text=[MeasureFileName%%]
X=(#TILE_%%_X#+#Tiles_Text_OX#)
Y=(#TILE_%%_Y#+#Tiles_Text_OY#)
ClipStringW=#Tiles_Text_Width#
ClipStringH=#Tiles_Text_Height#
FontColor=255,255,255,255
StringAlign=CenterTop
ClipString=2
FontSize=9.5
AntiAlias=0
; FontFace=Segoe UI
StringEffect=Shadow
FontEffectColor=0,0,0,255
Container=MeterTile%%
DynamicVariables=1
//