It is currently April 19th, 2024, 11:41 am
Linking Quotes to Images
-
- Posts: 5
- Joined: April 17th, 2010, 7:14 pm
Linking Quotes to Images
I've recently been playing around with the Quote plugin and I was wondering if there is a way I could associate a random image with a random quote. For example have a collection of thumbnails of notable persons and their quotes for the Quote plugin to randomly choose from BUT whenever an image is chosen its associated quote will always be the quote selected, or visa versa.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Linking Quotes to Images
Going to be tough. The two calls to QuotePlugin are going to return two different things since each is "random". I don't see QuotePlugin working for this at all.
WebParser using file:// to read a local file is the next obvious thought, but with plugins not allowing DynamicVariables, getting the "random" part would be daunting if not impossible. Probably could be done with some combination of the "RANDOM" calc function and !RainmeterEnableMeasure / !RainmeterShowMeter, but the thought of it gives me the heebie jeebies... Would just be oodles of code.
I think you probably looking at some kind of addon in AutoIt or NirCMD or something. It wouldn't be too hard to code something up in either that could be called by the skin and return a random image name and the matching quote text in dynamic variables, by sending !RainmeterSetVariable to Rainmeter.exe, that you could then just use in Image/String meters where dynamic variables DO work.
Wish I had an easier solution off the top of my head. Maybe one of the others will.
WebParser using file:// to read a local file is the next obvious thought, but with plugins not allowing DynamicVariables, getting the "random" part would be daunting if not impossible. Probably could be done with some combination of the "RANDOM" calc function and !RainmeterEnableMeasure / !RainmeterShowMeter, but the thought of it gives me the heebie jeebies... Would just be oodles of code.
I think you probably looking at some kind of addon in AutoIt or NirCMD or something. It wouldn't be too hard to code something up in either that could be called by the skin and return a random image name and the matching quote text in dynamic variables, by sending !RainmeterSetVariable to Rainmeter.exe, that you could then just use in Image/String meters where dynamic variables DO work.
Wish I had an easier solution off the top of my head. Maybe one of the others will.
-
- Posts: 61
- Joined: April 22nd, 2009, 7:46 pm
Re: Linking Quotes to Images
I it's doable. This method uses webparser and a local text file.
Set up a text file in the form of
<number>1</number><quote>Whatever</quote>
<number2>2</number2><quote2>Whatever 2</quote2>
...
<numberN>N</numberN><quoteN>Whatever N</quoteN>
Then parse it with with webparser.
You will have to number the images, 1-N, and they will all have to be same file type. [MeasureExecuteUpdate] changes the value of Number. In this case, it changes Number every 15 seconds. The [Image] measure's Stringindexes are odd numbered, and the [Quote] measure's are even numbered. [RANDOM] sets Number to a random number between 1 and 50. The highest you can go is 50 images and quotes. It should be possible to split the text file into two different files are parse them separately, allowing you to have up to 100 images and quotes.
Set up a text file in the form of
<number>1</number><quote>Whatever</quote>
<number2>2</number2><quote2>Whatever 2</quote2>
...
<numberN>N</numberN><quoteN>Whatever N</quoteN>
Then parse it with with webparser.
You will have to number the images, 1-N, and they will all have to be same file type. [MeasureExecuteUpdate] changes the value of Number. In this case, it changes Number every 15 seconds. The [Image] measure's Stringindexes are odd numbered, and the [Quote] measure's are even numbered. [RANDOM] sets Number to a random number between 1 and 50. The highest you can go is 50 images and quotes. It should be possible to split the text file into two different files are parse them separately, allowing you to have up to 100 images and quotes.
Code: Select all
[Variables]
Number=1
[Parser]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#RSS1#
RegExp="(?siU)<number>(.*)</number><quote>(.*)<number2>(.)</number2><quote2>(.)</quote2>...
UpdateRate=1
StringIndex=1
[Image1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Parser]
StringIndex=1
[Image2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Parser]
StringIndex=3
[Quote1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Parser]
StringIndex=2
[Quote2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Parser]
StringIndex=4
[RANDOM]
Measure=Calc
Formula=(Random)
LowBound=1
HighBound=51
UpdateRandom=1
[MeasureExecuteUpdate]
Measure=Calc
Formula=Counter % 15
IfAboveAction=!RainmeterSetVariable Number [RANDOM]
IfAboveValue=0
[Image]
Meter=Image
Imagename=[Image#Feed#].png
DynamicVariables=1
[Quote]
Meter=String
Text=[Quote#Feed#]
DynamicVariables=1