It is currently August 19th, 2022, 8:45 pm

Setting FileView path based on variables

Get help with creating, editing & fixing problems with skins
User avatar
northperseids
Posts: 4
Joined: October 26th, 2021, 6:02 pm

Setting FileView path based on variables

Post by northperseids »

Hi everyone,

So I've been using Rainmeter to make desktop tools for myself and a few colleagues at work, and it's incredibly useful - we have a massive file directory and I've got it set up in a flow-chart type of view where you can pick a project and the skin will auto-populate a series of predefined links based on the project selection.

The only problem is that I am not actually using the FileView plugin - I've only recently figured out how that works, so previously I had manually entered in most of the paths for the links (sort of - the file structure is predictable, so you'll have Project 1 with folders A1, B1, C1, then Project 2 with folders A2, B2, C2, and so on). The current skin has a "Project" variable that gets set whenever you select a project and all the link paths are some form of "C:\blahblah\[#Proj1]\A", "C:\blahblah\[#Proj1]\B", and then "C:\blahblah\[#Proj2]\A", "C:\blahblah\[#Proj2]\B" and so on so on. This works, but requires me to manually update a whole slew of things every time we add a new project, or there's a project whose file structure has a slight variation in it instead of the A/B/C sequence, and/or can cause days' worth of headache because I didn't realize a new folder name is spelled differently in the skin versus the actual directory.

So - I want to use FileView. It would make things SO much easier. However, I'm having trouble setting the path based on a variable! Basically, what I want to do is have some variable, say Var1, that gets set into the "Path=" bit. Something like this:

C:\Users\Username\Project1
C:\Users\Username\Project2
C:\Users\Username\Project3

where "Project1/2/3" is replaced by a variable, and the skin then displays the subfolders of 1/2/3/etc.

I've attached a super super simplified test file that I've been toying with - it's supposed to display the first few files/folders in the C:\Users folder once the "Set Variable" meter is clicked on, using the same SetVariable principle as my main skin, and I can get the variable to change easily, but the path/file-view won't. I've gone over the documentation on variables and I know Section Variables can't be used in parent paths - sorry, I'm still new-ish to this, is that what I'm working with here? I didn't think so, but I could be wrong.

Thank you!
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4810
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Setting FileView path based on variables

Post by eclectic-tech »

Changes:
Changed default #Var# to Windows
Added ShowDotDot=0 (not show previous folder) and DynamicVariables=1 to [mPath] to see changes to #Var#
Modified action bang of [SetVar] to update the Fileview parent measure; since you have DynamicVariables=1 on all your meters the !Update and !Redraw bangs are not needed.

This should work for you.

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=Test
Author=northperseids
Information=Test of a file view mapping tool.
Version=1.0

[Variables]
FontSize=20
FontFace=Arial
FontColor=255,255,255,255
Var=Windows

;--STYLING

[BaseStyle]
AntiAlias=1
SolidColor=0,0,0,1
FontColor=255,255,255,255
FontSize=25
W=350
H=45

;--MEASURES

[mPath]
Measure=Plugin
Plugin=FileView
Path="C:\#Var#"
Count=6
ShowDotDot=0
DynamicVariables=1

;---INDEX GROUP 1

[mIndex1]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=1

[mIndex2]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=2
Group=INDGROUP

[mIndex3]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=3

;--METER GROUP 1


[Meter1]
Meter=String
MeasureName=mIndex1
MeterStyle=BaseStyle
X=0
Y=0
Text=[%1]
LeftMouseUpAction=[!CommandMeasure mIndex1 "Open"]
DynamicVariables=1 

[Meter2]
Meter=String
MeasureName=mIndex2
MeterStyle=BaseStyle
X=0r
Y=30r
Text=[%1]
LeftMouseUpAction=[!CommandMeasure mIndex2 "Open"]
DynamicVariables=1 

[Meter3]
Meter=String
MeasureName=mIndex3
MeterStyle=BaseStyle
X=0r
Y=30r
Text=[%1]
LeftMouseUpAction=[!CommandMeasure mIndex3 "Open"]
DynamicVariables=1 

[SetVar]
Meter=String
MeterStyle=BaseStyle
X=0r
Y=40r
Text=Set Variable
LeftMouseUpAction=[!SetVariable Var "Users"][!CommandMeasure mPath "Update"]
DynamicVariables=1 

[SetVar2]
Meter=String
MeterStyle=BaseStyle
X=0r
Y=40r
Text="Var Value: [#Var]"
DynamicVariables=1