Dear community,
I have a question. I need a solution to determine the position of where the Rainmeter skin is actually located, Desktop position; top or bottom. Once this has been determined, it should "enlarge" the top or bottom of the skin depending on the position.
Position -> Top on Desktop -> enlarged direction to bottom || Position -> Bottom on Desktop -> enlarged direction to Top
Thanks for your help and answers
GIF = Position -> Top -> enlarged direction to bottom
It is currently October 22nd, 2024, 11:33 pm
Determining the top / bottom position
-
- Posts: 81
- Joined: September 21st, 2024, 4:57 pm
- Location: Germany, in the stone cave
Determining the top / bottom position
You do not have the required permissions to view the files attached to this post.
Last edited by Rooky_89 on October 19th, 2024, 3:49 pm, edited 1 time in total.
-
- Developer
- Posts: 22880
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Determining the top / bottom position
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
[MeasureAlwaysOnTop]
Measure=WebParser
URL=file://#SETTINGSPATH#Rainmeter.ini
CodePage=1200
RegExp=(?siU)\[#CURRENTCONFIG#\].*AlwaysOnTop=(.*)\R
StringIndex=1
UpdateRate=2
[MeasureCompare]
Measure=Calc
Formula=[MeasureAlwaysOnTop:]
IfCondition=MeasureCompare = 0
IfTrueAction=[!SetVariable MyPosition "Normal"]
IfCondition2=MeasureCompare = -2
IfTrueAction2=[!SetVariable MyPosition "On Desktop"]
IfCondition3=MeasureCompare = -1
IfTrueAction3=[!SetVariable MyPosition "Bottom"]
IfCondition4=MeasureCompare = 1
IfTrueAction4=[!SetVariable MyPosition "TopMost"]
IfCondition5=MeasureCompare = 2
IfTrueAction5=[!SetVariable MyPosition "Stay TopMost"]
DynamicVariables=1
[MeterString]
Meter=String
FontColor=255,255,255,255
FontSize=16
SolidColor=0,0,0,1
Text=Always on Top is: #MyPosition#
AntiAlias=1
DynamicVariables=1
https://docs.rainmeter.net/manual/settings/skin-sections/#AlwaysOnTop
https://docs.rainmeter.net/manual/measures/general-options/ifconditions
Just an example, you can use the IfCondition options to set whatever you need...
Click to animate:
You do not have the required permissions to view the files attached to this post.
-
- Posts: 81
- Joined: September 21st, 2024, 4:57 pm
- Location: Germany, in the stone cave
Re: Determining the top / bottom position
Hallo jsmorley
Sorry if I may have expressed myself incorrectly . I should have perhaps added that, I didn't mean the Z position . My mistake Thank you for answering so quickly
- If the skin is at the top of the screen, it should open downwards/or expand. [First post .GIF]
- If the skin is at the bottom of the screen (task bar) , it should open upwards/or expand.
It is necessary to find out whether the Rainmeter skin is in Y+ or Y- in order to enlarge the skin in the right direction.
https://docs.rainmeter.net/tips/screen-position-variables/
Sorry if I may have expressed myself incorrectly . I should have perhaps added that, I didn't mean the Z position . My mistake Thank you for answering so quickly
- If the skin is at the top of the screen, it should open downwards/or expand. [First post .GIF]
- If the skin is at the bottom of the screen (task bar) , it should open upwards/or expand.
It is necessary to find out whether the Rainmeter skin is in Y+ or Y- in order to enlarge the skin in the right direction.
https://docs.rainmeter.net/tips/screen-position-variables/
-
- Rainmeter Sage
- Posts: 16686
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Determining the top / bottom position
Along with the size of the screen (Screen Position Variables), these information are given by the #CURRENTCONFIGX# and #CURRENTCONFIGY# variables. These variables are returning the current position of the current skin (#CURRENTCONFIGWIDTH# and #CURRENTCONFIGHEIGHT# are returning its size, obviously width and height, accordingly).Rooky_89 wrote: ↑October 16th, 2024, 6:46 pm - If the skin is at the top of the screen, it should open downwards/or expand. [First post .GIF]
- If the skin is at the bottom of the screen (task bar) , it should open upwards/or expand.
It is necessary to find out whether the Rainmeter skin is in Y+ or Y- in order to enlarge the skin in the right direction.
https://docs.rainmeter.net/tips/screen-position-variables/
Do you need help on how these variables can be used?
-
- Rainmeter Sage
- Posts: 5544
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Determining the top / bottom position
Balala beat me with the answer...
You will want to use the built-in screen variables and the: #CURRENTCONFIGXYWH variables.
Something like this:
You will want to use the built-in screen variables and the: #CURRENTCONFIGXYWH variables.
Something like this:
Code: Select all
IfCondition=(#CurrentConfigY# < (#ScreenAreaHeight#*0.5))
IfTrueAction={Set options to expand downward}
IfFalseAction=(Set options to expand upward}
IfConditonMode=1
DynamicVariables=1
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 16686
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Determining the top / bottom position
Unfortunately here seems to be a small mistake. #CurrentConfigY# is always smaller than #ScreenAreaHeight#, as far as the skin is set to be kept on screen.eclectic-tech wrote: ↑October 16th, 2024, 7:10 pm You will want to use the built-in screen variables and the: #CURRENTCONFIGXYWH variables.
Something like this:Code: Select all
IfCondition=(#CurrentConfigY# < #ScreenAreaHeight#) IfTrueAction={Set options to expand downward} IfFalseAction=(Set options to expand upward} IfConditonMode=1 DynamicVariables=1
I'd modify the condition little bit, to something like: IfCondition=(#CurrentConfigY# < #ScreenAreaHeight#/2). This condition checks if the upper part of the skin is on the upper half of the screen (and executes the IfTrueAction if it is and the IfFalseAction otherwise). Not sure this is a good solution, but so far this is my guess.
-
- Rainmeter Sage
- Posts: 5544
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Determining the top / bottom position
Thanks for catching that balala!
I typed the code, then saw your post, and forgot to divide the screen height in half... I corrected the code above
I typed the code, then saw your post, and forgot to divide the screen height in half... I corrected the code above
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 81
- Joined: September 21st, 2024, 4:57 pm
- Location: Germany, in the stone cave
Re: Determining the top / bottom position
balala wrote: ↑October 16th, 2024, 7:36 pm Unfortunately here seems to be a small mistake. #CurrentConfigY# is always smaller than #ScreenAreaHeight#, as far as the skin is set to be kept on screen.
I'd modify the condition little bit, to something like: IfCondition=(#CurrentConfigY# < #ScreenAreaHeight#/2). This condition checks if the upper part of the skin is on the upper half of the screen (and executes the IfTrueAction if it is and the IfFalseAction otherwise). Not sure this is a good solution, but so far this is my guess.
#ScreenAreaHeight# =1200
Actually, I could determine the current position of my Rainmeter skin in Y, right? then compare the determined value of (#ScreenAreaHeight#/2)... if the value is larger (>600) of the position of the skin, I know I am in Y+, but if the value is smaller (<600), I know I am in Y-
Correct or wrong thinking
-
- Rainmeter Sage
- Posts: 16686
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Determining the top / bottom position
There might be little bit more complicated. The Y position of a skin higher than 600, is never greater than 600. I most probably would check which is greater: the space above or the space below the skin and would act accordingly. For instance:Rooky_89 wrote: ↑October 16th, 2024, 8:04 pm #ScreenAreaHeight# =1200
Actually, I could determine the current position of my Rainmeter skin in Y, right? then compare the determined value of (#ScreenAreaHeight#/2)... if the value is larger (>600) of the position of the skin, I know I am in Y+, but if the value is smaller (<600), I know I am in Y-
Correct or wrong thinking
Code: Select all
IfCondition=(#CURRENTCONFIGY#>#SCREENAREAHEIGHT#-#CURRENTCONFIGY#-#CURRENTCONFIGHEIGHT#)
IfTrueAction={Set options to expand upward}
IfFalseAction=(Set options to expand downward}
-
- Rainmeter Sage
- Posts: 8537
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Determining the top / bottom position
Just curious, are you sure you really want to check if the skin is in the upper or bottom part of the screen?
I mean, besides the skin potentially residing in both areas (e.g. 51% in the upper part and 49% in the bottom part) leading to some possible confusion, judging by your screenshot you only need enough space for the skin expansion (similar to how tooltips switch position when there's not enough space for them in the default direction).
In other words, you might only need to know if (#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#)>#SCREENAREAHEIGHT# and if so, position the skin at (#SCREENAREAHEIGHT#-#CURRENTCONFIGHEIGHT#), otherwise keep the skin position aka do nothing. Expanding the skin would always be done normally, towards the bottom of the screen.
I mean, besides the skin potentially residing in both areas (e.g. 51% in the upper part and 49% in the bottom part) leading to some possible confusion, judging by your screenshot you only need enough space for the skin expansion (similar to how tooltips switch position when there's not enough space for them in the default direction).
In other words, you might only need to know if (#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#)>#SCREENAREAHEIGHT# and if so, position the skin at (#SCREENAREAHEIGHT#-#CURRENTCONFIGHEIGHT#), otherwise keep the skin position aka do nothing. Expanding the skin would always be done normally, towards the bottom of the screen.