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

Using Quoteplugin to choose a file from multiple folders?

Tips and Tricks from the Rainmeter Community
LordgodEric
Posts: 10
Joined: April 21st, 2013, 1:46 pm

Using Quoteplugin to choose a file from multiple folders?

Post by LordgodEric »

Any ideas for choosing a random file from more than one folder?

I know I could pull a random file from each folder (with a separate measure for each) and then choose randomly from one of those.
However this choice would not be randomly distributed between the files if say one folder had a larger number of files than another.

Could we possibly allow the plugin to have multiple Pathname options? (ie pathname, pathname2, pathname3...)

I understand that adjusting the plugin would probably be very difficult
but does anybody have any other ideas?

Thanks.
User avatar
tass_co
Posts: 429
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Using Quoteplugin to choose a file from multiple folders?

Post by tass_co »

LordgodEric wrote: August 6th, 2022, 9:51 am Any ideas for choosing a random file from more than one folder?

I know I could pull a random file from each folder (with a separate measure for each) and then choose randomly from one of those.
However this choice would not be randomly distributed between the files if say one folder had a larger number of files than another.

Could we possibly allow the plugin to have multiple Pathname options? (ie pathname, pathname2, pathname3...)

I understand that adjusting the plugin would probably be very difficult
but does anybody have any other ideas?

Thanks.
I tried to do something for you.
I used the Fileview plugin.
You can also use the Quote plugin if you want.
You report the result :thumbup:

Code: Select all

[Rainmeter]
Update=1000


[Variables]
Folder0=c:\
Folder1=A:\
Folder2=C:\Program Files
Folder3=C:\Program Files\Rainmeter
Folder4=C:\Program Files\paint.net
Folder5=C:\Windows
FolderSelected=
UU=[!UpdateMeasureGroup XY]

[CalcChoose]
Measure=Calc
Formula=(Random)
LowBound=0
HighBound=5
IfCondition=CalcChoose=0
IfTrueAction=[!SetVariable FolderSelected "#Folder0#"]#UU#
IfCondition2=CalcChoose=1
IfTrueAction2=[!SetVariable FolderSelected "#Folder1#"]#UU#
IfCondition3=CalcChoose=2
IfTrueAction3=[!SetVariable FolderSelected "#Folder2#"]#UU#
IfCondition4=CalcChoose=3
IfTrueAction4=[!SetVariable FolderSelected "#Folder3#"]#UU#
IfCondition5=CalcChoose=4
IfTrueAction5=[!SetVariable FolderSelected "#Folder4#"]#UU#
IfCondition6=CalcChoose=5
IfTrueAction6=[!SetVariable FolderSelected "#Folder5#"]#UU#
UpdateDivider=-1

[MeasureFolder]
Measure=Plugin
Plugin=FileView
Recursive=2
Path=#FolderSelected#
DynamicVariables=1
FinishAction=[!EnableMeasure MeasureRandom]

[MeasureCount]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileCount
OnChangeAction=[!SetOption MeasureRandom HighBound [MeasureCount]]
DynamicVariables=1
Group=XY

[MeasureRandom]
Measure=Calc
Formula=Random
UpdateRandom=1
UniqueRandom=1
LowBound=1
UpdateDivider=30
Disabled=1
OnUpdateAction=[!Delay 1000][!UpdateMeasure MeasurePath][!UpdateMeter *][!Redraw]
Group=XY

[MeasurePath]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FilePath
IgnoreCount=1
Index=[MeasureRandom]
OnUpdateAction=[!UpdateMeter MeterLabel]
UpdateDivider=-1
DynamicVariables=1
Group=XY

[MeterLabel]
Meter=String
MeasureName=MeasurePath
X=0
Y=0
H=18
FontSize=12
FontColor=170,170,170,255
SolidColor=47,47,47,255
StringStyle=Italic
AntiAlias=1
Text=File %1
LeftMouseUpAction=[!Refresh]
DynamicVariables=1
I don't know where i going from here, but i promise it won't be boring... :great:
LordgodEric
Posts: 10
Joined: April 21st, 2013, 1:46 pm

Re: Using Quoteplugin to choose a file from multiple folders?

Post by LordgodEric »

Tass,
Thanks for the feedback and the effort. Unfortunately this is what I was saying I knew I COULD do. But ,it really doesn't get me what I wanted. I guess to make it easier to understand...

If I have

Folder1 .... that has say 300 different files to choose from
Folder2 .... that has only 4 files to choose from

I looking to randomly choose evenly between these 304 files.

With the method choosing randomly between the folders (and then getting a file randomly in that folder)
50% of the time I would be getting one of the 4 files in folder 2.

....

I'm thinking the easiest way to do this might be to use lua script to make a master table of the folders/files and then pick randomly from that table each time.

Thanks again for the effort Tass.

tass_co wrote: August 6th, 2022, 11:11 am I tried to do something for you.
I used the Fileview plugin.
You can also use the Quote plugin if you want.
You report the result :thumbup:

Code: Select all

[Rainmeter]
Update=1000


[Variables]
Folder0=c:\
Folder1=A:\
Folder2=C:\Program Files
Folder3=C:\Program Files\Rainmeter
Folder4=C:\Program Files\paint.net
Folder5=C:\Windows
FolderSelected=
UU=[!UpdateMeasureGroup XY]

[CalcChoose]
Measure=Calc
Formula=(Random)
LowBound=0
HighBound=5
IfCondition=CalcChoose=0
IfTrueAction=[!SetVariable FolderSelected "#Folder0#"]#UU#
IfCondition2=CalcChoose=1
IfTrueAction2=[!SetVariable FolderSelected "#Folder1#"]#UU#
IfCondition3=CalcChoose=2
IfTrueAction3=[!SetVariable FolderSelected "#Folder2#"]#UU#
IfCondition4=CalcChoose=3
IfTrueAction4=[!SetVariable FolderSelected "#Folder3#"]#UU#
IfCondition5=CalcChoose=4
IfTrueAction5=[!SetVariable FolderSelected "#Folder4#"]#UU#
IfCondition6=CalcChoose=5
IfTrueAction6=[!SetVariable FolderSelected "#Folder5#"]#UU#
UpdateDivider=-1

[MeasureFolder]
Measure=Plugin
Plugin=FileView
Recursive=2
Path=#FolderSelected#
DynamicVariables=1
FinishAction=[!EnableMeasure MeasureRandom]

[MeasureCount]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileCount
OnChangeAction=[!SetOption MeasureRandom HighBound [MeasureCount]]
DynamicVariables=1
Group=XY

[MeasureRandom]
Measure=Calc
Formula=Random
UpdateRandom=1
UniqueRandom=1
LowBound=1
UpdateDivider=30
Disabled=1
OnUpdateAction=[!Delay 1000][!UpdateMeasure MeasurePath][!UpdateMeter *][!Redraw]
Group=XY

[MeasurePath]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FilePath
IgnoreCount=1
Index=[MeasureRandom]
OnUpdateAction=[!UpdateMeter MeterLabel]
UpdateDivider=-1
DynamicVariables=1
Group=XY

[MeterLabel]
Meter=String
MeasureName=MeasurePath
X=0
Y=0
H=18
FontSize=12
FontColor=170,170,170,255
SolidColor=47,47,47,255
StringStyle=Italic
AntiAlias=1
Text=File %1
LeftMouseUpAction=[!Refresh]
DynamicVariables=1
User avatar
tass_co
Posts: 429
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Using Quoteplugin to choose a file from multiple folders?

Post by tass_co »

LordgodEric wrote: August 7th, 2022, 9:49 am Tass,
Thanks for the feedback and the effort. Unfortunately this is what I was saying I knew I COULD do. But ,it really doesn't get me what I wanted. I guess to make it easier to understand...

If I have

Folder1 .... that has say 300 different files to choose from
Folder2 .... that has only 4 files to choose from

I looking to randomly choose evenly between these 304 files.

With the method choosing randomly between the folders (and then getting a file randomly in that folder)
50% of the time I would be getting one of the 4 files in folder 2.

....

I'm thinking the easiest way to do this might be to use lua script to make a master table of the folders/files and then pick randomly from that table each time.

Thanks again for the effort Tass.
Sorry, i misunderstood
Finally, let me offer an idea.
So, would splitting FileCounts work? ([MeasureCount]/5)
Or you can get the Count value constant.
If the ratios in the folders are certain, you will get rid of a separate script :thumbup:
I don't know where i going from here, but i promise it won't be boring... :great:
LordgodEric
Posts: 10
Joined: April 21st, 2013, 1:46 pm

Re: Using Quoteplugin to choose a file from multiple folders?

Post by LordgodEric »

no...but I suppose I could use the folderinfo plugin to get the file count of the folders and weight them accordingly.

Thanks for the idea tass.
User avatar
tass_co
Posts: 429
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Using Quoteplugin to choose a file from multiple folders?

Post by tass_co »

LordgodEric wrote: August 7th, 2022, 10:40 am no...but I suppose I could use the folderinfo plugin to get the file count of the folders and weight them accordingly.

Thanks for the idea tass.
:thumbup:
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
Active Colors
Moderator
Posts: 1199
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Using Quoteplugin to choose a file from multiple folders?

Post by Active Colors »

You can make a calc random measure which would randomly choose between two folders or between two quote measures.

It is probably even possible to adjust the random probablity depending on the file count in each folder, since you probably don't want to see the same 4 images very often while you have another folder with 300 images.