This shouldn't crash - my bad, I was only testing folders containing images, totally skipped the non-image situations before: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
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
//
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
//
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.