It is currently December 3rd, 2020, 10:27 am

How do I make a Screen Saver with Rainmeter?

General topics related to Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 11857
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I make a Screen Saver with Rainmeter?

Post by balala »

Yincognito wrote: November 10th, 2020, 5:34 pm As far as I know, the process must be an executable. Are you sure the .SCR file is an executable?
In fact all .scr screen savers are executable files, which have the exe extension replaced by scr. I1m absolutely positive of this, because I wrote screen savers in past. However the Process measure doesn't return 1 for such a process, so there for sure is something I didn't realize.
Yincognito wrote: November 10th, 2020, 5:34 pm You should look for the Windows background process that handles "playing" a screensaver, if any, and work with that.
Is there anything like this? How do I look for it?
User avatar
Yincognito
Posts: 2934
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How do I make a Screen Saver with Rainmeter?

Post by Yincognito »

balala wrote: November 10th, 2020, 6:11 pm In fact all .scr screen savers are executable files, which have the exe extension replaced by scr. I1m absolutely positive of this, because I wrote screen savers in past. However the Process measure doesn't return 1 for such a process, so there for sure is something I didn't realize.

Is there anything like this? How do I look for it?
Yeah, suspected that as well, from my past and very rare handling of .SCR files. Maybe it's the measure that expects a plain executable then? Don't know yet, as I'm on mobile and can't test right now. But I'll get home soon and investigate this.

If the .SCR files are executables, then theoretically they won't need yet another executable to run them, although in practice this might not be true. Generally, for a process to be detected as such by the Process measure, that process must appear in the Windows Task Manager as well, in one of its tabs. It's a bit difficult to test since the screensaver is I think closed on non idle operations like showing Task Manager, but you might workaround this by some UsageMonitor skin keeping track of all running processes.
User avatar
balala
Rainmeter Sage
Posts: 11857
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I make a Screen Saver with Rainmeter?

Post by balala »

Yincognito wrote: November 10th, 2020, 6:36 pm Yeah, suspected that as well, from my past and very rare handling of .SCR files. Maybe it's the measure that expects a plain executable then? Don't know yet, as I'm on mobile and can't test right now. But I'll get home soon and investigate this.
Yeah, probably it does expect. Tried changing the extension of my screen saver from .scr to .exe and the Process measure did immediatelly got its running. When changed back to .scr, the Process measure did again miss it. So probably it's right: the Process measures are expecting and working only with .exe files. A dev would be useful here to give us a few details. Thanks anticipatelly.
Yincognito wrote: November 10th, 2020, 6:36 pm If the .SCR files are executables, then theoretically they won't need yet another executable to run them, although in practice this might not be true. Generally, for a process to be detected as such by the Process measure, that process must appear in the Windows Task Manager as well, in one of its tabs. It's a bit difficult to test since the screensaver is I think closed on non idle operations like showing Task Manager, but you might workaround this by some UsageMonitor skin keeping track of all running processes.
For sure I can say such a .exe file has not been created at least for my screensaver, unless it has been created in "background", but I doubt. A file search at least doesn't return such a file.
And yes, it's not a bit, but extremely hard to test.
User avatar
Yincognito
Posts: 2934
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How do I make a Screen Saver with Rainmeter?

Post by Yincognito »

balala wrote: November 9th, 2020, 8:47 pm

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName=Metaballs.scr
IfCondition=(#CURRENTSECTION#>0)
IfTrueAction=[!SetOption MeasureProcess UpdateDivider "-1"]
IfFalseAction=[!SetOption MeasureProcess UpdateDivider "1"]

[MeterProcess]
Meter=String
MeasureName=MeasureProcess
X=0
Y=0
SolidColor=0,0,0,100
StringAlign=Left
FontColor=220,220,220
AntiAlias=1
FontSize=10
StringStyle=Bold
Text=%1
LeftMouseUpAction=[!UpdateMeasure "MeasureProcess"]
Te can see what value is returned when the screen saver is running, such in a case, the skin sets an UpdateDivider=-1 option to the [MeasureProcess] measure, to not get it updated when the screen saver process closes. with a click on the string, you can set back the UpdateDivider to 1.
I think you might have some logical error in the above code (probably related to the use of UpdateDivider and possibly the mouse action), because for me it works without issues (the Windows 10 3D text screensaver set to start after 1 minute of idle time used for testing):

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProcess]
Measure=Process
ProcessName=ssText3d.scr
RegExpSubstitute=1
Substitute="^-1$":"not running","^1$":"running"
OnUpdateAction=[!Log "Screensaver is [MeasureProcess]."]

[MeterProcess]
Meter=String
MeasureName=MeasureProcess
FontColor=255,255,255,255
SolidColor=0,0,0,255
AntiAlias=1
Padding=5,5,5,5
Text="Screensaver is %1."
Screensaver Test.jpg
balala wrote: November 9th, 2020, 8:47 pmBut unfortunately just tested it, but with no success. The used Process measure returns -1 even when the screen saver is running. When I open the Screen Saver setting window and choose the appropriate screen saver in the list, it returns 1, but when the screen saver is running, it returns -1. So this was not a good idea, doesn't work this way. Will have to figure out why and how can it be done to properly work, but now it simply doesn't.
Well, when the screensaver is running, any mouse action will close it, so it will register as "not running", wouldn't it? :confused: The Rainmeter Log (or even writing to a log file on the disk using !WriteKeyValue bangs and a Time measure) might be a better way to see what the measure returns, since they are both unobtrusive in nature.

EDIT: Disregard my statement regarding mouse actions, just realized it was meant to "toggle" things and not immediately display stuff. That being said, maybe a !PauseMeasure bang would be simpler to use instead of changing the update divider...
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 11857
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I make a Screen Saver with Rainmeter?

Post by balala »

Yincognito wrote: November 10th, 2020, 8:03 pm I think you might have some logical error in the above code (probably related to the use of UpdateDivider and possibly the mouse action), because for me it works without issues (the Windows 10 3D text screensaver set to start after 1 minute of idle time used for testing):
:o Yep, it does for me as well. Didn't try out the 3D Text, just two screen savers which are not from the list of Windows 10 savers: :o In neither case did it work.
But now trying out more screen savers, I got it working with more.
So, it seems the skin can be used to test the running of some screen savers, but unfortunately not all.
Yincognito wrote: November 10th, 2020, 8:03 pm Well, when the screensaver is running, any mouse action will close it, so it will register as "not running", wouldn't it?
That's why I set the UpdateDivider option of the [MeasureProcess] to -1 when get the screen saver running. So if once the screen saver starts, the measure is no more updated, so even if the screen saver closes, the skin still shows it running. A click can restore the UpdateDivider of the measure to 1.
User avatar
Yincognito
Posts: 2934
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How do I make a Screen Saver with Rainmeter?

Post by Yincognito »

balala wrote: November 10th, 2020, 8:57 pm :o Yep, it does for me as well. Didn't try out the 3D Text, just two screen savers which are not from the list of Windows 10 savers: :o In neither case did it work.
But now trying out more screen savers, I got it working with more.
So, it seems the skin can be used to test the running of some screen savers, but unfortunately not all.

That's why I set the UpdateDivider option of the [MeasureProcess] to -1 when get the screen saver running. So if once the screen saver starts, the measure is no more updated, so even if the screen saver closes, the skin still shows it running. A click can restore the UpdateDivider of the measure to 1.
It did work for me in the case of your Metaballs.scr though:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProcess]
Measure=Process
ProcessName=ZZFIRE~1.scr
;zzFirework.scr
;Metaballs.scr
;Ribbons.scr
;PhotoScreensaver.scr
;Mystify.scr
;Bubbles.scr
;scrnsave.scr
;ssText3d.scr
RegExpSubstitute=1
Substitute="^-1$":"not running","^1$":"running"
OnUpdateAction=[!Log "Screensaver is [MeasureProcess]."]

[MeterProcess]
Meter=String
MeasureName=MeasureProcess
FontColor=255,255,255,255
SolidColor=0,0,0,255
AntiAlias=1
Padding=5,5,5,5
Text="Screensaver is %1."
Metaballs Screensaver Test.jpg
For some reason the screen saver didn't want to be triggered automatically (i.e. only the start logo tried to appear - actually just a black box instead of it and then nothing), but it did trigger manually on the Screen Saver Settings window and its Preview button. You might want to check this too, maybe some minor up to date with the current Windows 10 versions is needed. Nice work in Delphi, by the way, I used to write several programs in it back in the day. :thumbup:

The only thing I did after extracting the SCR file from the ZIP was to place it in the C:\Windows\System32 folder (might work in the C:\Windows\SysWOW64 folder as well), next to the other default screen savers in Windows. Maybe this is why it didn't work for you? :???:

The other screen saver (i.e. zzFirework.scr) was trickier to make it work, but me knows a thing or two about debugging such unobedient pieces of software, LOL, so I figured it out eventually. :twisted: What happened is that while testing it in the Screen Saver Settings window and its Preview button worked fine, the automatic triggering used the short DOS name of ZZFIRE~1.scr. Not sure why that happens, maybe it's older or maybe it uses a "child process" or something like that, but didn't bother to find out as my focus was simply to make it work, which I did. Didn't try to move it to the C:\Windows\SysWOW64 folder and try there, this will be up to you to test, if you like.

Notes:
- initially, I thought it was because of the different file header of your SCR file (i.e. MZP instead of MZ), having tried your screen saver first, but then realized the P is just the Pascal identifier next to the MZ executable one
- here it became obvious the utility of a skin suite like mine, since the upper row of my skins (which includes the Processes skin) is set to stay always on top, helping me in identifying the actual names of the screen saver processes, since the process is usually very briefly the top one in terms of CPU usage when (repeatedly or first) running the screen saver
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4206
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How do I make a Screen Saver with Rainmeter?

Post by eclectic-tech »

Yincognito wrote: November 10th, 2020, 10:36 pm The other screen saver (i.e. zzFirework.scr) was trickier to make it work... What happened is that while testing it in the Screen Saver Settings window and its Preview button worked fine, the automatic triggering used the short DOS name of ZZFIRE~1.scr. Not sure why that happens, maybe it's older or maybe it uses a "child process" or something like that, but didn't bother to find out as my focus was simply to make it work, which I did.
This is Window/DOS "8.3" standard naming conversion. Back in the days of Windows and DOS, if the Windows name was longer than 8 characters, the name was converted for use in DOS to the first 6 characters, a tilde, and a number (starting with 1 and incremented if there is already a file with the same first 6 characters), and then the period and 3 character extension is added; giving you "ZZFIRE~1.scr" to be used in the antiquated screensaver environment.
:)
User avatar
Yincognito
Posts: 2934
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How do I make a Screen Saver with Rainmeter?

Post by Yincognito »

eclectic-tech wrote: November 11th, 2020, 12:17 am This is Window/DOS "8.3" standard naming conversion. Back in the days of Windows and DOS, if the Windows name was longer than 8 characters, the name was converted for use in DOS to the first 6 characters, a tilde, and a number (starting with 1 and incremented if there is already a file with the same first 6 characters), and then the period and 3 character extension is added; giving you "ZZFIRE~1.scr" to be used in the antiquated screensaver environment.
:)
Indeed. I knew that - got a big chunk of the old DOS days and the 8.3 naming convention, even made a Norton Commander / DOS Navigator - like file manager, too bad Windows evolved pretty fast and my file manager soon became obsolete. What I don't know is why this particular screensaver has to use this name instead of the modern one, considering the rest of the screen savers I tested do not. I mean, it can't be THAT old, right? And even if it was, Windows should be able to refer to it by its full name in 2020... :confused:
User avatar
balala
Rainmeter Sage
Posts: 11857
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I make a Screen Saver with Rainmeter?

Post by balala »

Yincognito wrote: November 10th, 2020, 10:36 pm It did work for me in the case of your Metaballs.scr though:
It doesn't for me with ProcessName=Metaballs.scr, but does with ProcessName=Metaba~1.scr, as well as with ProcessName=ZZFIRE~1.scr. So was a good idea to add the processes names this way.
Yincognito wrote: November 10th, 2020, 10:36 pm For some reason the screen saver didn't want to be triggered automatically (i.e. only the start logo tried to appear - actually just a black box instead of it and then nothing), but it did trigger manually on the Screen Saver Settings window and its Preview button. You might want to check this too, maybe some minor up to date with the current Windows 10 versions is needed. Nice work in Delphi, by the way, I used to write several programs in it back in the day. :thumbup:

The only thing I did after extracting the SCR file from the ZIP was to place it in the C:\Windows\System32 folder (might work in the C:\Windows\SysWOW64 folder as well), next to the other default screen savers in Windows. Maybe this is why it didn't work for you? :???:
Metaballs does work for me on Windows 10, even if when I wrote it, many years ago, Windows 10 didn't exist yet. Unfortunately I don't have anymore the source code of the screen saver, so I should restart all the work to get a newer code and can update it, but this probably won't go on.
I'm using it on the C:\Windows\SysWOW64 folder, but if I place them to either C:\Windows\System32, or even C:\Windows, it does work for me.
I used for long time both, Pascal and later Delphi, but the time gone by them, I think.
User avatar
Yincognito
Posts: 2934
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How do I make a Screen Saver with Rainmeter?

Post by Yincognito »

balala wrote: November 11th, 2020, 9:12 am It doesn't for me with ProcessName=Metaballs.scr, but does with ProcessName=Metaba~1.scr, as well as with ProcessName=ZZFIRE~1.scr. So was a good idea to add the processes names this way.
Be aware that when previewing the screen savers, the long file name (i.e. zzFirework.scr) is still used - at least that's what happened for me while testing the fireworks screen saver. It's only on automatic triggering that the short 8.3 name is used. So, even though it probably isn't possible withing a single Process measure, both zzFirework.scr and ZZFIRE~1.scr should be checked for running. Not sure if the Process measure accepts the | delimiter in order to be able to add more process names in the option (i.e. Process=zzFirework.scr|ZZFIRE~1.scr), like in similar options from the UsageMonitor plugin... :confused: