It is currently April 30th, 2024, 1:20 pm

Activate New Skin at Current Mouse Position

Get help with creating, editing & fixing problems with skins
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Activate New Skin at Current Mouse Position

Post by ScoobSTi »

I'd like one of my skins to open another at the current mouse position when the RMB is pressed and lifted. It works, but the skin opens at X=0, Y=0, and not where the cursor is.

I've placed this in the [Rainmeter] section of the skin to be opened, but it ignores the bang for some reason.

Code: Select all

OnRefreshAction=!Move "$MouseX$" "$MouseY$"
Any ideas?
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Activate New Skin at Current Mouse Position

Post by jsmorley »

There are a couple of issues:

1) $MouseX$ and $MouseY$ only work in the context of a mouse click action. So they don't exist in OnRefreshAction or other non-mouse related actions.

2) $MouseX$ and $MouseY$ return numbers that are the mouse position relative to the meter it is used in. (or the overall skin it is used in if it is called in a mouse action in [Rainmeter]) It is not a value for the mouse position relative to the overall screen.

http://docs.rainmeter.net/manual-beta/variables/mouse-variables

You can solve 1) above by using this in the first skin:

Code: Select all

[MeterOne]
Meter=Image
W=50
H=50
SolidColor=255,255,255,255
LeftMouseUpAction=[!ActivateConfig OtherSkin OtherSkin.ini][!Move $MouseX$ $MouseY$ OtherSkin]
However, that will still fail to do what you want. The mouse variables are relative to the calling meter in the context of the calling skin, but the !Move bang is relative to the screen. So the mouse position in the first skin might be at 5, 15 relative to the position of the calling meter, but that will just mean that the second skin will just open at 5, 15 relative to the entire screen, or mostly in the upper left area of the screen.

So it gets a tad complicated. To solve both 1) and 2) you will need:

Code: Select all

[MeterOne]
Meter=Image
W=50
H=50
SolidColor=255,255,255,255
LeftMouseUpAction=[!ActivateConfig OtherSkin OtherSkin.ini][!Move (#CURRENTCONFIGX#+[#CURRENTSECTION#:X]+$MouseX$) (#CURRENTCONFIGY#+[#CURRENTSECTION#:Y]+$MouseY$) OtherSkin]
DynamicVariables=1
http://docs.rainmeter.net/manual-beta/variables/built-in-variables#CURRENTCONFIGXYWH

http://docs.rainmeter.net/manual-beta/variables/built-in-variables#CURRENTSECTION
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Activate New Skin at Current Mouse Position

Post by ScoobSTi »

Thanks so much! :) You guys make it look so easy. :thumbup:
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Activate New Skin at Current Mouse Position

Post by jsmorley »

Glad to help.