It is currently October 5th, 2024, 4:10 pm

FileChoose [Ver.1.2.0.1]

Share and get help with Plugins and Addons
User avatar
Yincognito
Rainmeter Sage
Posts: 8350
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 21st, 2022, 1:23 pm I think I'm missing something :???: I can't get it to work
Believe it or not, neither can I ... at least not in all circumstances. In other words, this will work, but not correctly - at one point or another it will either not show all items in the folder, show too many, or create incrementally more icons than needed:

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"]

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

[Variables]

@include=#@#variables.inc

[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=#Path#

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

[MeasureFolderPath]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FolderPath
RegExpSubstitute=1
Substitute="(?!:)\\$":""

[MeasureFolderParent]
Measure=String
String=#Path#
RegExpSubstitute=1
Substitute="^(.*)\\(.*?)$":"\1","(?i)^[A-Z]:$":""

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

[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=[!Refresh]#Update#
MiddleMouseUpAction=[!WriteKeyValue "Variables" "Path" [MeasureFolderParent] "#@#Variables.inc"][!Refresh]#Update#
RightMouseUpAction=["#Path#"]

[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=#Path#
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)$
; --- Rainmeter ---
; IfMatchAction=[!SetOption MeterTileIcon%% MeasureName "MeasureFilePath%%"]
; IfNotMatchAction=[!SetOption MeterTileIcon%% MeasureName "MeasureFileIcon%%"]
; --- Magick Meter ---
; IfMatchAction=[!SetOption MeasureFileMagM%% Image "File [MeasureFilePath%%] | Resize 48,48"][!SetOption MeterTileIcon%% MeasureName "MeasureFileMagM%%"]
; IfNotMatchAction=[!SetOption MeasureFileMagM%% Image ""][!SetOption MeterTileIcon%% MeasureName "MeasureFileIcon%%"]
--- Magick Run ---
IfMatchAction=[!CommandMeasure MeasureFileMagR%% "Run"]

[MeasureFileIcon%%]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Index={%%+1}
Type=Icon
IconSize=Large
; --- Rainmeter ---
; (nothing)
; --- Magick Meter ---
; (nothing)
--- Magick Run ---
OnChangeAction=[!SetOption MeterTileIcon%% MeasureName "MeasureFileIcon%%"]

; --- Rainmeter ---
; (nothing)
; --- Magick Meter ---
; [MeasureFileMagM%%]
; Measure=Plugin
; Plugin=MagickMeter.dll
--- Magick Run ---
[MeasureFileMagR%%]
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=[!CommandMeasure "MeasureFilePath%%" "FollowPath"][!WriteKeyValue "Variables" "Path" "[MeasureFolderPath]" "#@#Variables.inc"][!Refresh]#Update#
MiddleMouseUpAction=[!WriteKeyValue "Variables" "Path" "[MeasureFolderParent]" "#@#Variables.inc"][!Refresh]#Update#
RightMouseUpAction=["[MeasureFilePath%%]"]

[MeterTileIcon%%]
Meter=Image
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 left all 3 variants in the template (2 of them commented), and added / adjusted the measures for the folder path and the parent folder in the .ini (both of these are used in the mouse actions to navigate back and forth). The way to detect whether an item is a folder or not that I suggested earlier was not valid, because it seems that the PathToFile type returns only the path without the file/folder name, so I used a trick to achieve it: I first command a FileView child measure to "FollowPath" and then write the updated path in the variables file. This works because if the item is a file, following the path has the same effect as opening the file via right click; if the item is a folder, the parent measure is automatically updated with the new path (from which we strip the backslash in the folder path measure).

As for the irregularities, maybe it's the follow path approach or something from the Lua scripts, I'm not sure. I might check the code again at a later time to see if I can fix it, but such things should normally be asked from the skin designer on his GitHub link.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Jaime Méndez
Posts: 98
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Do you know why this isn't working?

Code: Select all

[MeasureMyFlag]
Measure=Calc
Formula=#Flag#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterTileSelection%% LeftMouseUpAction "[!WriteKeyValue "Variables" "Path" "[MeasureFilePath%%]" "#@#Variables.inc"][!Refresh]#Update#"]
IfFalseAction=[!SetOption MeterTileSelection%% LeftMouseUpAction "["[MeasureFilePath%%]"][!SetVariable Flag 0]"]
DynamicVariables=1
Even if I do this:

Code: Select all

IfCondition=1 = 1
it won't LeftMouseUpAction in MeterTileSelection%%
Last edited by Jaime Méndez on September 22nd, 2022, 2:13 am, edited 2 times in total.
User avatar
Jaime Méndez
Posts: 98
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

Yincognito wrote: September 21st, 2022, 11:09 pm Believe it or not, neither can I ... at least not in all circumstances. In other words, this will work, but not correctly - at one point or another it will either not show all items in the folder, show too many, or create incrementally more icons than needed:
It seems to work fine for me , I can't replicate the bug you talk about :???:

Edit: A just saw the bug. It happened to me too, especially when changing disk c, but once you go to %USERPROFILE%, it then behaves normally. It started to happen when I integrated back and forward functionality and only few times when you go all the way back to "My Computer" or going to windows directory.
User avatar
Jaime Méndez
Posts: 98
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

I finally finished my skin thanks to you guys. You can check it out here https://forum.rainmeter.net/viewtopic.php?t=41394
User avatar
Yincognito
Rainmeter Sage
Posts: 8350
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FileChoose [Ver.1.2.0.1]

Post by Yincognito »

Jaime Méndez wrote: October 21st, 2022, 8:27 pm I finally finished my skin thanks to you guys. You can check it out here https://forum.rainmeter.net/viewtopic.php?t=41394
:thumbup: :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Jaime Méndez
Posts: 98
Joined: August 31st, 2022, 10:00 pm

Re: FileChoose [Ver.1.2.0.1]

Post by Jaime Méndez »

You can change aspect ratio of Expandable folder in Resources\ExpandVariables.inc
Change the integer number here: Tiles_Len=(Ceil(Sqrt(#Amount#))+1)
I suggest 0, 1, 2 or 3 depending on how you want it to be expanded
User avatar
balala
Rainmeter Sage
Posts: 16631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: FileChoose [Ver.1.2.0.1]

Post by balala »

Jaime Méndez wrote: October 22nd, 2022, 1:14 pm You can change aspect ratio of Expandable folder in Resources\ExpandVariables.inc
Change the integer number here: Tiles_Len=(Ceil(Sqrt(#Amount#))+1)
I suggest 0, 1, 2 or 3 depending on how you want it to be expanded
To avoid off-topic...