It is currently March 28th, 2024, 10:37 pm

Slideshow "Back"-Button

Get help with creating, editing & fixing problems with skins
Peter von Frosta
Posts: 7
Joined: December 10th, 2017, 12:09 pm

Slideshow "Back"-Button

Post by Peter von Frosta »

Hi There,

another little Problem...

I want to modify an existing Slideshow with a simple "one Picture back" Button.

Here is the Path to the Picture:

Code: Select all

; MEASURES
[mImage]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#PicturesPath#
Subfolders=1
FileFilter=*.jpg;*.jpeg
UpdateDivider=#Duration#
and here the meter:

Code: Select all

[Image]
Meter=IMAGE
MeasureName=mImage
X=13
Y=11
W=700
H=467
PreserveAspectRatio=#PreserveAspectRatio#
I have tried different ways to automaticly "write" the Path from the Picture [mImage] to a variable [e.g. pImage] before mImage will be updatet. If this succeed I would have a simple solution for my Problem.
The only way it worked for me was to do it manualy with the "LeftMouseUpAction" in combination with "!RainmeterSetVariable", but that is not the solution.

Any hints?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Slideshow "Back"-Button

Post by balala »

A while ago I wrote a such Slideshow, which has a fully functional Back button. It can bring back the last five images, not just the last one. In addition, it has 12 transition effects between the images.
Here is the link: https://forum.rainmeter.net/viewtopic.php?p=129028#p129028
Please check it and let me know if it works as you want.
Peter von Frosta
Posts: 7
Joined: December 10th, 2017, 12:09 pm

Re: Slideshow "Back"-Button

Post by Peter von Frosta »

Hi balala,

thanks for your Suggestion, but I´ve tried your Skin already while searching for a solution of my problem.
As far as I understand you wrote the last five Pictures via *.lua into a seperate *.ini or *.cfg, but the experience on my PC was very - lets say "non smooth"
I want only one Picture back - there must be a simple way to do so, e.g. automaticly writing the mImage-measure to another variable.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Slideshow "Back"-Button

Post by balala »

Peter von Frosta wrote:Hi balala,

thanks for your Suggestion, but I´ve tried your Skin already while searching for a solution of my problem.
As far as I understand you wrote the last five Pictures via *.lua into a seperate *.ini or *.cfg, but the experience on my PC was very - lets say "non smooth"
I want only one Picture back - there must be a simple way to do so, e.g. automaticly writing the mImage-measure to another variable.
You could use that skin, without modifications. This way you don't need no experience at all, just have to make the needed settings (set the appropriate folder where you're storing the images and so on).
However, if you don't want to use it, here is a much simpler solution, which can work. Let's see if it is good enough for your needs.
First you need a variable, which will control which image is shown. I named this variable ImageNo. It has to be defined into the [Variables] section of your skin:

Code: Select all

[Variables]
...
ImageNo=0
CurrentPic=
I also added there the CurrentPic variable. It is left empty and it helps to avoid an error message in the log if you click the later added [MeterPrev] (which will bring back the previous image), before the first update of the [mImage] measure.
The meaning of this variable is that if its value is 0, the current image will be shown by the Image meter (that one which is returned by the [mImage] measure). If its value is 1 (in fact if it is greater than 0), you'll see the previous image.
The skin uses two variables, which are storing, one the path of the previous image and the other the path of the current one. You have to set them each time the [mImage] measure is updated. So add the following option to this measure: OnUpdateAction=[!SetVariable PreviousPic "#CurrentPic#"][!SetVariable CurrentPic "[mImage]"]. This option also requires to add to the same measure a DynamicVariables=1 option. Don't forget it.
Now you can remove the MeasureName option of the [Image] meter (don't forget removing it, otherwise the code won't work properly!). We'll set the appropriate option through a !SetOption bang, depending on the value of the above ImageNo variable, that's why you can remove this option.
The next step is to add a Calc measure, which keeps track of the value of ImageNo, setting the appropriate option of the Image meter accordingly:

Code: Select all

[MeasureImage]
Measure=Calc
Formula=#ImageNo#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!PauseMeasure "mImage"][!SetOption Image ImageName "#*PreviousPic*#"][!SetOption MeterPrev Text "Current"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!Redraw]
IfFalseAction=[!UnpauseMeasure "mImage"][!SetOption Image ImageName "[*mImage*]"][!SetOption MeterPrev Text "Previous"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!Redraw]
IfConditionMode=1
DynamicVariables=1
You also will need a way to can bring back the previous image, or if that one is brought back, to can set again the current image. I did this through a String meter, added after the [Image] meter:

Code: Select all

[MeterPrev]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!SetVariable ImageNo "(1-#ImageNo#)"][!UpdateMeasure "MeasureImage"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
This meter sets the value of the ImageNo variable and using this value, the [MeasureImage] measure sets the appropriate image to the [Image] image meter and the appropriate Text to the [MeterPrev] String meter.

Just one more: The !PauseMeasure and !UnpauseMeasure bangs of the IfTrueAction and IfFalseAction options of the [MeasureImage] measure are pausing the [mImage] measure when the previous image is shown and are unpausing it, when the current one is. This makes the skin to not change the image while the previous image is displayed. If however you'd like to update it even in this case, simple remove these ([!PauseMeasure "mImage"] and [!UnpauseMeasure "mImage"]) bangs.
Please check this code and let me know if it works as you'd like.
Peter von Frosta
Posts: 7
Joined: December 10th, 2017, 12:09 pm

Re: Slideshow "Back"-Button

Post by Peter von Frosta »

Hi balala,

your Solutions works perfectly - that was exactly (a little bit more) what I needed :thumbup:

One additinal question:

I use 600px from the 700px of the displayed imgage for a LeftMouseUpAction to open the Image in the Windows Picture Viewer.
The other 100px on the left Side of the displayed Image is "reserved" for yor perfectly working "Previous/Pause"- respectivily "Current/Run"-Button.

Code: Select all

[TextArea]
Meter=IMAGE
MeterStyle=sTextArea
X=100
Y=0
W=600
H=467
SolidColor=00000001
ToolTipText="Bild öffnen"
LeftMouseUpAction=[explorer.exe [ImageName]]
Unfortunately, that doesn´t work, the explorer opens "MyDocuments", but not the Picture in the PictureViewer
The Meter that the Image Displays is this:

Code: Select all

[Image]
Meter=IMAGE
MeasureName=ImageName
X=0
Y=0
W=700
H=467
PreserveAspectRatio=#PreserveAspectRatio#
I´ve tried all known variations of "ImageName" and "Image" - with [, with *, with # and all combinations...

Any hints?

Cheers
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Slideshow "Back"-Button

Post by ikarus1969 »

try adding "DynamicVariables=1" to the "[TextArea]" meter to have the "[ImageName]" measure resolved to the picture name:

Code: Select all

[TextArea]
Meter=IMAGE
MeterStyle=sTextArea
X=100
Y=0
W=600
H=467
SolidColor=00000001
ToolTipText="Bild öffnen"
LeftMouseUpAction=[explorer.exe [ImageName]]
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Slideshow "Back"-Button

Post by balala »

Peter von Frosta wrote:your Solutions works perfectly - that was exactly (a little bit more) what I needed :thumbup:
I'm glad in this case.
Peter von Frosta wrote:Unfortunately, that doesn´t work, the explorer opens "MyDocuments", but not the Picture in the PictureViewer
You can try ikarus1969's solution, however maybe the problem resides into something else.
What is the path of the folder where you're storing the images? I'm not necessary interested into the exact path, but if it contains a (or more) space(s), you should have to include the [ImageName] into quotations: LeftMouseUpAction=[explorer.exe [color=#FF0000]"[/color][ImageName][color=#FF0000]"[/color]].
If still can you get it to work, please post the whole code you're using.
Peter von Frosta
Posts: 7
Joined: December 10th, 2017, 12:09 pm

Re: Slideshow "Back"-Button

Post by Peter von Frosta »

:( None of your both suggestions works.

Here is the complete Code:

Code: Select all

[Rainmeter]
Author=
AppVersion=
Update=1000

[Metadata]
Name=Slideshow
Description=
Instructions=
Version=
License=

[Variables]
PicturesPath=D:\Pictures
Duration=15
PreserveAspectRatio=1
ImageNo=0
CurrentPic=

; MEASURES ====================================

[mImage]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#PicturesPath#
Subfolders=1
FileFilter=*.jpg;*.jpeg
OnUpdateAction=[!SetVariable PreviousPic "#CurrentPic#"][!SetVariable CurrentPic "[mImage]"]
UpdateDivider=#Duration#
DynamicVariables=1

; METERS ======================================

[MeasureImage]
Measure=Calc
Formula=#ImageNo#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!PauseMeasure "mImage"][!SetOption Image ImageName "#*PreviousPic*#"][!SetOption MeterPrev Text "Weiter"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!Redraw]
IfFalseAction=[!UnpauseMeasure "mImage"][!SetOption Image ImageName "[*mImage*]"][!SetOption MeterPrev Text "Zurück"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!Redraw]
IfConditionMode=1
DynamicVariables=1

[Image]
Meter=IMAGE
MeasureName=ImageName
X=0
Y=0
W=700
H=467
PreserveAspectRatio=#PreserveAspectRatio#

[MeterPrev]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!SetVariable ImageNo "(1-#ImageNo#)"][!UpdateMeasure "MeasureImage"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[TextArea]
Meter=IMAGE
MeterStyle=sTextArea
X=100
Y=0
W=600
H=467
SolidColor=00000001
ToolTipText="Bild öffnen"
LeftMouseUpAction=[explorer.exe [mImage]]
In this case I´ve changed the last Line to the "original" random Image-Variable [mImage].
That still works for the normal, random Image, but (as expected) not for the previous Image (Shows the paused random Image).
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Slideshow "Back"-Button

Post by balala »

Peter von Frosta wrote:That still works for the normal, random Image, but (as expected) not for the previous Image (Shows the paused random Image).
Now I'm not sure I see what the problem is: the appropriate image doesn't open at all or just the previous image doesn't open, when that one shown?
Because for me clicking the image opens the current image. If I understood well, it also works for you. So, I suppose the problem is you'd like to open the previous image, when that one is visible. Right?
If so, you have to set different LeftMouseUpAction on the [TextArea] meter, depending if the current or the previous image is shown.
Before proceeding further, I think you should have to modify a bit the original LeftMouseupAction option of the meter. Instead of LeftMouseUpAction=[explorer.exe [mImage]], I'd use the much simpler LeftMouseUpAction=["[mImage]"], which at least for me works the same way, probably it also does for you.
Now, to can open the currently shown image (the current or the previous, accordingly), remove the LeftMouseUpAction option of the [TextArea] meter, then set it back through the IfTrueAction and IfFalseAction options of the [MeasureImage] measure. For this add the appropriate two bangs to each of these options (I post the whole options, not just the new bangs):

Code: Select all

[MeasureImage]
...
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!PauseMeasure "mImage"][!SetOption Image ImageName "#*PreviousPic*#"][!SetOption TextArea LeftMouseUpAction """["#*PreviousPic*#"]"""][!SetOption MeterPrev Text "Weiter"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!UpdateMeter "TextArea"][!Redraw]
IfFalseAction=[!UnpauseMeasure "mImage"][!SetOption Image ImageName "[*mImage*]"][!SetOption TextArea LeftMouseUpAction """["[*mImage*]"]"""][!SetOption MeterPrev Text "Zurück"][!UpdateMeter "Image"][!UpdateMeter "MeterPrev"][!UpdateMeter "TextArea"][!Redraw]
Please let me know if I understood well your want.
Peter von Frosta
Posts: 7
Joined: December 10th, 2017, 12:09 pm

Re: Slideshow "Back"-Button

Post by Peter von Frosta »

Hi balala,

great! It works like I want it.

Thanks a lot!