What is the easiest way of getting the X and Y coordinates of Config A when Config B is loaded? What I'd like is to have is a Measure that moves Config B to the X position of Config A + 10 and the Y position of Config A + 10 when it is loaded.
I know this can be done by having Config A use WriteKeyValue to tell Config B where it is but is this really the most effiecient way of doing it if Config A is not going to be moving that often?
It is currently May 21st, 2024, 8:20 pm
Get Position of Config A when Opening Config B
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
-
- Posts: 608
- Joined: February 7th, 2011, 7:27 pm
- Location: Thessaloniki, GR
Re: Get Position of Config A when Opening Config B
Brainstorm: Read Config A's X and Y value from Rainmeter.ini, through lua in config B?
(didn't try anything)
(didn't try anything)
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Get Position of Config A when Opening Config B
I would recommend the !WriteKeyValue approach. I know it's not perfect, but it's probably the easiest way that doesn't involve using an add-on. You can use a script to send the !WKV only when the location changes:
Then ConfigB can move itself to those coordinates on startup.
Code: Select all
Save = { X = false, Y = false }
function Update()
for XorY, Last in pairs(Save) do
local Current = tonumber(SKIN:GetVariable('CURRENTCONFIG'..XorY))
if Current ~= Last then
SKIN:Bang('!WriteKeyValue', 'Variables', 'ConfigA'..XorY, Current, '[PathToConfigB]')
Save[XorY] = Current
end
end
end
Code: Select all
OnRefreshAction=!Move #ConfigAX# #ConfigAY#
I would not use this approach in a publicly-distributed skin, because on some systems, Rainmeter.ini may use a character encoding that Lua can't read, such as UTF-16. But for personal use, it should be fine.KreAch3R wrote:Brainstorm: Read Config A's X and Y value from Rainmeter.ini, through lua in config B?
(didn't try anything)
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: Get Position of Config A when Opening Config B
Thanks KreAch3R and Kaelri.
I think I'll go with the script as ConfigA is just a single image which serves as a background for a number of other Configs so it can write its new position and move the others as the need arises.
I think I'll go with the script as ConfigA is just a single image which serves as a background for a number of other Configs so it can write its new position and move the others as the need arises.