It is currently June 24th, 2024, 12:22 am

How to use FileView to display icons?

Get help with creating, editing & fixing problems with skins
SquareCat
Posts: 1
Joined: May 13th, 2024, 9:33 pm

How to use FileView to display icons?

Post by SquareCat »

I've tried using the FileView Plugin but it is very confusing on how it works and how to use it with other meters. Example code:

Code: Select all

[Rainmeter]
Update=1000

[MeasurePath]
Measure=Plugin
Plugin=FileView
Path=C:\Users\User\Desktop\General\Games\Game.exe
ShowFolder=0
ShowDotDot=0
Count=1

[MeasureChildName]
Measure=Plugin
Plugin=FileView
Path=[MeasurePath]
Type=FilePath
Index=1

[Name]
Meter=Image
MeasureName=MeasureChildName
I'm trying to display the icon of an application as the Image. The reason why I'm not just putting the icon in a folder is so that it can be accessible, this is a test file for the actual project I'm working on where there are multiple buttons (image meters but they make executions) which I hope to make them open whatever application. Preferably I'd like it to open file explorer and allow someone to select the application but I don't think that's possible.
I've also tried using IconPath for MeasureName and changed the Type to Icon.
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to use FileView to display icons?

Post by balala »

SquareCat wrote: May 13th, 2024, 9:42 pm I've tried using the FileView Plugin but it is very confusing on how it works and how to use it with other meters.
Unfortunately the Path option of a parent FileView option ([MeasurePath] in this case) has to indicate a folder. It can't referee to a file, just folders are allowed.
User avatar
Yincognito
Rainmeter Sage
Posts: 7491
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to use FileView to display icons?

Post by Yincognito »

SquareCat wrote: May 13th, 2024, 9:42 pm I've tried using the FileView Plugin but it is very confusing on how it works and how to use it with other meters.
[...]
I'm trying to display the icon of an application as the Image. The reason why I'm not just putting the icon in a folder is so that it can be accessible, this is a test file for the actual project I'm working on where there are multiple buttons (image meters but they make executions) which I hope to make them open whatever application. Preferably I'd like it to open file explorer and allow someone to select the application but I don't think that's possible.
I've also tried using IconPath for MeasureName and changed the Type to Icon.
It's only confusing if you try to understand it all at once, and of course it's possible. Start simple, with just a few things, and make sure you get the idea before proceeding further or expanding. Simple FileView example with just 3 elements, adapted from here (this starts in the Desktop folder, so you can add a few shortcuts to your applications there to test):

Code: Select all

[Variables]
HighlightColor=64,128,255,128
FontFace=Consolas
FontSize=12
LineW=255
LineH=24
StrokeW=2
LineGap=5
Corner=6
FolderPath="%USERPROFILE%\Desktop"
Lines=3

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[Folder]
Measure=Plugin
Plugin=FileView
Path="#FolderPath#"
ShowDotDot=1
ShowFolder=1
Count=#Lines#
FinishAction=[!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]
UpdateDivider=-1

[ElementIcon1]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=Icon
Index=1

[ElementName1]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=FileName
Index=1

[ElementIcon2]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=Icon
Index=2

[ElementName2]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=FileName
Index=2

[ElementIcon3]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=Icon
Index=3

[ElementName3]
Group=Elements
Measure=Plugin
Plugin=FileView
Path=[Folder]
Type=FileName
Index=3

---Styles---

[Icons]
X=(#StrokeW#+#LineGap#)
Y=(#LineGap#)R
W=(#LineH#)
DynamicVariables=1

[Texts]
X=(#LineH#+#LineGap#)r
Y=(0)r
W=(#LineW#-#LineH#-#LineGap#*3-#StrokeW#*2)
FontEffectColor=0,0,0,255
FontColor=255,255,255,255
StringEffect=Shadow
FontFace=#FontFace#
FontSize=#FontSize#
AntiAlias=1
ClipString=2
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor "#HighlightColor#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor ""][!UpdateMeter #CURRENTSECTION#][!Redraw]
DynamicVariables=1

---Meters---

[Back]
Meter=Shape
Shape=Rectangle (#StrokeW#/2),(#StrokeW#/2),(#LineW#-#StrokeW#),(#LineH#*#Lines#+#LineGap#*(#Lines#+1)),#Corner# | StrokeWidth #StrokeW# | Stroke Color 255,255,255,128 | Fill Color 0,0,0,128
UpdateDivider=-1
MouseScrollUpAction=[!CommandMeasure Folder "IndexUp"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!CommandMeasure Folder "IndexDown"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Icon1]
Group=Lines
Meter=Image
MeterStyle=Icons
Y=(#LineGap#)r
MeasureName=ElementIcon1
LeftMouseUpAction=[!CommandMeasure ElementName1 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]

[Text1]
Group=Lines
Meter=String
MeterStyle=Texts
H=[Icon1:H]
MeasureName=ElementName1
Text=%1
LeftMouseUpAction=[!CommandMeasure ElementName1 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]

[Icon2]
Group=Lines
Meter=Image
MeterStyle=Icons
MeasureName=ElementIcon2
LeftMouseUpAction=[!CommandMeasure ElementName2 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]

[Text2]
Group=ElementLines
Meter=String
MeterStyle=Texts
H=[Icon2:H]
MeasureName=ElementName2
Text=%1
LeftMouseUpAction=[!CommandMeasure ElementName2 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]

[Icon3]
Group=Lines
Meter=Image
MeterStyle=Icons
MeasureName=ElementIcon3
LeftMouseUpAction=[!CommandMeasure ElementName3 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]

[Text3]
Group=ElementLines
Meter=String
MeterStyle=Texts
H=[Icon3:H]
MeasureName=ElementName3
Text=%1
LeftMouseUpAction=[!CommandMeasure ElementName3 "FollowPath"][!UpdateMeasure Folder][!UpdateMeasureGroup Elements][!UpdateMeter *][!Redraw]
Obviously, you can remove the TextN meters and leave just the icons, or adjust / expand it further. This uses meter styles to avoid repetitive styling of meters and make the code more compact, and #CURRENTSECTION# to refer to the section the style is applied to at that time.

It's a bit of contradiction between your desire to display the icon of an application (which the code above does, even for shortcuts) in an explorer-like environment, and you mentioning that you want to make the icon open whatever application. I mean, it's either the specific icon for a single application, or a general purpose icon used to select any application whatsoever, it's illogical to be both, if you get what I mean. In any case, since you mentioned this, here's how such a general purpose icon to open explorer would look like (didn't bother to point out to an actual image file, I just used a solid color for simplicity):

Code: Select all

[Explorer]
Meter=Image
W=20
H=20
SolidColor=255,0,0,255
LeftMouseUpAction=["explorer.exe"]
A list of other Windows stuff you can execute here (there are similar lists over the internet, you just have to google them). If by any chance you want to run an application with parameters in such a bang (and you don't need the potential output of that application, for which the RunCommand measure exists), it's usually something like ["FullPathToYourApplication" "ApplicationParameters"].
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth