Page 1 of 1

Refresh Rainmeter for resolution change

Posted: February 24th, 2010, 5:02 am
by enneract
I use a tablet, and was constantly frustrated by the lack of the ability for rainmeter to detect when resolution was changed (in my case, going to portrait mode). This often resulted in the malformation of my desktop config.

Anyway, I solved this issue today, by rewriting my config settings using dynamic locations (relative to desktop edges), and writing a small autoit script to detect when the desktop resolution changes and passing a refresh bang to rainmeter.

Below is the source, attached is the compiled version (scan with whatever you want. I think autoit sometimes comes up with false positives, *shrug*, that is while I supply the source). I found a 1s sleep period to be optimal for responsiveness while not destroying cpu cycles, but YMMV.

Hope someone else finds this useful.

Code: Select all

#NoTrayIcon
$state = @DesktopHeight
$cmd   = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Rainmeter", "") & "\Rainmeter.exe !RainmeterRefresh"

Do
	If @DesktopHeight  < $state OR @DesktopHeight > $state Then
		$state = @DesktopHeight
		RunWait ($cmd)
	EndIf
	Sleep(1000)
Until $state > 9000

Re: Refresh Rainmeter for resolution change

Posted: February 24th, 2010, 6:21 am
by jsmorley
Thanks. A bit like this: http://rainmeter.net/forum/viewtopic.php?f=18&t=809&hilit=rainrez

In mine I just use:

$OldWidth = @DesktopWidth
$OldHeight = @DesktopHeight

Sleep(2000)

$CurrentWidth = @DesktopWidth
$CurrentHeight = @DesktopHeight

If $CurrentWidth <> $OldWidth or $CurrentHeight <> $OldHeight Then

Then just carry on with the appropriate actions. Seems to always work for me.

Re: Refresh Rainmeter for resolution change

Posted: February 24th, 2010, 6:26 am
by enneract
I saw that. However, ID10T error got me and I read it as only passing the right theme to rainmeter at startup.

Yours looks to be better, lol :D