It is currently September 8th, 2024, 12:08 am

FileView skin: ToggleConfig CurrentFile

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

FileView skin: ToggleConfig CurrentFile

Post by sl23 »

Just trying out this to see if it is possible to toggle a config by R-click action:
RightMouseUpAction=[!ToggleConfig #CURRENTPATH# "m#CURRENTSECTION#Name"]

Tried so many variations. The only thing that actually does anything is #CURRENTCONFIG# but that just disables the whole skin instead of toggling the selected file.

What am I doing wrong?
57686174 77696C6C 6265 77696C6C 6265
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5502
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: FileView skin: ToggleConfig CurrentFile

Post by eclectic-tech »

sl23 wrote: July 3rd, 2024, 11:36 pm Just trying out this to see if it is possible to toggle a config by R-click action:
RightMouseUpAction=[!ToggleConfig #CURRENTPATH# "m#CURRENTSECTION#Name"]

Tried so many variations. The only thing that actually does anything is #CURRENTCONFIG# but that just disables the whole skin instead of toggling the selected file.

What am I doing wrong?
To activate (or Toggle) a skin, you use the ConfigName (not the #CurrentPath#") followed with the skin.ini name.
In your bang, "m#CURRENTSECTION#Name" must resolve to a valid skin.ini name in the folder specified by #CurrentConfig#.
Since it probably did not find a valid skin in the #CurrentConfig#, it then toggled (unloaded) the current skin.ini in that folder.
Note, only 1 skin.ini in the #CurrentConfig# folder can be active at any time; that is why the !ToggleConfig bang unloaded the current skin in that folder.

See the 3rd paragraph here for how to find the correct ConfigName.

A quick way to see the Configname is to open the context menu and look at the top line, that is the ConfigName.
configname.png
The bang to toggle this skin (clock.ini) would be:
RightMouseUpAction=[!ToggleConfig "illustra\Clock" "clock.ini"]
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: FileView skin: ToggleConfig CurrentFile

Post by balala »

sl23 wrote: July 3rd, 2024, 11:36 pm What am I doing wrong?
Similar question, (almost the) same mistake by you: https://forum.rainmeter.net/viewtopic.php?p=225120#p225120
Besides eclectric-tech's reply, try to understand that Config is not same as its path. These are different things: Config is just a name, with no path, while CurrentPath is the path of current config, starting with a drive letter and ending with the name of the config (in which you are using this variable). Don't mix them up.
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: FileView skin: ToggleConfig CurrentFile

Post by sl23 »

Thanks for your replies and explaining. :)

I know I asked about a similar thing, this is somewhat different. I am using the file view plugin and created a skin that defaults to the #skinspath#. I don't want to toggle that skin or even a skin within that config path, although that may be wanted.

My aim was to create a generic skin loader using the file view plugin. So, starting at the skinspath, I can go to any folder within it, R-click a skin file to toggle it.

Am I able to do such a thing?
:thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: FileView skin: ToggleConfig CurrentFile

Post by sl23 »

So are you saying the only thing I can use for the Config part of the bang is #CurrentConfig# or the equivalent "folder/folder" names?
Will nothing else work?
So:
RightMouseUpAction=[!ToggleConfig #CurrentConfig# "m#CURRENTSECTION#Name"]
Or:
RightMouseUpAction=[!ToggleConfig "illustro\Clock" "m#CURRENTSECTION#Name"]

Is it the same for the File part of the bang? Or is what I'm using ok? That variable does work for other parts of the skin as it's used throughout. But I'm assuming this won't ever work because the Config part won't accept any other values.

As you are browsing through folders within the main Skins folder, obviously the path changes, depending what config you want to load. So it's variable. But there's seems to be a limitation on what can be used here.
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileView skin: ToggleConfig CurrentFile

Post by Yincognito »

sl23 wrote: July 4th, 2024, 8:29 am My aim was to create a generic skin loader using the file view plugin. So, starting at the skinspath, I can go to any folder within it, R-click a skin file to toggle it.

Am I able to do such a thing?
:thumbup:
Yes, it's possible. Whether you're able to do it, that's a question only you can answer, but here's how to do it:

Just create 2 FileView child measures having Type=FilePath in them for the file you're currently (with the Index) on, then (Regexp) Substitute the 1st measure output to get the 1st parameter for !ToggleConfig, and the 2nd measure output to get the 2nd parameter for !ToggleConfig.

Then, actually use the values of those 2 measures in the said bang as parameters, wherever you need.

When substituting, first replace (?:^#SKINSPATH#|^.*$) in the input string with nothing aka "" to delete everything but the last path part (this will delete the whole path if you're not in the skins path folder, by the way), from which you can then extract the ConfigName and the FileName parts to use as parameters for the bang, respectively, in a second Substitute part. After all, it's only the last escaped backslash aka \\ that's separating them now. You might also want to add "^\\\d+$":"" at the end of the Substitute in case you get literals like \1 or \2 since Rainmeter has the habit of replacing empty capture references with the said literals, see the Note from the RegExpSubstitute entry in the manual:
https://docs.rainmeter.net/manual/measures/general-options/substitute/
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: FileView skin: ToggleConfig CurrentFile

Post by sl23 »

Ok, I don't get it.

I created two measures with Type=FilePath, even though I see the need for only one, but I made two.
Your RegEx substitutes don't work, but that's probably cause I've done it wrong, I know that much! :sly:

Been trying to figure it out for hours now and the closest I can get is to toggle the first item in the folder, not the one I'm R-clicking on. So if I click on Index5 or Index2 or Index 9, it toggles Index1 only.

Everything else works as it should. I just can't get this thing to work. Here's my code, but I had to use my own Substitutes to get this far as yours wouldn't do anything.

I then managed to get this code to work, not quite how I want it to, as it would be better if you could click skin1 to load it, then click skin2, a variant, and unload skin1 at the same time you load skin2. My code also has an issue with opening the folder when hovering the path now that I removed "Skins\" from mPath using Substitute. But that was the only way I could get the path.

Please help! O.O
Thanks. :thumbup:

Code: Select all

[Rainmeter]
Update=500
BackgroundMode=2
SolidColor=0,0,0,1
AccurateText=1
DynamicWindowSize=1
MouseActionCursor=0
OnRefreshAction=

[Metadata]
Name=Skin Launcher
Author=sl23
Information=Skin Launcher
Version=2024.6.27
License=CC BY 3.0

[Variables]
Aqua=0,255,255
AquaDark=#Aqua#,200
Blue=64,143,191
Green=128,255,0
Orange=255,170,0
OrangeDark=255,128,0
Red=255,100,100
Stroke=255,255,255,10
Trans=0,0,0,1
White=255,255,255,150
White20=255,255,255,20
White40=255,255,255,40
White60=255,255,255,60
Yellow=255,255,0

BgFill=0,0,0,10


ConfigPath=TEST
IconSize=Small
Path=#CURRENTPATH#Shortcuts
File=

========================================
; Background
========================================
[Bg]
Meter=Shape
Shape=Rectangle 0,0,270,48,5 | Fill Color 0,0,0,200 | StrokeWidth 2 | Stroke Color #White60#
Shape2=Rectangle 12,20,248,2,2 | Fill Color #White#

MouseOverAction=[!ShowMeterGroup Icon][!ShowMeterGroup Info][!ShowMeter Button][!UpdateMeterGroup *][!Redraw]
MouseLeaveAction=[!HideMeterGroup Icon][!HideMeterGroup Info][!HideMeter Button][!UpdateMeterGroup *][!Redraw]

MiddleMouseUpAction=[!Refresh]
X1MouseUpAction=[!CommandMeasure mPath "PreviousFolder"][!UpdateMeasure mPath][!UpdateMeasureGroup Children][!UpdateMeter *][!Redraw]

MouseScrollUpAction=[!CommandMeasure mPath "IndexUp"][!SetOption Name Text "[mName]"][!UpdateMeasureGroup Children][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!CommandMeasure mPath "IndexDown"][!SetOption Name Text "[mName]"][!UpdateMeasureGroup Children][!UpdateMeter *][!Redraw]

X=1
Y=1

[BgIcons]
Meter=Shape
Shape=Rectangle 0,0,250,20,2 | Fill Color #Trans# | StrokeWidth 0
MouseOverAction=[!HideMeterGroup Info][!Redraw]
MouseLeaveAction=[!ShowMeterGroup Info][!Redraw]
Group=Button
X=11
Y=26

========================================
; BUTTON
========================================
[Button]
Meter=Shape
Shape=Rectangle 0,0,10,10,5 | FillColor #Trans# | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=StrokeColor #White#
DynamicVariables=1

LeftMouseUpAction=[!CommandMeasure mPath "PreviousFolder"][!UpdateMeasure mPath][!UpdateMeasureGroup Children][!UpdateMeter *][!Redraw]
MiddleMouseUpAction=[!Refresh]
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Yellow#"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #White#"][!UpdateMeter *][!Redraw]

ToolTipIcon=Info
ToolTipTitle=
ToolTipText="L - Back#CRLF#M - Refresh"
Hidden=1
Group=Button
X=10
Y=7

========================================
; STYLES
========================================
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=CenterCenter
FontSize=9
FontColor=#White#
SolidColor=#Trans#
AntiAlias=1
DynamicVariables=1
UpdateDivider=-1
Hidden=1
Group=Info

[sLeft]
StringAlign=LeftCenter

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Green#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; NAME
========================================
[Name]
Meter=String
MeterStyle=sAllText
FontColor=#Yellow#
Text=
UpdateDivider=-1
Hidden=1
Group=Name
X=135
Y=12

========================================
; APP BUTTONS
========================================
[sIcon]
AntiAlias=1
ImageAlpha=65
Hidden=1
Group=Icon
DynamicVariables=1

LeftMouseUpAction=[!CommandMeasure m#CURRENTSECTION# "FollowPath"][!UpdateMeasure mPath][!UpdateMeasureGroup Children][!SetOption Name Text "[mName]"][!UpdateMeter *][!Redraw]
RightMouseUpAction=[!ToggleConfig [mPath] "#File#"]

MouseOverAction=[!SetOption #CURRENTSECTION# ImageAlpha "255"][!SetOption mR1 Index "#CURRENTSECTION#"][!UpdateMeasure mR1][!SetOption mName Index "#CURRENTSECTION#"][!UpdateMeasure mName][!SetVariable File "[mName].ini"][!SetOption Name Text "[mName]"][!ShowMeterGroup Name][!UpdateMeter Name][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageAlpha ""][!SetOption mR1 Index ""][!UpdateMeasure mR1][!SetVariable File ""][!SetOption mName Index ""][!UpdateMeasure mName][!SetVariable File ""][!SetOption Name Text ""][!HideMeterGroup Name][!UpdateMeter Name][!UpdateMeter *][!Redraw]
X=25r
Y=r

[mPath]
Measure=Plugin
Plugin=FileView
Path="#SkinsPath##ConfigPath#"
ShowDotDot=0
HideExtensions=1
Count=10
Group=Children
Substitute="#SkinsPath#":""

[mName]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=#Index#
Group=Children
DynamicVariables=1

[mR1]
Measure=Plugin
Plugin=FileView
Path="#SkinsPath#"
Type=FilePath 
Index=#Index#
;RegExSubstitute=1
;Substitute="(?:^#SKINSPATH#|^.*$)":""
Group=Children
;Substitute="#SkinsPath#":"Skins\"

[mR2]
Measure=Plugin
Plugin=FileView
Path="#SkinsPath#"
Type=FilePath 
Index=#Index#
;RegExSubstitute=1
;Substitute="(?:^#SKINSPATH#|^.*$)":""
Group=Children
Substitute="#SkinsPath#":""

[m1]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=1
Group=Children

[m2]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=2
Group=Children

[m3]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=3
Group=Children

[m4]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=4
Group=Children

[m5]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=5
Group=Children

[m6]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=6
Group=Children

[m7]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=7
Group=Children

[m8]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=8
Group=Children

[m9]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=9
Group=Children

[m10]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=10
Group=Children

========================================
; INFO
========================================
[mFolderCount]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FolderCount
Group=Children

[mFileCount]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileCount
Group=Children

[PathTitle]
Meter=String
MeasureName=mPath
MeterStyle=sAllText | sLeft | sHighlight
Text=[mPath]
ToolTipText=L- Open Folder#CRLF#Folders: [mFolderCount] / Files: [mFileCount]
LeftMouseUpAction=[mPath]
X=30
Y=12

========================================
; METERS
========================================
[1]
Meter=Image
MeasureName=m1
MeterStyle=sIcon
X=16
Y=17r

[2]
Meter=Image
MeasureName=m2
MeterStyle=sIcon

[3]
Meter=Image
MeasureName=m3
MeterStyle=sIcon

[4]
Meter=Image
MeasureName=m4
MeterStyle=sIcon

[5]
Meter=Image
MeasureName=m5
MeterStyle=sIcon

[6]
Meter=Image
MeasureName=m6
MeterStyle=sIcon

[7]
Meter=Image
MeasureName=m7
MeterStyle=sIcon

[8]
Meter=Image
MeasureName=m8
MeterStyle=sIcon

[9]
Meter=Image
MeasureName=m9
MeterStyle=sIcon

[10]
Meter=Image
MeasureName=m10
MeterStyle=sIcon
57686174 77696C6C 6265 77696C6C 6265
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5502
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: FileView skin: ToggleConfig CurrentFile

Post by eclectic-tech »

sl23 wrote: July 5th, 2024, 8:56 pm {clip}
I then managed to get this code to work, not quite how I want it to, as it would be better if you could click skin1 to load it, then click skin2, a variant, and unload skin1 at the same time you load skin2. My code also has an issue with opening the folder when hovering the path now that I removed "Skins\" from mPath using Substitute. But that was the only way I could get the path.

Please help! O.O
Thanks. :thumbup:

{code clipped}
To open variants in the [sIcon] section, use !ActivateConfig with just the ConfigName parameter:
RightMouseUpAction=[!ActivateConfig [mPath]]
instead of RightMouseUpAction={!ToggleConfig [mPath] "#File#"].

To unload the current variant, use a MiddleMouseUpAction and !DeactivateConfig with the current ConfigName:
MiddleMouseUpAction=[!DeactivateConfig [mPath]]

Note: You will need to remove, or comment out, the MiddleMouseUpAction in the [bg] section that refreshes in order for the added deactivate to work.

I did not experience the other issue of opening the folder on hover...

Modified [sIcon] code to load variants and deactivate:

Code: Select all

[sIcon]
AntiAlias=1
ImageAlpha=65
Hidden=1
Group=Icon
DynamicVariables=1

LeftMouseUpAction=[!CommandMeasure m#CURRENTSECTION# "FollowPath"][!UpdateMeasure mPath][!UpdateMeasureGroup Children][!SetOption Name Text "[mName]"][!UpdateMeter *][!Redraw]
RightMouseUpAction=[!ActivateConfig [mPath]]
 ; "#File#"]
MiddleMouseUpAction=[!DeactivateConfig [mPath]]

MouseOverAction=[!SetOption #CURRENTSECTION# ImageAlpha "255"][!SetOption mR1 Index "#CURRENTSECTION#"][!UpdateMeasure mR1][!SetOption mName Index "#CURRENTSECTION#"][!UpdateMeasure mName][!SetVariable File "[mName].ini"][!SetOption Name Text "[mName]"][!ShowMeterGroup Name][!UpdateMeter Name][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageAlpha ""][!SetOption mR1 Index ""][!UpdateMeasure mR1][!SetVariable File ""][!SetOption mName Index ""][!UpdateMeasure mName][!SetVariable File ""][!SetOption Name Text ""][!HideMeterGroup Name][!UpdateMeter Name][!UpdateMeter *][!Redraw]
X=25r
Y=r

User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: FileView skin: ToggleConfig CurrentFile

Post by sl23 »

Thanks for your help. :thumbup:
Those Mouse actions worked. Was hoping to get it all on one Mouse button, but that's probably not possible with the way it works. But I'm ok with how it is, that's great, thanks.

Wrt the hover path, sorry it was late, I was really tired. I meant when hovering, I can't L-click the path due to using the Substitute to egt the path for use in the above Mouse actions. FIXED.
Last edited by sl23 on July 6th, 2024, 6:02 pm, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: FileView skin: ToggleConfig CurrentFile

Post by sl23 »

One last thing I would like to do, though not essential, is to limit this skins ability to go back past the Skins folder. It opens on the Skins folder and is designed only for use within that folder, but how can I restrict going up past it?

I have tried disabling the Mouse action for going back but that didn't work. Any ideas? :)
57686174 77696C6C 6265 77696C6C 6265