Ver.1.2.0.1 Jan. 31 2021
_Fixed a bug where ChooseFolder and ChooseImage dont work when GetIcon=0.
_Added a new option "FileInitialDirectory" to set the initial folder when choosing files and folders.
_Added a new option "ImageInitialDirectory" to set the initial folder when choosing images.
Ver.1.1.0.4 Jan. 23 2021
_Fixed a bug where closing the skin while the choosing dialog opened can cause rainmeter to crash.
Ver.1.1.0.2 Dec. 08 2019
_Changed the code for saving icon image to solve some bugs.
Ver.1.1.0.1 Oct. 31 2019
_Added $Icon$ for use.
_Added a new bang "Resolve N Path" for use.
============================================
The idea comes up when I am working on my skin suite. I find I need a method to open a dialog to choose a file/folder/image without refreshing the skin. So I work for about a week on this plugin.
The plugin works like "RainFile.exe". FileChoose.dll enable users to open a windows dialog to choose a file/folder/image, and then get the name, extension, path.
I develop the plugin on win10, VS2017. In theory the plugin can be used on WinXP and greater, but I have tested it only on win10.
Download
SouceCode : Usage
Code: Select all
[MeasureChoose]
Measure=Plugin
Plugin=FileChoose
UseNewStyle=0
GetTarget=1
AllowNonstorageFolder=1
CopyLink=1
LinkCache=#CurrentPath#
GetIcon=1
IconCache=#CurrentPath#
IconSize=3
ReturnValue=Path
FileInitialDirectory=
ImageInitialDirectory=
Command1=[!Log "$Name$"][!Log "$Path$"][!Log """$[Path]$"""][!Log "$Ext$"][!Log "$NameAndExt$"][!Log "$Icon$"]
Command2=......
[MeterChooseButton]
xxxxxxxxxx
LeftMouseUpAction=[!CommandMeasure MeasureChoose "ChooseFile 1"]
- UseNewStyle ( Default : 0 )
DO NOT TURN IT TO "1" UNLESS YOUR SKIN IS DESIGNED FOR ONLY WIN10
- GetTarget ( Default : 1 )
If failed to get the target, return the path of the shortcut file, or copy the shortcut if "CopyLink = 1".
Only be valid when choosing a file.
NOTE : Whether GetTarget = 1 or not, the name will be that of the shortcut file rather than the target.
- AllowNonstorageFolder ( Default : 0 )
Only be valid when choosing a folder and "UseNewStyle = 1".
NOTE : Nonstorage folder:
like "My Computer", whose path is "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
like some folder packed in the rar (DONT CHOOSE IT, PLEASE)
- CopyLink ( Default : 0 )
In this case, the path we get will be the path of the copy.
The cache folder must exist, which can be set with the option "LinkCache".
If failed to copy it, return the path of the original one.
NOTE : The name of the copy will be the same as the original one.
If there exist a file of the same name in the cache folder, REPLACE IT.
- LinkCache ( Default : #CurrentPath# )
The path must exist. And the folder path should contain a "\" in the end of the string.
- GetIcon ( Default : 0 )
The cache folder must exist, which can be set with the option "LinkCache".
If failed to get the icon, return a empty string.
NOTE : (VERY IMPORTANT!)
Folders, images (*.png, *.jpg, *.jpeg, *.bmp, *.ico), these files' icon will not be copied.
As for images, we return the file path to use as the icon path.
As for folders, just return a string "(IconCache\)folder.png", WHETHER THE FILE "folder.png" EXIST OR NOT!
THEREFORE, REMEMBER TO ADD A IMAGE "folder.png" INTO THE ICON CACHE!
If there exist a file of the same name in the cache folder, REPLACE IT.
- IconCache ( Default : #CurrentPath# )
The path must exist. And the folder path should contain a "\" in the end of the string.
Remember to add a image "folder.png" in the folder for use.
- IconSize ( Default : 3 )
Valid Value :
0 : Small, 16x16
1 : Medium, 32x32
2 : Large, 48x48
3 : ExtraLarge, 256x256
NOTE : For some files who dont have a extralarge icon, get the large icon(48x48) instead.
- ReturnValue ( Default : Path )
Valid value: Path / WholePath / Name / Extensions / NameAndExt / Icon
The meaning of the value will be introduced later.
NOTE : In most time, I suggest to use the bang command instead of the string value,
but when using lua script, it can be surprisingly useful.
- FileInitialDirectory
If defined, every time choosing a file or a folder, the intial directory is forced to be set as this.
if "UseNewStyle = 1" is not set, this is ineffective when choosing folders.
- ImageInitialDirectory
If defined, every time choosing a image, the intial directory is forced to be set as this.
- Command N
Some $Variable$ you may use:
$Path$ / $[Path]$ / $Name$ / $Ext$ / $NameAndExt$ / $Icon$
The meaning of the value will be introduced later.
Bangs
- "ChooseFile N"
- "ChooseFolder N"
- "ChooseImage N"
- "Resolve N PATH"
PATH is a string of file path. (DONT CONTAIN ANY "")
This bang enable user to first get a filepath in other method, and then use this plugin to get the information of the file. In the end, execute the "Command N".
Meaning of the value
Lets see the example to show the meaning of the ReturnValue and the $Variables$ :
We assume to choose "AIMP_SHORTCUT.lnk", whose target is "D:\Program\AIMP\AIMP.exe".
========================================
ReturnValue | $Variables$ | Sample Value
Path | $Path$ | D:\Program\AIMP\AIMP.exe
WholePath | $[Path]$ | ["D:\Program\AIMP\AIMP.exe"]
Name | $Name$ | AIMP_SHORTCUT
Extensions | $Ext$ | exe (empty if folder)
NameAndExt | $NameAndExt$ | AIMP.exe
Icon | $Icon$ | (IconCache\)AIMP_SHORTCUT_lnk.png
========================================
Tips