It is currently October 7th, 2022, 8:36 am

FileChoose [Ver.1.2.0.1]

Share and get help with Plugins and Addons
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

death.crafter wrote: September 1st, 2022, 5:26 pm Well, Yinco just did what I had in mind. Thanks Yincognito, for saving me the trouble :rosegift:
No problem, crafter of all which is script under the Sun - I thought you might appreciate enjoying a beer tonight instead of writing code. 8-)
Hopefully it will be what the OP had in mind as well. :???:
death.crafter wrote: September 1st, 2022, 5:29 pm That aside, the performance won't be great, because you'd be rendering the very large in size images themselves and not their thumbnails.
Yep, noticed that. There would be a proportional delay in displaying several big images in the skin, indeed. :(
This is unfortunately, unavoidable - Rainmeter needs time to read and scale those images from the drive. :confused:
User avatar
Jaime Méndez
Posts: 33
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Yincognito wrote: September 1st, 2022, 5:22 pm
That's it - if the file is an image, a thumbnail will be displayed; if not, the system's file icon will. Save the file, refresh the skin, and admire your thumbnails:
FileView Thumbnails.jpg
Thank you very much! It did the trick :17good I don't care it is a bit slow, works great.
User avatar
Jaime Méndez
Posts: 33
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

death.crafter wrote: September 1st, 2022, 3:42 pm Ohh I see. But filechoose plugin isn't the right choice here tbh.
You were right, it was much easier working with file types conditionals. Thank you anyway for trying to help :great:
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
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 1st, 2022, 7:44 pmYou were right, it was much easier working with file types conditionals. Thank you anyway for trying to help :great:
I don't think death.crafter meant to compare FileView vs FileChoose or a plugin vs Rainmeter syntax and code (like conditionals) that aren't directly related to plugins. He just stated that using one of these plugins alone, whether it's FileView or FileChoose (by the way, the above is probably possible if you're using FileChoose as well - I posted this way because the skin was already using FileView), was not enough to make what you wanted work. It needed the appropriate code too - i.e. the IfMatch conditionals which incidentally happen to test the file type strings provided by one of the mentioned plugins.

In other words, plugins and conditionals are not mutually exclusive, and such conditionals can act not only on file types but on either numbers or strings irrespective where they come from. For the record, if the tested value was a number, you'd have to use an IfCondition instead of an IfMatch.
Jaime Méndez wrote: September 1st, 2022, 7:40 pmThank you very much! It did the trick :17good I don't care it is a bit slow, works great.
No problem, glad to help. ;-) To be perfectly accurate, it wouldn't be instantaneous even if using much smaller created thumbnail images, because Rainmeter (or any other program you choose to read the original images from the drive) would still need time to read the images, resize them and save the resulting thumbnails in a separate location on one of your drives. Sure, once created, accessing them would be much faster, I'm just saying that the initial process of creating the thumbnails from the original larger images also takes a somewhat similar amount of time. Try to open large images in any image viewer, multiply the time taken by loading a single such image by the number of images, and you'll see what I mean.
User avatar
Jaime Méndez
Posts: 33
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Yincognito wrote: September 1st, 2022, 5:40 pm
Yep, noticed that. There would be a proportional delay in displaying several big images in the skin, indeed. :(
This is unfortunately, unavoidable - Rainmeter needs time to read and scale those images from the drive. :confused:
I managed to work with .ico type for image files using "ImageMagick" so Rainmeter wouldn't take that long to render icons. It seems to work fine, but I have an stupid problem. I couldn't parse path of each "MyPhoto.jpg" in folder and path of each "EXpandable\icon%%.ico" in Messure [MeasureFileJPG%%]

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#}

[MeasureFileIcon%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=Icon
IconSize=Large
;OnChangeAction=[!SetOption MeterTileIcon%% ImageName [MeasureFileIcon%%]]

[MeasureFileJPG%%]
Measure=Plugin
Plugin=RunCommand
Path=[MeasureFolder]
Program="C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick"
Index={%%+1}

; Here it is where I should parse variables%% instead of a specific "jpg" file to be converted and the specific folder for the outcoming ".ico" file
Parameter="%USERPROFILE%\Downloads\MyPhoto.jpg -resize 48x48 %USERPROFILE%\Documents\Rainmeter\Skins\EXpandable\icon%%.ico"

State=Hide

[MeasureFileName%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FileName
OnChangeAction=[!SetOption MeterTileText%% Text [MeasureFileName%%]]

[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|mp4)$
IfMatch=(?i)^(?:ico)$
IfMatchAction=[!SetOption MeterTileIcon%% ImageName "[MeasureFilePath%%]"]
;IfNotMatchAction=[!SetOption MeterTileIcon%% ImageName "[MeasureFileIcon%%]"]
IfMatchMode=1

[MeasureJPG%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%}
Type=FileType
;IfMatch=(?i)^(?:png|jpg|jpeg|bmp|gif|tif|webP|ico|mp4)$
IfMatch=(?i)^(?:jpg)$
IfMatchAction=[!CommandMeasure MeasureFileJPG%% "Run"]
;IfNotMatchAction=[!SetOption MeterTileIcon%% ImageName "[MeasureFileIcon%%]"]
IfMatchMode=1

[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

[MeterTileJPG%%]
Meter=Image
ImageName=[MeasureFileJPG%%]
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
//
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: FileChoose [Ver.1.2.0.1]

Post by death.crafter »

I feel like this is an overkill. This will use up even more resources than it would take rainmeter to render them.
from the Realm of Death
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

death.crafter wrote: September 14th, 2022, 1:29 pm I feel like this is an overkill. This will use up even more resources than it would take rainmeter to render them.
Precisely. :thumbup: I was just posting an adjusted solution, stay tuned. :D
Of course, whatever the solution, delays are unavoidable - but at least different variants are good for comparison.
Last edited by Yincognito on September 14th, 2022, 1:55 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
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, 4:56 am I managed to work with .ico type for image files using "ImageMagick" so Rainmeter wouldn't take that long to render icons. It seems to work fine, but I have an stupid problem. I couldn't parse path of each "MyPhoto.jpg" in folder and path of each "EXpandable\icon%%.ico" in Messure [MeasureFileJPG%%]
Actually, you have more than one problem, none of them stupid:

- you replicate measures or meters instead of just replacing them, e.g. [MeasureFileType%%] vs [MeasureJPG%%]
- you try to use ImageMagick via RunCommand, which will take at least as much time as Rainmeter resizing the images internally in memory
- you try to use ImageMagick via RunCommand, when there's already an ImageMagick plugin for Rainmeter, called MagickMeter (see its documentation)

Now, I'm not saying running things via RunCommand is not useful, quite the contrary, but you should use it only when there are no other alternatives, especially considering that everything involving drives is many times slower than doing things in memory (even if using the fast CMD.EXE for that).

Here is the template using MagickMeter:

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#}

[MeasureFileIcon%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=Icon
IconSize=Large
; OnChangeAction=[!SetOption MeterTileIcon%% ImageName [MeasureFileIcon%%]]

[MeasureFileName%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FileName
OnChangeAction=[!SetOption MeterTileText%% Text [MeasureFileName%%]]

[MeasureFilePath%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FilePath
; OnChangeAction=[!SetOption MeasureFileMagi%% Image "File [MeasureFilePath%%] | Resize 48,48"]
OnChangeAction=[!SetOption MeasureFileMagi%% Image "File [MeasureFilePath%%] | RenderSize 48,48"]

[MeasureFileMagi%%]
Measure=Plugin
Plugin=MagickMeter.dll
; ExportTo=image%%.jpg

[MeasureFileType%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=FileType
IfMatch=(?i)^(?:png|jpg|bmp|gif|tif|webP|ico)$
IfMatchAction=[!SetOption MeterTileIcon%% MeasureName "MeasureFileMagi%%"]
IfNotMatchAction=[!SetOption MeterTileIcon%% MeasureName "MeasureFileIcon%%"]
IfMatchMode=1

[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
//
I intentionally used a !SetOption bang to set things in the [MeasureFileMagi%%] measure, because, like most of khanhas plugins, the MagickMeter one has a little problem with setting DynamicVariables=1, with the CPU usage increasing a lot in that case.

Anyway, other than that, feel free to chose what option works best, fastest, and suits your case, I left some more or less equivalent options in the file for conveniency, like the Resize one or the ExportTo. I continue to believe that whatever choice you make, you'd still have a delay when resizing, irrespective if it's done by Rainmeter itself or another software via a plugin. For that to happen, files must be read from drives, images decoded, resizing computed and (optionally, but not preferably, as it would increase the delay as well) the result written on drives - all of which take time.
User avatar
Jaime Méndez
Posts: 33
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

I have already installed MagicMeter but Rainmetter is still crashing with your last changes. Shouldn't Image varible be defined in [MesureFileMagi%%]?

Now I know that using RunCommand to run ImageMagick isn't worthless, but just to learn how to parse variables to Parameters, how would you write my intented code in the hipotetic case it should be used for any reazon.

Parameter="%USERPROFILE%\Downloads\MyPhoto.jpg -resize 48x48 %USERPROFILE%\Documents\Rainmeter\Skins\EXpandable\icon%%.ico"

How to parse variable "Path" from Variables.inc file in order to use any photo file in that specified folder, and how to parse "EXpandable" Rainmeter skin dir for any icon%%.ico file that has been rendered
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
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, 4:13 pm Now I know that using RunCommand to run ImageMagick isn't worthless, but just to learn how to parse variables to Parameters, how would you write my intented code in the hipotetic case it should be used for any reazon.

Parameter="%USERPROFILE%\Downloads\MyPhoto.jpg -resize 48x48 %USERPROFILE%\Documents\Rainmeter\Skins\EXpandable\icon%%.ico"

How to parse variable "Path" from Variables.inc file in order to use any photo file in that specified folder, and how to parse "EXpandable" Rainmeter skin dir for any icon%%.ico file that has been rendered
I'll see what I can do later on regarding this, but I tell you, it's a waste of time... :confused:
Jaime Méndez wrote: September 14th, 2022, 4:13 pm I have already installed MagicMeter but Rainmetter is still crashing with your last changes. Shouldn't Image varible be defined in [MesureFileMagi%%]?
In the meantime, does this crash too? I mean, for me it works without any problems.
EXpandable_1.1.1.rmskin
You do not have the required permissions to view the files attached to this post.