It is currently May 9th, 2021, 5:28 pm

Help with file view, and images

Help with creating, editing & fixing problems with skins
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am
Location: Norway, Tromoy

Help with file view, and images

Post by BlueJive »

Hey all,

I'd really appreciate some help with the fileView plugin. I'm currently trying to get it to loop through all the files in a certain directory, find the latest one, and use a skin to display that file as an image on the desktop. Luckily, all of the files in the directory will always be .png files and nothing else, so that removes a certain aspect of difficulty. However, my difficulty lies in getting my code to work, and I'd really appreciate some help with it.

Code: Select all

[Rainmeter]
Update=1000

[MeasureName]
Measure=Plugin
Plugin=FileView
Path=C:\Users\User\Downloads\Screenshots\
Type=FileDate

[MeasureChild]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileDate
DateType=Created
Index=1

[Name]
Meter=Image
MeasureName=MeasureName
ImageName=C:\Users\User\Downloads\Screenshots\%1
DynamicVariables=1
This, for whatever reason, does not work.

Any help is appreciated, thank you :D
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4261
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help with file view, and images

Post by eclectic-tech »

BlueJive wrote: April 8th, 2021, 10:48 am Hey all,

I'd really appreciate some help with the fileView plugin. I'm currently trying to get it to loop through all the files in a certain directory, find the latest one, and use a skin to display that file as an image on the desktop. Luckily, all of the files in the directory will always be .png files and nothing else, so that removes a certain aspect of difficulty. However, my difficulty lies in getting my code to work, and I'd really appreciate some help with it.

Code: Select all

[Rainmeter]
Update=1000

[MeasureName]
Measure=Plugin
Plugin=FileView
Path=C:\Users\User\Downloads\Screenshots\
Type=FileDate

[MeasureChild]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileDate
DateType=Created
Index=1

[Name]
Meter=Image
MeasureName=MeasureName
ImageName=C:\Users\User\Downloads\Screenshots\%1
DynamicVariables=1
This, for whatever reason, does not work.

Any help is appreciated, thank you :D
You need to specify a few more options in the parent measure to show only files and sort descending. Once you do that and correct a few typos, the full path and filename will be the value of your child measure.

This should work: (it works with my path)

Code: Select all

[Rainmeter]
Update=1000

[MeasurePath]
Measure=Plugin
Plugin=FileView
Path=C:\Users\User\Downloads\Screenshots\
ShowFolder=0
ShowDotDot=0
SortType=Date
SortDateType=Created
SortAscending=0
FinishAction=[!UpdateMeter Name][!Redraw]

[MeasureChildName]
Measure=Plugin
Plugin=FileView
Path=[MeasurePath]
Type=FilePath
DateType=Created
Index=1

[Name]
Meter=Image
MeasureName=MeasureChildName
DynamicVariables=1
Note you do not need an ImageName value in [Name] when you bind a measure that returns the full path and image name to the meter; the "Type=FilePath" in [MeasureChildName] returns those as the value.
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am
Location: Norway, Tromoy

Re: Help with file view, and images

Post by BlueJive »

Thanks! Such a helpful explanation as well, I have no idea what I was doing with the first code!

The script is up and running now, thanks to you. :D :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 12638
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with file view, and images

Post by balala »

BlueJive wrote: April 8th, 2021, 10:48 am

Code: Select all

[Rainmeter]
Update=1000

[MeasureName]
Measure=Plugin
Plugin=FileView
Path=C:\Users\User\Downloads\Screenshots\
Type=FileDate

[MeasureChild]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileDate
DateType=Created
Index=1

[Name]
Meter=Image
MeasureName=MeasureName
ImageName=C:\Users\User\Downloads\Screenshots\%1
DynamicVariables=1
Beside eclectic-tech's reply, note a mistake in this code: a [MeasureFolder] measure, used in the Path option of the [MeasureChild] (Path=[MeasureFolder]), doesn't even exist.
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am
Location: Norway, Tromoy

Re: Help with file view, and images

Post by BlueJive »

Thanks for that. I'm such a scatterbrain with Rainmeter code. I once spent an hour trying to figure out why my skin didn't work. Turned out I had put Meter=Text instead of Meter=String :rofl:
User avatar
balala
Rainmeter Sage
Posts: 12638
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with file view, and images

Post by balala »

BlueJive wrote: April 8th, 2021, 4:28 pm I once spent an hour trying to figure out why my skin didn't work. Turned out I had put Meter=Text instead of Meter=String :rofl:
Yeah, it happens sometimes, however this mistake is something which can be discovered easily:
  • IIf the meter is the only meter of the skin, Rainmeter immediately disables (unloads) the skin when you try to load /refresh it, with a "skin doesn't contain meters" (or something similar) message.
  • I suppose the above is not your case (because in such a case there is easy to discover the mistake), but even if it's not, log is your friend in such case. A Meter=Text is not valid in [YourMeter] (Yourskin) error message in log tells you immediatelly what is your mistake.
  • Finally if you're using a better text editor, like Notepad++ for instance (but even if I'm not using it, I suppose Sublime Text for example has similar capabilities), not Notepad, it indicates you the mistake as well, by coloring red the Text word in the Meter=Text option.
User avatar
Sam12345
Posts: 73
Joined: February 27th, 2021, 9:41 pm
Location: London

Re: Help with file view, and images

Post by Sam12345 »

balala wrote: April 8th, 2021, 5:46 pm I suppose Sublime Text for example has similar capabilities
It does
Insert inspirational quote here