It is currently April 23rd, 2019, 11:05 am

"hide screens" skin

Post your work-in-progress and completed skins to share and discuss.
zin
Posts: 8
Joined: March 10th, 2019, 11:26 pm

"hide screens" skin

zin » March 10th, 2019, 11:39 pm

I searched several locations (perhaps not using the right keywords), I wanted to have a simple button that would darken both my monitors, after that, clicking anywhere restores the screen, useful when watching movies on my large plasma screen while sitting where my laptop is.
I finally wrote my own "Dark", it is a 10-pixel "hot corner" in the upper left of the screen, setup as non-draggable to simplify the coding, I'm just a dabbler in Rainmeter though have done some cool stuff with it, mostly hacking the demos, so ideas for improvement are welcome, like can I turn off the mouse, or move it somewhere.

Code: Select all

[Rainmeter]
Update=-1
Author=zingeo, 

[Variables]
s=10
w=10
h=10

[mtDark]
Meter=Shape
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!WriteKeyValue Variables w "(#VSCREENAREAWIDTH#-#w#+#s#)"] [!WriteKeyValue Variables h "(#SCREENAREAHEIGHT#-#h#+#s#)"] [!Refresh]
Thanks!
Last edited by jsmorley on March 11th, 2019, 12:59 am, edited 1 time in total.
Reason: Please use [code] tags on long code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 8091
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "hide screens" skin

balala » March 11th, 2019, 3:11 pm

zin wrote:
March 10th, 2019, 11:39 pm
so ideas for improvement are welcome,
Let's start with an improvement I'd do. I'd modify this code in a way to not have to refresh it all times you click. For this you have to replace the posted LeftMouseUpAction option of the [mtDark] meter with the following one: LeftMouseUpAction=[!SetVariable w "(#VSCREENAREAWIDTH#-#w#+#s#)"][!SetVariable h "(#SCREENAREAHEIGHT#-#h#+#s#)"][!UpdateMeter "#CURRENTSECTION#"][!Redraw].
Using this option also requires to add a DynamicVariables=1 option to the same [mtDark] meter. Don't forget adding it.
With these bangs, the size of the rectangle is set dynamically, isn't written to the [Variables] section and the skin is not refreshed every time you're clicking. This is a great advantage: https://forum.rainmeter.net/viewtopic.php?f=5&t=22739&p=119966&hilit=destructive+refresh#p119966

Although this is not something extremely important, which could prevent the skin to work, you have to know that the Author option was moved from the [Rainmeter] section (where it became deprecated) to [Metadata]. You also should have to move it.
zin
Posts: 8
Joined: March 10th, 2019, 11:26 pm

Re: "hide screens" skin

zin » March 11th, 2019, 5:03 pm

Thanks for the suggestions!
I actually had a version with SetVariable and Dynamic vars, but was having some trouble with it, and wanted to learn about WriteKeyValue, and I was trying to keep it as small as possible as an exersize.
This is much better than rewriting the skin every click.

Code: Select all

[Rainmeter]
Update=-1

[Metadata]
Name=Dark
Author=zingeo, 
Information=Upper-left corner hot spot to darken all monitors, then a mouse action anywhere to reset.

[Variables]
s=10
w=10
h=10

[mtDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!SetVariable w "(#VSCREENAREAWIDTH#-#w#+#s#)"][!SetVariable h "(#SCREENAREAHEIGHT#-#h#+#s#)"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
Can Rainmeter hide the cursor or move it when Dark is triggered?
Another improvement would be to make it draggable, I was working towards that but the math is simpler if in the upper-left corner, but I ended up liking it there (just shove the mouse to the corner and click), my upper right corner already has a date skin and volume control skin there.

Thanks again!
User avatar
balala
Rainmeter Sage
Posts: 8091
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "hide screens" skin

balala » March 11th, 2019, 6:41 pm

zin wrote:
March 11th, 2019, 5:03 pm
This is much better than rewriting the skin every click.
Not the whole skin is rewritten if you1re using !WriteKeyValue bangs, just the appropriate variable. The most problematic in those cases is the need of refresh the skin (through the !Refresh bang). In my previous reply I posted a link where you can read why.
zin wrote:
March 11th, 2019, 5:03 pm
Can Rainmeter hide the cursor or move it when Dark is triggered?
Probably the only way to do this is to find a not visible cursor (if there is a such one) and set it when needed. I didn't try out a such action, but I suppose it could work (if as I said, you can find an appropriate, not visible cursor).
I'd modify a little bit the code. I'd introduce a variable, let's name it Visible. Its value would be set by the LeftMouseUpAction option of the meter and the size of the meter would be set depending on the current value of the variable. Something like this:

Code: Select all

[Rainmeter]
Update=-1

[Metadata]
Name=Dark
Author=zingeo,
Information=Upper-left corner hot spot to darken all monitors, then a mouse action anywhere to reset.

[Variables]
s=10
w=10
h=10
Visible=0

[MeasureVisible]
Measure=Calc
Formula=#Visible#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable w "10"][!SetVariable h "10"][!UpdateMeter "mtDark"][!Redraw]
IfFalseAction=[!SetVariable w "#SCREENAREAWIDTH#"][!SetVariable h "#SCREENAREAHEIGHT#"][!UpdateMeter "mtDark"][!Redraw]
DynamicVariables=1

[mtDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!SetVariable Visible "(1-#Visible#)"][!UpdateMeasure "MeasureVisible"]
Now if you find a not visible cursor (not sure you can find one!) and place that file into the @Resources\Cursors folder, you can set it while the meter is enlarged. For this you have to add two bangs to the IfTrueAction and IfFalseAction options above:

Code: Select all

[MeasureVisible]
...
IfTrueAction=[!SetVariable w "10"][!SetVariable h "10"]['SetOption mtDark MouseActionCursorName "Empty.cur"][!UpdateMeter "mtDark"][!Redraw]
IfFalseAction=[!SetVariable w "#SCREENAREAWIDTH#"][!SetVariable h "#SCREENAREAHEIGHT#"]['SetOption mtDark MouseActionCursorName "DefaultCursor.cur"][!UpdateMeter "mtDark"][!Redraw]
See that in this case the image of the cursor is set depending on the value of the Visible variable. When the meter is enlarged (so when the Visible variable is set to 1), the Empty.cur cursor image is set. That one being not visible, the cursor practically disappears. But if you click, reducing the meter, the DefaultCursor.cur image is set for the cursor.
The only problem as I said, could be that I'm not sure you'll find an appropriate empty (not visible) cursor. If you do, the problem is solved (I hope!).
zin wrote:
March 11th, 2019, 5:03 pm
Another improvement would be to make it draggable,
Two possibilities:
  • Right click the skin, go to Settings and check Draggable.
  • Add the following OnRefreshAction option to the [Rainmeter] section of the skin: OnRefreshAction=[!Draggable "1"].
zin
Posts: 8
Joined: March 10th, 2019, 11:26 pm

Re: "hide screens" skin

zin » March 12th, 2019, 7:33 am

I setup what you recommended, yes I had the idea a while back to use a mouse action to toggle a single master variable, then every other change would use that, I got it to work generally, much cleaner, but after enabling "Settings-Draggable", and moving it away from the corner, I find that I don't get the origin x/y of the skin to change when clicked, just the size, even with negative values.

Code: Select all

[Rainmeter]
Update=-1

[Metadata]
Name=Dark
Author=zingeo, balala, 
Information=Upper-left corner hot spot to darken all monitors, then a mouse action anywhere to reset.
Version=1.04 use visible as main state toggle variable

[Variables]
s=10
x=0
y=0
w=10
h=10
visible=0
ix=#CURRENTCONFIGX#
iy=#CURRENTCONFIGY#

[measureVisible]
Measure=Calc
Formula=#visible#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction= [!SetVariable x "#ix#"][!SetVariable y "#iy#"][!SetVariable w "#s#"][!SetVariable h "#s#"]               [!UpdateMeter "meterDark"][!Redraw]
IfFalseAction=[!SetVariable x "0"][!SetVariable y "0"][!SetVariable w "#VSCREENAREAWIDTH#"][!SetVariable h "#SCREENAREAHEIGHT#"][!UpdateMeter "meterDark"][!Redraw]
DynamicVariables=1

[meterDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle #x#,#y#,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!SetVariable visible "(1-#visible#)"][!UpdateMeasure "measureVisible"]
I also found a "HiddenCursor.cur" file, put it in @Resources\Cursors, but it never changes with [MouseActionCursorName=HiddenCursor.cur] (with or without an =) in the IfTrueAction & IfFalseAction or a MouseAction.

thanks again!
Last edited by balala on March 12th, 2019, 9:48 am, edited 1 time in total.
Reason: Please use <code>, not <Snippets> tags whenever you are posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 8091
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "hide screens" skin

balala » March 12th, 2019, 10:09 am

zin wrote:
March 12th, 2019, 7:33 am
but after enabling "Settings-Draggable", and moving it away from the corner, I find that I don't get the origin x/y of the skin to change when clicked, just the size, even with negative values.
Add a !Move bang to the IfFalseAction option of the [measureVisible] measure, to get moved the skin in the upper left corner of the screen whenever you are enlarging it. Something like this: IfFalseAction=[!Move "0" "0"][!SetVariable x "0"][!SetVariable y "0"][!SetVariable w "#VSCREENAREAWIDTH#"][!SetVariable h "#SCREENAREAHEIGHT#"][!UpdateMeter "meterDark"][!Redraw].
zin wrote:
March 12th, 2019, 7:33 am
I also found a "HiddenCursor.cur" file, put it in @Resources\Cursors, but it never changes with [MouseActionCursorName=HiddenCursor.cur] (with or without an =) in the IfTrueAction & IfFalseAction or a MouseAction.
You can't set a cursor simply by putting the [MouseActionCursorName=HiddenCursor.cur] into an IfTrueAction or IfFalseAction option, because that's not a bang. You have to set it through a !SetOption bang. Something like this: IfFalseAction=[!Move "0" "0"][!SetVariable x "0"][!SetVariable y "0"][!SetVariable w "#VSCREENAREAWIDTH#"][!SetVariable h "#SCREENAREAHEIGHT#"][!SetOption meterDark MouseActionCursorName "HiddenCursor.cur"][!UpdateMeter "meterDark"][!Redraw].
Obviously if needed, a similar !SetOption bang have to be used to set back the cursor when the meter is reduced.

Additional tip: there are 15 spaces between the [!SetVariable h "#s#"] and the [!UpdateMeter "meterDark"] bangs of the IfTrueAction option of the [measureVisible] measure. Although this doesn1t the option to properly work, remove them.
zin
Posts: 8
Joined: March 10th, 2019, 11:26 pm

Re: "hide screens" skin

zin » March 17th, 2019, 8:41 pm

I've rewritten the skin to try and support a draggable hot-spot, by saving the currentconfigx/y when switching the visible flag, and moving to either the saved values or 0,0 depending on visible. But it just doesn't support dragging, while the log/skins window that shows my measure and variable values looks good. I think I am getting bit by what this comment I found online says:
"""The variables are updated only after all other measures are updated, so the values are always one update cycle behind."""
It appears while I think I am changing my x & y params, the !Move isn't moving there, due to being out of sync as I think it should, I am finding it very frustrating, along with a number of other characteristics like the rules governing:
use brackets around measure variables?
use parens around formulas?
use quotes around expressions?
use conditional tests a=1 ? b : c anywhere an expression is?
does update=-1 convert the skin to a totally mouse/event-driven process
I clearly do not understand the Rainmeter processing sequence as I should.

Code: Select all

[rainmeter]
Update=-1
FadeDuration 2000

[metadata]
Name=Dark
Author=zingeo, balala, 
Information=[Upper-left corner] hot spot to darken all monitors, then a mouse action anywhere to reset.
Version=1.03 switch to SetVariable, 1.1 reorg

[variables]
visible=1
; screen size
sw=#SCREENAREAWIDTH#
sh=#SCREENAREAHEIGHT#
; desktop size
vw=#VSCREENAREAWIDTH#
vh=#VSCREENAREAHEIGHT#
; button parms
w=#SCREENAREAWIDTH#
h=2
;

[measureOrigx]
Measure=Calc
MaxValue=5000
Formula=(#visible# = 1 ? #CURRENTCONFIGX# : measureOrigx)
DynamicVariables=1

[measureOrigy]
Measure=Calc
MaxValue=5000
Formula=(#visible# = 1 ? #CURRENTCONFIGY# : measureOrigy)
DynamicVariables=1

[measureVisible]
Measure=Calc
Formula=#visible#
DynamicVariables=1
IfCondition=(#CURRENTSECTION#=1)
; if normal desktop-visible mode
IfTrueAction=[!SetVariable x [measureOrigx]][!SetVariable y [measureOrigy]][!SetVariable w 10][!SetVariable h 10]
; else go dark
IfFalseAction=[!SetVariable x 0][!SetVariable y 0][!SetVariable w (#vw#)][!SetVariable h (#vh#)]
OnUpdateAction=[!Move "#x#" "#y#"]
;[!Hide]

[meterDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!UpdateMeasure measureOrigx][!UpdateMeasure measureOrigy][!SetVariable visible "(1-#visible#)"][!UpdateMeasure "MeasureVisible"][!ShowFade][!UpdateMeter "meterDark"][!Redraw]
;[!Redraw][!UpdateMeter "meterDark"]
Clicking on the hotspot after a move out of the corner makes a hidden desktop perfectly, but a click goes back to a hot-spot in the corner (not where I dragged it), then another click darkens the screen but its upperleft corner is where the hotspot was moved to a step or 2 back, so clearly a sync problem with working with variables or measures that are a step behind, though the skins view of my variables and measures are perfect.
I also put fade in, but it doesn't vary duration, it is not clear at all me to how the sequence works re order and requirement: [!ShowFade][!UpdateMeter "meterDark"][!Redraw]
If showingFade, why do I have to redraw? If updatingMeter, why do I have to Redraw!@#
I'm more of a procedural coder (c++ etc.), this "setup the descriptor code, and it all just happens" makes it difficult to know what happens when and where and why.

"Dark" is my most interacted with skin, even though it doesn't drag [yet], and besides a corner hot spot, I also like a version with a 2 pixel thick button the entire width atop the monitor.

thanks!
Last edited by balala on March 17th, 2019, 8:45 pm, edited 1 time in total.
Reason: Please use <code>, not <Snippets> tags whenever you are posting code snippets. It's the </> button.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3291
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: "hide screens" skin

eclectic-tech » March 18th, 2019, 2:45 am

zin wrote:
March 17th, 2019, 8:41 pm
I've rewritten the skin to try and support a draggable hot-spot, by saving the currentconfigx/y when switching the visible flag, and moving to either the saved values or 0,0 depending on visible. But it just doesn't support dragging, while the log/skins window that shows my measure and variable values looks good. I think I am getting bit by what this comment I found online says:
"""The variables are updated only after all other measures are updated, so the values are always one update cycle behind."""
It appears while I think I am changing my x & y params, the !Move isn't moving there, due to being out of sync as I think it should, I am finding it very frustrating, along with a number of other characteristics like the rules governing:
use brackets around measure variables?
use parens around formulas?
use quotes around expressions?
use conditional tests a=1 ? b : c anywhere an expression is?
does update=-1 convert the skin to a totally mouse/event-driven process
I clearly do not understand the Rainmeter processing sequence as I should.

Code: Select all

[rainmeter]
Update=-1
FadeDuration 2000

[metadata]
Name=Dark
Author=zingeo, balala, 
Information=[Upper-left corner] hot spot to darken all monitors, then a mouse action anywhere to reset.
Version=1.03 switch to SetVariable, 1.1 reorg

[variables]
visible=1
; screen size
sw=#SCREENAREAWIDTH#
sh=#SCREENAREAHEIGHT#
; desktop size
vw=#VSCREENAREAWIDTH#
vh=#VSCREENAREAHEIGHT#
; button parms
w=#SCREENAREAWIDTH#
h=2
;

[measureOrigx]
Measure=Calc
MaxValue=5000
Formula=(#visible# = 1 ? #CURRENTCONFIGX# : measureOrigx)
DynamicVariables=1

[measureOrigy]
Measure=Calc
MaxValue=5000
Formula=(#visible# = 1 ? #CURRENTCONFIGY# : measureOrigy)
DynamicVariables=1

[measureVisible]
Measure=Calc
Formula=#visible#
DynamicVariables=1
IfCondition=(#CURRENTSECTION#=1)
; if normal desktop-visible mode
IfTrueAction=[!SetVariable x [measureOrigx]][!SetVariable y [measureOrigy]][!SetVariable w 10][!SetVariable h 10]
; else go dark
IfFalseAction=[!SetVariable x 0][!SetVariable y 0][!SetVariable w (#vw#)][!SetVariable h (#vh#)]
OnUpdateAction=[!Move "#x#" "#y#"]
;[!Hide]

[meterDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!UpdateMeasure measureOrigx][!UpdateMeasure measureOrigy][!SetVariable visible "(1-#visible#)"][!UpdateMeasure "MeasureVisible"][!ShowFade][!UpdateMeter "meterDark"][!Redraw]
;[!Redraw][!UpdateMeter "meterDark"]
Clicking on the hotspot after a move out of the corner makes a hidden desktop perfectly, but a click goes back to a hot-spot in the corner (not where I dragged it), then another click darkens the screen but its upperleft corner is where the hotspot was moved to a step or 2 back, so clearly a sync problem with working with variables or measures that are a step behind, though the skins view of my variables and measures are perfect.
I also put fade in, but it doesn't vary duration, it is not clear at all me to how the sequence works re order and requirement: [!ShowFade][!UpdateMeter "meterDark"][!Redraw]
If showingFade, why do I have to redraw? If updatingMeter, why do I have to Redraw!@#
I'm more of a procedural coder (c++ etc.), this "setup the descriptor code, and it all just happens" makes it difficult to know what happens when and where and why.

"Dark" is my most interacted with skin, even though it doesn't drag [yet], and besides a corner hot spot, I also like a version with a 2 pixel thick button the entire width atop the monitor.

thanks!
You are complicating your process by trying to move the "hotspot" position and moving another meter in the same skin to 0,0 to cover all screens. You will drive yourself crazy trying to restore meter positions when there is a simple solution.

This can be done easier (with add versatility) by using separate skins in the same config:
one skin for a hot spot (can be any shape or screen position) and
that skin activates a cover all skin (which can also be any style).

Here is a square hotspot skin that activates a black screen overlay.
HotSpotSquare.ini

Code: Select all

[rainmeter]
Update=-1

[HotSpot]
Meter=Image
W=10
H=10
SolidColor=0,0,0,150
LeftMouseUpAction=[!ActivateConfig "#CurrentConfig#\Overlays" "BlackScreen.ini"]
; BlackGradient.ini
; BlackRadialGradient.ini
Or, here is a top bar hot spot
HotSpotBar.ini

Code: Select all

[rainmeter]
Update=-1

[HotSpot]
Meter=Image
W=#SCREENAREAWIDTH#
H=2
SolidColor=0,0,0,150
LeftMouseUpAction=[!ActivateConfig "#CurrentConfig#\Overlays" "BlackScreen.ini"]
; BlackGradient.ini
; BlackRadialGradient.ini
And a separate overlay skin (in a separate sub-folder) that blacks out your screens
Overlays\Blackscreen.ini

Code: Select all

[rainmeter]
Update=-1
MouseActionCursor=0
OnRefreshAction=[!Move "0" "0"][!Draggable 0][!ZPos 2]

[variables]
; desktop size
vw=#VSCREENAREAWIDTH#
vh=#VSCREENAREAHEIGHT#

[meterDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#vw#,#vh# | Fill Color 0,0,0,255
LeftMouseUpAction=[!DeactivateConfig]
From here you can create more hot spot style skins and additional overlay skins to blank your screens (if solid black is not always desired).

Here is a package with those skins and 2 other overlays (still mostly black, but could be any type of meter).
Edit: Added: Move to 0,0 / TopMost position / And disable drag to overlay skins.
You do not have the required permissions to view the files attached to this post.
zin
Posts: 8
Joined: March 10th, 2019, 11:26 pm

Re: "hide screens" skin

zin » March 18th, 2019, 6:58 am

Thanks for the response and the skins!
But are you saying it can't be done in a single skin?
I am no expert in Rainmeter, but I have variables that according to the Skins window, are doing exactly what I want, with
a 2-state system that toggles between:
1. a draggable hot spot, that draws a small shape/region at any location, for a local 0,0 to either a 10x10 size, or a topscreen bar
2. a fullvirtualscreen cover
With a mouse action setting up the measures/vars as needed to toggle between the 2
But the variables & measures seem to be out of sync with what the !Move bang is doing, and I am trying to understand what is going on, the process and sequencing of events, for further work.
I knew after reading the docs that a 2 skin solution would work, but took it as a challenge to do it in one, which looks to be more than I can grasp at my current level of understanding.
Is there an explanation why my variables in the Skins screen show the correct coords, but the !Move x y doesn't end up there?
Or what it will take to get the variables and !Move to be in sync, perhaps an !Update somewhere in between, or another level of saved CURRENTCONFIGX/Ys, or a deferred !Redraw or something?

thanks!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3291
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: "hide screens" skin

eclectic-tech » March 18th, 2019, 1:43 pm

zin wrote:
March 18th, 2019, 6:58 am
Thanks for the response and the skins!
But are you saying it can't be done in a single skin?
I am no expert in Rainmeter, but I have variables that according to the Skins window, are doing exactly what I want, with
a 2-state system that toggles between:
1. a draggable hot spot, that draws a small shape/region at any location, for a local 0,0 to either a 10x10 size, or a topscreen bar
2. a fullvirtualscreen cover
With a mouse action setting up the measures/vars as needed to toggle between the 2
But the variables & measures seem to be out of sync with what the !Move bang is doing, and I am trying to understand what is going on, the process and sequencing of events, for further work.
I knew after reading the docs that a 2 skin solution would work, but took it as a challenge to do it in one, which looks to be more than I can grasp at my current level of understanding.
Is there an explanation why my variables in the Skins screen show the correct coords, but the !Move x y doesn't end up there?
Or what it will take to get the variables and !Move to be in sync, perhaps an !Update somewhere in between, or another level of saved CURRENTCONFIGX/Ys, or a deferred !Redraw or something?

thanks!
Two skins will do what you want without needing any checks and measures.

However, If you want to do it in 1 skin with 1 meter, you need to address a problem.

You are using the current XY position values of the skin as the position of the hot spot, changing those values to 0,0 to cover your screen, and then using those changed values as the position of your hot spot. :uhuh:

So your hot spot is ALWAYS going to be positioned at 0,0 once you blank your screen.

To correct this I added new variables to define the hot spot (hsx, hsy, hsw, hsh). Now you have separate variables from the w & h variables used to define your meter size, and separate variables from the to CurrentConfigX & CurrentConfigY used to position the skin.

Now when you click the [meterDark], it will set and write (so they are remembered through refreshes) the current skin location values to the hot spot variables, and toggle "visible" variable. Then the combined [measureOrigXY] will take actions based on the "visible" variable.

Code: Select all

[rainmeter]
Update=-1
;FadeDuration 2000

[metadata]
Name=Dark
Author=zingeo, balala, eclectic-tech
Information=[Upper-left corner] hot spot to darken all monitors, then a mouse action anywhere to reset.
Version=1.03 switch to SetVariable, 1.1 reorg

[variables]
visible=1
; screen size
sw=#SCREENAREAWIDTH#
sh=#SCREENAREAHEIGHT#
; desktop size
vw=#VSCREENAREAWIDTH#
vh=#VSCREENAREAHEIGHT#
; button parms
w=#SCREENAREAWIDTH#
h=2
hsw=#SCREENAREAWIDTH#
hsh=2
hsx=0
hsy=0

[measureOrigxy]
Measure=Calc
Formula=1
IfCondition=(#visible# = 1)
IfTrueAction=[!SetVariable w #hsw#][!SetVariable h #hsh#][!UpdateMeter *][!Redraw][!Move "#hsx#" "#hsy#"]
IfFalseAction=[!SetVariable w #vw#][!SetVariable h #vh#][!UpdateMeter *][!Redraw][!Move "0" "0"]
DynamicVariables=1

[meterDark]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0,0,#w#,#h# | Fill Color 0,0,0,255
LeftMouseUpAction=[!SetVariable visible "(1-#visible#)"][!WriteKeyValue Variables hsx #CURRENTCONFIGX#][!WriteKeyValue Variables hsy #CURRENTCONFIGY#][!SetVariable hsx #CURRENTCONFIGX#][!SetVariable hsy #CURRENTCONFIGY#][!UpdateMeasure measureOrigxy]
The problem was using the CurrentConfigX and CurrentConfigY variables as the hot spot placement, changing them to 0,0 to cover all your screens, but not being able to change them back to the original position of the hot spot because your !Move bang changed them to 0,0.

I am not always the best at explaining things, but I hope this helps you get a better idea of Rainmeter processes. :great: