It is currently October 23rd, 2019, 4:10 am

RainRez 3.0

Plugins and Addons popular with the Community
blackXdrAg0n
Posts: 7
Joined: June 24th, 2012, 6:58 pm

Re: RainRez 3.0

blackXdrAg0n » December 23rd, 2012, 11:31 pm

Hello again, I have another question...

Is it possible to use RainRez while Rainmeter is in a locked folder? The program files folder is currently locked (where rainmeter is located) and everytime I run RainRez, I get an error message saying that rainmeter is not writable. I have included the error message in this post. Is there something else that needs to be done?

Thank you ahead of time for any help.


EDIT: SOLVED. Looks like I had the file in the wrong folder.
User avatar
220v110
Posts: 26
Joined: February 17th, 2014, 1:33 pm

Re: RainRez 3.0

220v110 » February 17th, 2014, 1:37 pm

It seems to be broken with RM 3.1.0 beta.
User avatar
jsmorley
Developer
Posts: 19618
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRez 3.0

jsmorley » February 17th, 2014, 2:04 pm

220v110 wrote:It seems to be broken with RM 3.1.0 beta.
I updated the .zip in the first post of the thread. Give it a try and let me know.
User avatar
220v110
Posts: 26
Joined: February 17th, 2014, 1:33 pm

Re: RainRez 3.0

220v110 » February 17th, 2014, 3:45 pm

Thanks, works perfect!

Can I add default theme in cfg file for unlisted resolutions? I just want to refresh RM on every screen resolution change. If I add all possible resolutions, will it slow down your program?
User avatar
jsmorley
Developer
Posts: 19618
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRez 3.0

jsmorley » February 17th, 2014, 3:48 pm

Adding all the resolutions that are supported by your monitor won't slow anything down in any way you could ever notice.
User avatar
jsmorley
Developer
Posts: 19618
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRez 3.0

jsmorley » February 17th, 2014, 4:11 pm

I have added the ability to have a line:

Default=SomeLayout

In the RainRez.cfg file. That will now be used if no matching entry for your current screen resolution is found.

New .zip file in the first post of the thread.
User avatar
220v110
Posts: 26
Joined: February 17th, 2014, 1:33 pm

Re: RainRez 3.0

220v110 » February 17th, 2014, 4:53 pm

Wow, thanks alot, jsmorley. My time skin is always in the middle now.
ouned
Posts: 1
Joined: April 9th, 2014, 12:05 pm

Re: RainRez 3.0

ouned » April 9th, 2014, 12:42 pm

Hey guys,

I modified jsmorley's script a bit so it uses the virtual screen size instead of the native one.
This has the advantage that it also works with multiple monitors.

Code: Select all

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=RainRez.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Misc.au3>
#include <Constants.au3>

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)
_Singleton("RainRez", 0)

$VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 78)   ;sm_virtualwidth
$VirtualDesktopWidth = $VirtualDesktopWidth[0]
$VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 79)   ;sm_virtualheight
$VirtualDesktopHeight = $VirtualDesktopHeight[0]

$OldWidth = $VirtualDesktopWidth
$OldHeight = $VirtualDesktopHeight
$SleepCount = 0

$RainmeterPath = IniRead("RainRez.cfg", "RainRez", "RainmeterPath", "")
If StringRight($RainmeterPath, 1) <> "\" Then
	$RainmeterPath = $RainmeterPath & "\"
EndIf

If not FileExists($RainmeterPath & "Rainmeter.exe") Then
	MsgBox(16, "RainRez Error", "Unable to locate " & @CRLF & $RainmeterPath & "Rainmeter.exe" & @CRLF & @CRLF & "Ensure you have set RainmeterPath in RainRez.cfg to the location of your Rainmeter executable files." & @CRLF & @CRLF & "This will normally be C:\Program Files\Rainmeter")
	Exit
EndIf

If Not ProcessExists("Rainmeter.exe") Then

	$Default = IniRead("RainRez.cfg", "RainRez", "Default", "" )
	$ThemeToLoad = IniRead("RainRez.cfg", "RainRez", $OldWidth & "x" & $OldHeight, "" )

	if $ThemeToLoad <> "" Then

		ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $ThemeToLoad & chr(34))

	Else

		ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $Default & chr(34))

	EndIf

EndIf

$TrayClick = TrayCreateItem("Exit RainRez")
TrayItemSetOnEvent(-1,"ExitRainRez")
TraySetIcon("RainRez.exe")

While 1

	Sleep(1000)

  $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 78)   ;sm_virtualwidth
  $VirtualDesktopWidth = $VirtualDesktopWidth[0]
  $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 79)   ;sm_virtualheight
  $VirtualDesktopHeight = $VirtualDesktopHeight[0]

  $CurrentWidth = $VirtualDesktopWidth
  $CurrentHeight = $VirtualDesktopHeight

	TraySetToolTip("RainRez" & @CRLF & $CurrentWidth & "x" & $CurrentHeight)

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

		$Default = IniRead("RainRez.cfg", "RainRez", "Default", "" )
		$ThemeToLoad = IniRead("RainRez.cfg", "RainRez", $CurrentWidth & "x" & $CurrentHeight, "" )

		if $ThemeToLoad <> "" Then

			ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $ThemeToLoad & chr(34))

		Else

			ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $Default & chr(34))

		EndIf

		$OldWidth = $VirtualDesktopWidth
		$OldHeight = $VirtualDesktopHeight

	EndIf

WEnd

Exit

Func ExitRainRez()

	Exit

EndFunc ;StartRainmeter
hello2u
Posts: 3
Joined: May 1st, 2013, 10:02 pm

Re: RainRez 3.0

hello2u » October 29th, 2014, 9:13 pm

I added support for a "Battery" skin for anyone who wants to change skins when your laptop isn't plugged in. Not sure if you can save any power this way but it's worth a shot I guess

It also monitors changes to the DesktopWorkArea, which I've found incredibly useful for keeping skins always visible without getting in the way

You'll need the desktopworkarea script from http://www.autoitscript.com/forum/topic/119681-resolution-of-the-working-area-of-the-desktop/?p=831856; save it as [RainRez directory]\lib\desktopworkarea.au3 (also comment out the MsgBox on line 5)

Some other changes include adding information in the tooltip, adding a few useful options to the tray menu, and using a different method to get the virtual desktop size (I made it before ouned posted and only just got around to posting it (sorry ouned))

Code: Select all

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=RainRez.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Misc.au3>
#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include "lib\desktopworkarea.au3"

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",3)
_Singleton("RainRez", 0)

$OldHeight = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)
$OldWidth = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN)

$WorkingWidth = _GetworkingAreaWidth()
$WorkingHeight = _GetworkingAreaHeight()

$OldWorkingWidth = _GetworkingAreaWidth()
$OldWorkingHeight = _GetworkingAreaHeight()

$SleepCount = 0
$ThemeToLoad = "Unchanged"

$BattStatus = GetBattery()
$BattOld = $BattStatus
$BattWord = "Plugged in"
If ($BattStatus = 0) Then
   $BattWord = "Discharging"
EndIf

$RainmeterPath = IniRead("RainRez.cfg", "RainRez", "RainmeterPath", "")
If StringRight($RainmeterPath, 1) <> "\" Then
	$RainmeterPath = $RainmeterPath & "\"
EndIf

If not FileExists($RainmeterPath & "Rainmeter.exe") Then
	MsgBox(16, "RainRez Error", "Unable to locate " & @CRLF & $RainmeterPath & "Rainmeter.exe" & @CRLF & @CRLF & "Ensure you have set RainmeterPath in RainRez.cfg to the location of your Rainmeter executable files." & @CRLF & @CRLF & "This will normally be C:\Program Files\Rainmeter")
	Exit
EndIf

If Not ProcessExists("Rainmeter.exe") Then
   $Default = IniRead("RainRez.cfg", "RainRez", "Default", "" )
   $BattTheme = IniRead("RainRez.cfg", "RainRez", "Battery", "" )
   $ResTheme = IniRead("RainRez.cfg", "RainRez", $OldWidth & "x" & $OldHeight, "" )

   If $BattTheme <> "" and $BattStatus = 0 Then
	  $ThemeToLoad = $BattTheme
   ElseIf $ResTheme <> "" Then
	  $ThemeToLoad = $ResTheme
   Else
	  $ThemeToLoad = $Default
   EndIf
   
   ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $ThemeToLoad & chr(34))

EndIf

$TrayClick = TrayCreateItem("Refresh")
TrayItemSetOnEvent(-1,"Refresh")
$TrayClick = TrayCreateItem("Manage RM")
TrayItemSetOnEvent(-1,"OpenSkins")
$TrayClick = TrayCreateItem("Config")
TrayItemSetOnEvent(-1,"Openconfig")
$TrayClick = TrayCreateItem("Exit RainRez")
TrayItemSetOnEvent(-1,"ExitRainRez")
TraySetIcon("RainRez.ico")

$CurrentHeight = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)
$CurrentWidth = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN)

$WorkingWidth = _GetworkingAreaWidth()
$WorkingHeight = _GetworkingAreaHeight()

UpdateToolTip()

While 1
   Sleep(5000)
   
   $BattStatus = GetBattery()
   if ($BattStatus = 0) Then
	  $BattWord = "Discharging"
   Else
	  $BattWord = "Plugged in"
   EndIf
	
	$CurrentHeight = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)
	$CurrentWidth = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN)
	
	$WorkingWidth = _GetworkingAreaWidth() 
    $WorkingHeight = _GetworkingAreaHeight()
	
    If Not ProcessExists("Rainmeter.exe") Then
	   ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34))
    EndIf
	
	If $CurrentWidth <> $OldWidth or $CurrentHeight <> $OldHeight or $BattStatus <> $BattOld Then
	  $Default = IniRead("RainRez.cfg", "RainRez", "Default", "" )
	  $BattTheme = IniRead("RainRez.cfg", "RainRez", "Battery", "" )
	  $ResTheme = IniRead("RainRez.cfg", "RainRez", $CurrentWidth & "x" & $CurrentHeight, "" )

	  If $BattTheme <> "" and $BattStatus = 0 Then
		 $ThemeToLoad = $BattTheme
	  ElseIf $ResTheme <> "" Then
		 $ThemeToLoad = $ResTheme
	  Else
		 $ThemeToLoad = $Default
	  EndIf
	  
	  ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!LoadLayout " & chr(34) & $ThemeToLoad & chr(34))
	  ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!RefreshApp")
		
	  $OldHeight = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)
	  $OldWidth = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN)

	  $OldWorkingWidth = _GetworkingAreaWidth()
	  $OldWorkingHeight = _GetworkingAreaHeight()

	  $BattOld = GetBattery()

	  UpdateToolTip()
	EndIf
	
    If $WorkingWidth <> $OldWorkingWidth or $WorkingHeight <> $OldWorkingHeight Then
	  Refresh()
	  $OldWorkingWidth = _GetworkingAreaWidth()
      $OldWorkingHeight = _GetworkingAreaHeight()
	  UpdateToolTip()
    EndIf

WEnd

Exit

Func OpenConfig()
	ShellExecute(chr(34) & "RainRez.cfg" & chr(34))
 EndFunc
 
 Func OpenSkins()
	ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!Manage skins")
EndFunc

Func OpenLayouts()
	ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!Manage layouts")
EndFunc

Func Refresh()
	ShellExecute(chr(34) & $RainmeterPath & "Rainmeter.exe" & chr(34), "!RefreshApp")
EndFunc

Func UpdateToolTip()
   TraySetToolTip("RainRez" & @CRLF & "Layout: " & $ThemeToLoad & @CRLF & "DWA: " & _GetworkingAreaWidth() & "x" & _GetworkingAreaHeight() & @CRLF & "Resolution: " & $CurrentWidth & "x" & $CurrentHeight & @CRLF & "Battery: " & $BattWord)   
EndFunc

Func GetBattery()
   ;Thanks to PsaltyDS for the script I used as a reference (http://www.autoitscript.com/forum/index.php?showtopic=10993&view=findpost&p=531988)
   
   $struct = DllStructCreate("ubyte;ubyte;ubyte;ubyte;ulong;ulong")
   $call = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($struct))
   
   If @error Then
        Return -1
   EndIf

   If Not $call[0] Then
	  Return -1
   EndIf

   Return DllStructGetData($struct, 1)
EndFunc

Func ExitRainRez()
	Exit
 EndFunc ;StartRainmeter
Pesoen
Posts: 5
Joined: November 18th, 2013, 4:54 pm

Re: RainRez 3.0

Pesoen » November 28th, 2016, 6:59 am

am i the only one who gets a trojan warning? and warnings about the program trying to connect to the internet?