It is currently December 7th, 2022, 10:30 pm

FileChoose [Ver.1.2.0.1]

Share and get help with Plugins and Addons
User avatar
Jaime Méndez
Posts: 91
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Yincognito wrote: September 14th, 2022, 5:51 pm I'll see what I can do later on regarding this, but I tell you, it's a waste of time... :confused:
I know, it is just for learning proposes. I don't understand Rainmater documentation, there aren't many examples. I couldn't do it right. I don't know much and don't have the time to go over all documentation, I preferer to learn it little by little ;-) with some help here and there :lol:
In the meantime, does this crash too? I mean, for me it works without any problems.
EXpandable_1.1.1.rmskin
It crashes when there are some other type of files than images (png|jpg|bmp|gif|tif|webP|ico) in the folder
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: September 14th, 2022, 7:09 pmIt crashes when there are some other type of files than images (png|jpg|bmp|gif|tif|webP|ico) in the folder
This shouldn't crash - my bad, I was only testing folders containing images, totally skipped the non-image situations before:

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|bmp|gif|tif|webP|ico)$
IfMatchAction=[!SetOption MeasureFileMagi%% Image "File [MeasureFilePath%%] | RenderSize 48,48"][!SetOption MeterTileIcon%% MeasureName "MeasureFileMagi%%"]
IfNotMatchAction=[!SetOption MeasureFileMagi%% Image ""][!SetOption MeterTileIcon%% MeasureName "MeasureFileIcon%%"]
IfMatchMode=1

[MeasureFileIcon%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=Icon
IconSize=Large

[MeasureFileMagi%%]
Measure=Plugin
Plugin=MagickMeter.dll

[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:]))
Group=SelectionGroup
LeftMouseUpAction=["[MeasureFilePath%%]"]
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]


[MeterTileIcon%%]
Meter=Image
; ImageName=[MeasureFileIcon%%]
MeasureName=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
//
Of course, normally this shouldn't have been required, as MagickMeter should have silently failed if the processed file wasn't an image, but since its code doesn't include such fail safe measures, it's up to the skin designer to do that part. :D

P.S. I changed a bit the order of the measures, to better reflect how the whole process operates.

EDIT: And the RunCommand variant, which basically writes the ImageMagick output instead of the FileView one to iconN.ico, if the file is an image:

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|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:]))
Group=SelectionGroup
LeftMouseUpAction=["[MeasureFilePath%%]"]
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]


[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
//
Your approach was more or less correct here, when it came to the RunCommand syntax, but you had some leftover options from other measures that meant nothing in this context, and you didn't set up the relationship between the IfMatch testing in [MeasureFileType%%] and the execution of the RunCommand measure. Notice how I commented out the IfMatchMode=1 option in order not to spawn ImageMagick executions all the time and kill the CPU, see the links below for details.

References here, here and here. Be sure to read those - it's not much to read. Working from examples that some might or might not provide according to your needs might seem easier than to read and understand some alledgedly TLDR stuff, but in the vast majority of cases, if you read the right parts (you don't have to read all of it, just focus on what you need) you understand how things work even better.
User avatar
Jaime Méndez
Posts: 91
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Thank you very much! you are so kind. Of course I owe you a beer for all your help. Now I understand much better how all this work :yahoo: :beer:
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: September 15th, 2022, 1:09 pm Thank you very much! you are so kind. Of course I owe you a beer for all your help. Now I understand much better how all this work :yahoo: :beer:
Alrighty then. 8-)
User avatar
Jaime Méndez
Posts: 91
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Yincognito wrote: September 15th, 2022, 3:40 pm Alrighty then. 8-)
I have to tell you that method with RunCommand plugin is much faster and take much less CPU resources than original code and the one with MagickMeter, it doesn't affect computer performance at all. I have a folder with a bunch of big image files and method with MagickMeter or original code make Rainmeter get stucked and computer goes slower. RunCommand also renders images a lot faster.

I know that whenever a file is saved in a storage unit, Windows 10 keeps its icon or thumbnail in a DB file. Would it be posible to get the icons from that DB? The problem I found is that those ico files have a coded name, but if there is a method to find the corresponded ico file to its source file it would be much faster to show icon pictures in the skin.

Am I dreaming on? Skin is pretty usable now with RunCommand and standalone ImageMagick though.
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: September 15th, 2022, 4:22 pmI have to tell you that method with RunCommand plugin is much faster and take much less CPU resources than original code and the one with MagickMeter, it doesn't affect computer performance at all. I have a folder with a bunch of big image files and method with MagickMeter or original code make Rainmeter get stucked and computer goes slower. RunCommand also renders images a lot faster.
That's actually an illusion. :sly:

Most likely it takes at least as much or longer with RunCommand, but the thing is that dues to the particularities of the code, the RunCommand variant runs ImageMagick on the image as soon as the file type is identified in [MeasureFileType%%] (meaning, even before you hover the mouse over the folder icon to show the icons, basically when the "Folder read" message is printed in the Rainmeter Log), so by the time you hover over the folder icon, all the files are ready as a result. The other variants of the code do this at the time you hover the mouse over the folder icon (so much later, starting from scratch in that moment) because that's when the meter is shown, so this is why it appears that they move slower. You can test this by unloading the RunCommand version of the skin, deleting all the .ico files in the skin folder in order to start from zero, then load the RunCommand version again and immediately hover the mouse over the folder icon afterwards: you'll have to wait for a while until all icons are shown, and that amount of time is comparable with the time taken by the other variants of the code.

That being said, in this case, it's a nice and useful effect - its subtle nature makes it harder to detect though, which is why you were under the impression that the variant is faster. Can't tell anything about the CPU usage, that depends on how CPU friendly are FileView and MagickMeter, since CMD.EXE is lightning fast due to its DOS days origin. By comparison, today's PowerShell is both a resource hog and many many times slower, if we talk about the so called "progress" in that area, in general.
Jaime Méndez wrote: September 15th, 2022, 4:22 pm I know that whenever a file is saved in a storage unit, Windows 10 keeps its icon or thumbnail in a DB file. Would it be posible to get the icons from that DB? The problem I found is that those ico files have a coded name, but if there is a method to find the corresponded ico file to its source file it would be much faster to show icon pictures in the skin.

Am I dreaming on?
Well, you're not dreaming, but you have at least two problems:

- you can't easily identify which folder or images those thumbnail cache files from the C:\Users\[User]\AppData\Local\Microsoft\Windows\Explorer folder (which is where Win 10 stores them nowadays) are from, so you can choose the right .db file to "extract" things from
- there are very few programs that can explore such a .db file, one of them being Thumbcache Viewer (freeware), and no Rainmeter plugin to facilitate the interaction with Rainmeter; sure, this program can be used from the command line and it even has a command line version if you read stuff on that page, but apparently it will extract all of the contained thumbnails from the .db file, since it seems there's no way of choosing what to "unpack", so to speak; even if it would be able to do that, it won't be instantaneous either, think of unpacking a single file from a .zip or .rar especially when there are many files included and the chosen file is towards the "end" of the set

Also, as a side note, you'd think that Rainmeter would have already done that in the FileView plugin, if it was easily possible... :???:
User avatar
Jaime Méndez
Posts: 91
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

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

The skin has now Drag&Drop capabilities and the ability to go back to previous folder with middle mouse action in directory icon. It means that you can go from c:\ to any child folder with left mouse action and return to its parents directories all the way back to c:\ again. You can still use right mouse action to open folder in explorer window, file or execute a program

This is what i have done so far with some conditionals but not success. I just want to know if a file type is a folder in order to do some mouse actions. There is a bug when you left-click on a file that drives you to a wrong inexistent directory instead of opening that file.

Code: Select all

[Variables]
Flag=0

[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"]
IfMatch=(?i)^(?:)$
IfMatchAction=[!SetVariable "Flag" 1]
; IfMatchMode=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:]))
Group=SelectionGroup
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]
IfCondition=(Flag="1")
IfTrueAction=[!SetOption MeterTileSelection%% "[LeftMouseUpAction=[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%] "#@#Variables.inc"][!Refresh]]"]
IfFalseAction=[!SetOption MeterTileSelection%% "[LeftMouseUpAction=["[MeasureFilePath%%]"][!SetVariable "Flag" 0]]"]
Show you the original code without conditionals in [MeterTileSelection%%]

EXpandable.ini

Code: Select all

[Rainmeter]
;Update=1000
DynamicWindowSize=1
AccurateText=1
MouseOverAction=[!CommandMeasure MeasureSlide "Stop 2"][!CommandMeasure MeasureSlide "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureSlide "Stop 1"][!CommandMeasure MeasureSlide "Execute 2"]
MiddleMouseUpAction=[!CommandMeasure MeasureFolder "PreviousFolder"][!WriteKeyValue "Variables" "Path" [MeasureParentDir] "#@#Variables.inc"][!UpdateMeasure MeasureFolder][!Refresh]

[Metadata]
Name=
Author=
Information=
License=
Version=

[Variables]

@include=#@#variables.inc

PPath=#Path#

[ScriptFactoryTiles]
Measure=Script
ScriptFile=#@#scripts\Factory.lua
IncFile=#@#include\tiles.inc
Number=
Delayed=1
UpdateDivider=1

[DragNDrop]
Measure=Plugin
Plugin=Drag&Drop
Action=Move
OnDropAction=[!Log $File$]
FilePath=#PPath#

[MeasureFolder]
Measure=Plugin
Plugin=FileView
Path=#PPath#
ShowDotDot=0
ShowFolder=1
Count=63
HideExtensions=1
FinishAction=[!Log "Folder read"]

[MeasureParentDir]
Measure=String
String=#PPath#
RegExpSubstitute=1
Substitute="^(.*)\\([^\\]*)$":"\1"

[MeasureFoldersCount]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FolderCount
Group=Folder

[MeasureFileCount]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileCount
OnChangeAction=[!CommandMeasure "ScriptFactoryTiles" "Run((#Amount#-1))"][!Delay 0][!CommandMeasure "ScriptRefresher" "Run()"][!SetOption MeterHitbox Hidden 0]

[MeasureTimerCalc]
Measure=Calc
Formula=#TIMER#
DynamicVariables=1

[MeasureTimerDelayCalc]
Measure=Calc
Formula=#Timer_Step_Delay#

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Down,[MeasureTimerDelayCalc:],#Timer_Steps#
Down=[!SetVariable TIMER "(Clamp(([MeasureTimerCalc:]+#Timer_Step#),0,1))"]#Update#
ActionList2=Repeat Up,[MeasureTimerDelayCalc:],#Timer_Steps#
Up=[!SetVariable TIMER "(Clamp(([MeasureTimerCalc:]-#Timer_Step#),0,1))"]#Update#
DynamicVariables=1

[MeterHitbox]
Meter=Shape
Shape=Rectangle #Hitbox_X#,#Hitbox_Y#,#Hitbox_Width#,#Hitbox_Height#,10 | Fill Color #Background_Color# | Stroke Color #Background_Border#
DynamicVariables=1
Hidden=1

@include=#@#include\tiles.inc

;@include=#@#include\display.inc

[MeterTileFolder]
Meter=Shape
Shape=Rectangle #TILE_F_X_O#,#TILE_F_Y_O#,(#PX#+#Tile_Width#),(#PY#+#Tile_Height#) | Fill Color 0,0,0,1 | Stroke Color 0,0,0,1

[MeterTileSelectionFolder]
Meter=Shape
Shape=Rectangle (#TILE_F_X_O#+(#Tile_Width#-#Tiles_Selection_Width#)/2),#TILE_F_Y_O#,(#Tiles_Selection_Width#),(#Tiles_Text_OY#+[MeterTileTextFolder:H]) | Fill Color #Hover_Selection_Color#,(#Hover_Selection_Opacity#*#TILE_F_SELECTION#) | Stroke Color #Hover_Selection_Color#, (#Hover_Selection_Border_Opacity#*#TILE_F_SELECTION#)
DynamicVariables=1
MouseOverAction=[!SetVariable TILE_F_SELECTION 1][!UpdateMeter "MeterTileSelectionFolder"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_F_SELECTION 0][!UpdateMeter "MeterTileSelectionFolder"][!Redraw]
LeftMouseUpAction=["#PPath#"]
RightMouseUpAction=[!Refresh]#Update#

[MeterTileIconFolder]
Meter=Image
ImageName=#@#folder.ico
X=(#TILE_F_X_O#+#Tiles_Icon_OX#)
Y=(#TILE_F_Y_O#+#Tiles_Icon_OY#)
W=#Tiles_Icon_Size#
H=#Tiles_Icon_Size#

[MeasurePathFolderName]
Measure=String
String=#PPath#
RegExpSubstitute=1
Substitute="^.*\\(.*)$":"\1"

[MeterTileTextFolder]
Meter=String
MeasureName=MeasurePathFolderName
Text=%1
X=(#TILE_F_X_O#+#Tiles_Text_OX#)
Y=(#TILE_F_Y_O#+#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
; UpdateDivider=-1

; Script Refresher - required for the factory script, refreshes the skin to apply
[ScriptRefresher]
Measure=Script
ScriptFile=#@#scripts\Refresher.lua
UpdateDivider=1
Refreshed=0
tiles.inc.template

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:]))
Group=SelectionGroup
MouseOverAction=[!SetVariable TILE_%%_SELECTION 1][!UpdateMeter "MeterTileSelection%%"][!Redraw]
MouseLeaveAction=[!SetVariable TILE_%%_SELECTION 0][!UpdateMeter "MeterTileSelection%%"][!Redraw]
LeftMouseUpAction=[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%]" "#@#Variables.inc"][!Refresh]#Update#
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
//
Last edited by Jaime Méndez on September 21st, 2022, 2:08 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: September 20th, 2022, 6:56 pmI just want to know if a file type is a folder in order to do some mouse actions.
Didn't look at the code in depth yet, but from the top of my head, wouldn't it be better to test if something is a folder or not by checking whether it has the ending \ in a measure that has Type=PathToFile instead? I mean, files having no extension and zero size do exist, so testing if it's a folder based on both the file extension and size is not going to always be accurate. On the other hand, according to the manual (see why it's better to read the bits of interest from it?) setting a FileView child measure's Type option to PathToFile apparently appends the backslash in the case of folders, so it's a much more reliable way of doing it.

If you wonder how the IfMatch regex would look like then, it would be a simple \\$ (i.e. a backslash followed by the end of string character; backslashes and a few other characters are escaped by adding another backslash in front of them, by the way, hence the double backslash in the regex).

If you can't figure out how to make it happen (although it's basically about copy pasting [MeasureFileType%%] into another measure set like mentioned above), I'll take a look at your code later on. ;-)
User avatar
Jaime Méndez
Posts: 91
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Thank you, meanwhile I will try your suggestions :D
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: September 20th, 2022, 7:44 pm Thank you, meanwhile I will try your suggestions :D
Alright, let me know how it goes.