Created
October 16, 2011 12:26
-
-
Save qwerty12/1290825 to your computer and use it in GitHub Desktop.
AutoHotkey script to hide Rainmeter widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
DisableRainmeterSkin() | |
{ | |
Envget, APPDATA, APPDATA | |
RainmeterINI = %APPDATA%\Rainmeter\Rainmeter.ini | |
VDMSection = Visions+\VDM Controller | |
VDMActiveKey = Active | |
ErrorLevel = 0 | |
Process, Exist, Rainmeter.exe | |
If ErrorLevel = 0 ;Not running | |
Return | |
IfNotExist %RainmeterINI% | |
{ | |
MsgBox Could not find %RainmeterINI%. | |
Return | |
} | |
IniRead, IsVDMActive, %RainmeterINI%, %VDMSection%, %VDMActiveKey% | |
If (IsVDMActive == "ERROR") | |
{ | |
MsgBox An error occured when attempting to read "%VDMActiveKey%" in "%VDMSection%" from %RainmeterINI%. | |
Return | |
} | |
ValueToWrite = | |
SysGet MonitorCount, MonitorCount | |
If (MonitorCount = 1) | |
ValueToWrite = 0 | |
Else If (MonitorCount = 2) | |
ValueToWrite = 1 | |
If (ValueToWrite <> "" And ValueToWrite <> IsVDMActive) | |
{ | |
;ErrorLevel = | |
;Process Exist, Rainmeter.exe | |
;If ErrorLevel > 0 | |
;{ | |
; PID = ErrorLevel | |
; RunWait "C:\Program Files\Rainmeter\Rainmeter.exe" !Quit | |
; Process Wait, PID | |
;} | |
RunWait "C:\Program Files\Rainmeter\Rainmeter.exe" !Quit | |
Sleep 2000 | |
Val = %ValueToWrite% | |
Key = %VDMActiveKey% | |
ErrorLevel = 0 | |
IniWrite, %Val%, %RainmeterINI%, %VDMSection%, %Key% | |
If ErrorLevel | |
{ | |
MsgBox An error occured when attempting to write "%Val%" in "%Key%" to %RainmeterINI%. Exiting program. | |
Return | |
} | |
Val = 350@2 | |
Key = WindowX | |
IniWrite, %Val%, %RainmeterINI%, %VDMSection%, %Key% | |
Val = 0@2 | |
Key = WindowY | |
IniWrite, %Val%, %RainmeterINI%, %VDMSection%, %Key% | |
Run "C:\Program Files\Rainmeter\Rainmeter.exe" | |
} | |
} | |
OnMessage((WM_SETTINGCHANGE:=0x1A), "recv_WM_SETTINGCHANGE") | |
recv_WM_SETTINGCHANGE(wParam, lParam, msg, hwnd) | |
{ | |
If wParam = 0x2F ;SPI_SETWORKAREA | |
DisableRainmeterSkin() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment