It is currently April 27th, 2024, 7:21 am

Make rainmeeter automatically detect changes in folder contents.

Get help with creating, editing & fixing problems with skins
GomezTE
Posts: 2
Joined: March 9th, 2024, 12:50 pm

Make rainmeeter automatically detect changes in folder contents.

Post by GomezTE »

Hello!

I am using rainmeeter to display images as a slideshow, and I have programmed it to pull the images from a map on a shared folder, so that I can update the images displayed from any device.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

Code: Select all

[GetFilePath]
Measure=Plugin
Plugin=QuotePlugin
PathName=S:\TV Information\Bildspel
Subfolders=1
FileFilter=*.jpg;*.jpeg;*.png
UpdateDivider=10
However if I try to change the content of the folder (deleting the old one, then inserting a new image), it fails to detect the added image and empties. Same if I try to add images.
It works if I refresh the skin, but because I won't be on the client at all times it's kind of annoying.

Any help is appreciated!
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Make rainmeeter automatically detect changes in folder contents.

Post by balala »

GomezTE wrote: March 9th, 2024, 1:06 pm Any help is appreciated!
Try adding a DynamicVariables=1 option to the [GetFilePath] measure.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Make rainmeeter automatically detect changes in folder contents.

Post by Yincognito »

GomezTE wrote: March 9th, 2024, 1:06 pm Hello!

I am using rainmeeter to display images as a slideshow, and I have programmed it to pull the images from a map on a shared folder, so that I can update the images displayed from any device.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

Code: Select all

[GetFilePath]
Measure=Plugin
Plugin=QuotePlugin
PathName=S:\TV Information\Bildspel
Subfolders=1
FileFilter=*.jpg;*.jpeg;*.png
UpdateDivider=10
However if I try to change the content of the folder (deleting the old one, then inserting a new image), it fails to detect the added image and empties. Same if I try to add images.
It works if I refresh the skin, but because I won't be on the client at all times it's kind of annoying.

Any help is appreciated!
I don't know how the plugin behaves for mapped / shared network folders and can't test it, but one workaround, if it works on refresh and you don't have other stuff in your skin that would make periodic refreshing inconvenient, would be to add a dummy measure before the GetFilePath one, and refresh the skin when it updates, e.g.:

Code: Select all

[DoRefresh]
Measure=Calc
UpdateDivider=10
OnUpdateAction=[!Refresh]
Another possibility would be to use a FolderInfo measure to get the number of images in the folder, a Calc measure to produce a random number between 1 and the FolderInfo measure's value, and a FileView measure to get the image file name of an Index based on the Calc measure's value. In other words, replicate what the Quote measure does by using plugins that hopefully detect changes better (or at least, have ways to update their data by re-reading the disk, see the last paragraph before the Options header on the FileView page below):
https://docs.rainmeter.net/manual/plugins/folderinfo/
https://docs.rainmeter.net/manual/measures/calc/
https://docs.rainmeter.net/manual/plugins/fileview/

Or, maybe someone else has a better idea (cough cough balala)... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
GomezTE
Posts: 2
Joined: March 9th, 2024, 12:50 pm

Re: Make rainmeeter automatically detect changes in folder contents.

Post by GomezTE »

balala wrote: March 9th, 2024, 2:59 pm Try adding a DynamicVariables=1 option to the [GetFilePath] measure.
I will try, I am really new to coding in general, so what does DynamicVariables do?
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Make rainmeeter automatically detect changes in folder contents.

Post by Yincognito »

GomezTE wrote: March 10th, 2024, 8:43 am I will try, I am really new to coding in general, so what does DynamicVariables do?
https://docs.rainmeter.net/manual/variables/#DynamicVariables
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Make rainmeeter automatically detect changes in folder contents.

Post by balala »

GomezTE wrote: March 10th, 2024, 8:43 am so what does DynamicVariables do?
You have to set the dynamic variables (by adding the DynmaicVariables=1 option) on every measure or meter which are using any of the following things:
  • A variable whose value is changing while the skin is activated (whose value is changed by a !SetVariable bang).
  • Section variable (like for instance [MyMeter:X] or [TimeMeasure:TimeStamp], but obviously there are lot of other examples as well).
  • Finally even if I didn't know this, but it seems that if you set this option onto a Quote plugin measure, the measure will be able to follow the dynamic changes in content of the set folder.
I didn't check what is going on when you're using shared folders as source of images. However my assumption is that it should work. Does it? Try it please and let me know.