It is currently May 3rd, 2024, 6:28 pm

[Suggestions] !Shift / #CURRENTCONFIGZPOS# / BlurRegion

Report bugs with the Rainmeter application and suggest features.
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

[Suggestions] !Shift / #CURRENTCONFIGZPOS# / BlurRegion

Post by killall-q »

!Shift/!ShiftGroup/!ShiftMeter/!ShiftMeterGroup

The caveat of the !Move, and now !SetOption, families is that they only allow a single destination to be specified. For shifting, there's #CURRENTCONFIGX/Y# and section variables, but for a bunch of objects with various and unknown X/Y values...

Code: Select all

[!SetOption Meter1 X ([Meter1:X]+80)][!SetOption Meter2 X ([Meter2:X]+80)][!SetOption Meter3 X ([Meter3:X]+80)]...
so how about

Code: Select all

!ShiftMeterGroup SomeGroup 80 0


#CURRENTCONFIGZPOS#
Since ZPos isn't binary, toggling between 2 states is a little challenging. The most difficult part is respecting the current user setting so the toggle isn't wasted setting the wrong setting. It's possible to retrieve the value from Rainmeter.ini with regex, but messy. I'll probably end up writing that lua function anyway, but I'm just throwing this one out there. Or how about

RAINMETER:GetSection('ExampleSkin')
exampleSkin:GetValue('AlwaysOnTop')
(For configuration skins that need to configure other skins)

or

SKIN:GetSetting('AlwaysOnTop')



BlurRegion
I'm using either execute-once measures or lua to utilize section variables in blur regions, so the first arbitrary blur region required for blur to function just seems a little silly.

Code: Select all

[Rainmeter]
Blur=1
BlurRegion=1,0,0,1,1 <-silly
!RemoveBlur in the documentation needs a little fleshing out too. So to remove a region, just use the same code I used to add it, with section variables and everything? What if those section variables are now different?
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

Re: [Suggestions] !Shift / #CURRENTCONFIGZPOS# / BlurRegion

Post by killall-q »

I've since written my own Lua function to tackle ZPos toggling. Using "Reading/wrting INI file in windows" as a reference, it was challenging in an educational kind of way and in the end proved to be pretty easy.

Code: Select all

function ToggleZPos(Skin, Z1, Z2)
	local RMini, Z = io.open(SKIN:GetVariable('SETTINGSPATH').."Rainmeter.ini", "r"), 0
	for line in RMini:lines() do
		if line:lower():match("%["..Skin:lower().."%]") then
			for line in RMini:lines() do
				if line:sub(1, 1) == "[" then
					break
				elseif line:match("AlwaysOnTop") then
					Z = line:sub(13, 14)
					break
				end
			end
			break
		end
	end
	RMini:close()
	if tonumber(Z) == tonumber(Z1) then
		SKIN:Bang('!ZPos', Z2, Skin)
	else
		SKIN:Bang('!ZPos', Z1, Skin)
	end
end
This is pretty generic code that can be adapted to return values from any .ini file. Perhaps not the most efficient code, if any Lua guru can suggest shortcuts.
Last edited by killall-q on March 14th, 2013, 9:37 pm, edited 1 time in total.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Suggestions] !Shift / #CURRENTCONFIGZPOS# / BlurRegion

Post by smurfier »

killall-q wrote:This is pretty generic code that can be adapted to return values from any .ini file. Perhaps not the most efficient code, if any Lua guru can suggest shortcuts.
Ummmm....
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

Re: [Suggestions] !Shift / #CURRENTCONFIGZPOS# / BlurRegion

Post by killall-q »

I LOL'ed.

Though when I googled "rainmeter read ini" about 2 months ago that page was not yet in existence. This would have lessened much of my aggravation.

Well I've shortened "string.match", etc and added case insensitivity but the bangs seem to handle errors just fine. As for assert(), if Rainmeter.ini isn't readable, you've got much bigger problems.