It is currently April 16th, 2024, 11:50 am

[Solved] Autohotkey and Enigma Toggle

Share and get help with Plugins and Addons
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Autohotkey and Enigma Toggle

Post by Kaelri »

Code: Select all

"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterWriteKeyValue Variables State1 Show "#SKINSPATH#Enigma\Taskbar\Toggle\Toggle.ini"
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Autohotkey and Enigma Toggle

Post by jsmorley »

C:\Program Files\Rainmeter\Rainmeter.exe !RainmeterWriteKeyValue Variables State1 Show "#Enigma\Taskbar\Toggle\Toggle.ini"

The "filespec" part at the end of !RainmeterWriteKeyValue must be a full path and filename. I don't know what "#Enigma" is, but unless it is being expanded by AutoHotKey to #SKINSPATH#Enigma prior to sending, it won't work.

http://rainmeter.net/cms/Settings-BuiltInVariables_beta
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Autohotkey and Enigma Toggle

Post by poiru »

NictraSavios wrote:Edit: Okay, I'm halfway through writing this, and I hit a snag. How do I verify that the toggle widget is active and being used? (That way if enigma isn't being used, they won't turn it off.... [ and useless action] which may cause bugs for other themes, or they will be wondering why the one or two parts of enigma they use just disappeared)
The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.

Code: Select all

HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL);
if (hWndRainmeter)
{
	LPWSTR skinName = L"Gnometer\\Clock";
	COPYDATASTRUCT cds;
	cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE
	cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2;
	HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds);
	if (hWndSkin)
	{
		// Skin active
	}
}
To get the skins path and/or path to Rainmeter.ini directly from Rainmeter, you can use the RAINMETER_QUERY_ID_SKINS_PATH and RAINMETER_QUERY_ID_SETTINGS_PATH messages (check this page). This requires that you create a window and process the WM_COPYDATA in its window procedure.
NictraSavios
Posts: 30
Joined: August 23rd, 2011, 8:21 am
Location: Nova Scotia, Canada

Re: Autohotkey and Enigma Toggle

Post by NictraSavios »

poiru wrote: The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.

Code: Select all

HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL);
if (hWndRainmeter)
{
	LPWSTR skinName = L"Gnometer\\Clock";
	COPYDATASTRUCT cds;
	cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE
	cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2;
	HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds);
	if (hWndSkin)
	{
		// Skin active
	}
}
To get the skins path and/or path to Rainmeter.ini directly from Rainmeter, you can use the RAINMETER_QUERY_ID_SKINS_PATH and RAINMETER_QUERY_ID_SETTINGS_PATH messages (check this page). This requires that you create a window and process the WM_COPYDATA in its window procedure.

I found it much faster by verifiying the position of rainmeter ini and then querying the active state.
NictraSavios
Posts: 30
Joined: August 23rd, 2011, 8:21 am
Location: Nova Scotia, Canada

Re: Autohotkey and Enigma Toggle

Post by NictraSavios »

poiru wrote: The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.

Code: Select all

HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL);
if (hWndRainmeter)
{
	LPWSTR skinName = L"Gnometer\\Clock";
	COPYDATASTRUCT cds;
	cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE
	cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2;
	HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds);
	if (hWndSkin)
	{
		// Skin active
	}
}
To get the skins path and/or path to Rainmeter.ini directly from Rainmeter, you can use the RAINMETER_QUERY_ID_SKINS_PATH and RAINMETER_QUERY_ID_SETTINGS_PATH messages (check this page). This requires that you create a window and process the WM_COPYDATA in its window procedure.

In the end I ended up using something other then that... I have a small issue with it that I`m getting help with in another part of the forum , thank you :)