It is currently October 22nd, 2024, 11:22 pm

Determining the top / bottom position

Get help with creating, editing & fixing problems with skins
User avatar
Rooky_89
Posts: 81
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Determining the top / bottom position

Post by Rooky_89 »

Dear community, :bow: :welcome:

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. :oops:
Position -> Top on Desktop -> enlarged direction to bottom || Position -> Bottom on Desktop -> enlarged direction to Top :oops: :confused:

Thanks for your help and answers

GIF = Position -> Top -> enlarged direction to bottom
size.gif
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.
User avatar
jsmorley
Developer
Posts: 22880
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Determining the top / bottom position

Post by jsmorley »

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/variables/built-in-variables/#SkinVariables
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:
Animation.gif
You do not have the required permissions to view the files attached to this post.
User avatar
Rooky_89
Posts: 81
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Re: Determining the top / bottom position

Post by Rooky_89 »

Hallo jsmorley

Sorry if I may have expressed myself incorrectly :oops: :rosegift: . I should have perhaps added that, I didn't mean the Z position :lol: . My mistake :lol: Thank you for answering so quickly :rosegift:


- 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.

:confused: 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. :confused:

:???: https://docs.rainmeter.net/tips/screen-position-variables/
User avatar
balala
Rainmeter Sage
Posts: 16686
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Determining the top / bottom position

Post by balala »

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.

:confused: 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. :confused:

:???: https://docs.rainmeter.net/tips/screen-position-variables/
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).
Do you need help on how these variables can be used?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5544
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Determining the top / bottom position

Post by eclectic-tech »

Balala beat me with the answer...

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
User avatar
balala
Rainmeter Sage
Posts: 16686
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Determining the top / bottom position

Post by balala »

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
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.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5544
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Determining the top / bottom position

Post by eclectic-tech »

Thanks for catching that balala! :thumbup:
I typed the code, then saw your post, and forgot to divide the screen height in half... I corrected the code above
User avatar
Rooky_89
Posts: 81
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Re: Determining the top / bottom position

Post by Rooky_89 »

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 :confused: :oops:
User avatar
balala
Rainmeter Sage
Posts: 16686
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Determining the top / bottom position

Post by balala »

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 :confused: :oops:
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:

Code: Select all

IfCondition=(#CURRENTCONFIGY#>#SCREENAREAHEIGHT#-#CURRENTCONFIGY#-#CURRENTCONFIGHEIGHT#)
IfTrueAction={Set options to expand upward}
IfFalseAction=(Set options to expand downward}
(make sure to have added a DynamicVariables=1 option to the measure on which you are using this IfCondition).
User avatar
Yincognito
Rainmeter Sage
Posts: 8537
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Determining the top / bottom position

Post by Yincognito »

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.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth