It is currently September 25th, 2023, 4:19 am
Share and get help with Plugins and Addons
~Faradey~
Posts: 366 Joined: November 12th, 2009, 4:47 pm
Location: Ukraine
Post
by ~Faradey~ » March 9th, 2016, 7:44 pm
@mrsalogo , here it is
i wonder what plugin you're writing, hope this code will help u
Code: Select all
#include <WinAPI.au3>
$ConfigName = ""
if $CmdLine[0] = 1 Then $ConfigName = $CmdLine[1]
Local $hControl, $hWin, $aMousePos
if $ConfigName <> "" Then
$hWin = HWnd('0x' & Hex(GetSkinWindow($ConfigName)))
WinActivate($hWin)
Else
$aMousePos = MouseGetPos()
$hControl=_WindowFromPoint($aMousePos[0],$aMousePos[1])
; Since _WindowFromPoint() can return 'sub' windows, or control handles, we should seek the owner window
$hWin=_WinAPI_GetAncestor($hControl,2)
If _WinAPI_GetClassName($hWin) == "RainmeterMeterWindow" Then
WinActivate($hWin)
EndIf
EndIf
Func _WindowFromPoint($iX,$iY)
Local $stInt64,$aRet,$stPoint=DllStructCreate("long;long")
DllStructSetData($stPoint,1,$iX)
DllStructSetData($stPoint,2,$iY)
$stInt64=DllStructCreate("int64",DllStructGetPtr($stPoint))
$aRet=DllCall("user32.dll","hwnd","WindowFromPoint","int64",DllStructGetData($stInt64,1))
If @error Then Return SetError(2,@error,0)
If $aRet[0]=0 Then Return SetError(3,0,0)
Return $aRet[0]
EndFunc
Func GetSkinWindow($szConfigName)
Local Const $hWnd = WinGetHandle("[CLASS:RainmeterTrayClass]")
If $hWnd <> 0 Then
Local Const $iSize = StringLen($szConfigName) + 1
Local Const $pMem = DllStructCreate("wchar[" & $iSize & "]")
DllStructSetData($pMem, 1, $szConfigName)
Local Const $pCds = DllStructCreate("dword;dword;ptr")
DllStructSetData($pCds, 1, 5101)
DllStructSetData($pCds, 2, ($iSize * 2))
DllStructSetData($pCds, 3, DllStructGetPtr($pMem))
Local Const $WM_COPYDATA = 0x004A
Return _SendMessage($hWnd, $WM_COPYDATA, 0, DllStructGetPtr($pCds))
EndIf
Return 0
EndFunc; end func
mrsalogo
Posts: 6 Joined: July 28th, 2015, 5:12 pm
Post
by mrsalogo » March 9th, 2016, 8:04 pm
Its simpler then i thought, Thanks! I am building an extended version of the InputText plugin. I am adding features to make it easier to use in interfaces.
Virginityrocks
Posts: 478 Joined: February 26th, 2011, 10:22 pm
Post
by Virginityrocks » April 4th, 2016, 2:52 am
RainFocus doesn't seem to be working at all, at least in the latest version of Rainmeter. Absolutely no response or error in log.
eclectic-tech
Rainmeter Sage
Posts: 5184 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » April 4th, 2016, 3:09 am
Virginityrocks wrote: RainFocus doesn't seem to be working at all, at least in the latest version of Rainmeter. Absolutely no response or error in log.
Can you post your Code?
I put this in the [Rainmeter] section of the skin I want to capture focus and it works!?
Code: Select all
MouseOverAction=["#@#Addons\RainFocus\RainFocus.exe"]
winterwulf
Posts: 94 Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil
Post
by winterwulf » September 18th, 2016, 7:56 pm
Isnt working for me neither =(
tried:
MouseOverAction=["#@#Addons\RainFocus.exe"]
MouseOverAction=#@#Addons\RainFocus.exe
MouseOverAction=#@#Addons\RainFocus.exe "#CURRENTCONFIG#"
nothing worked
eclectic-tech
Rainmeter Sage
Posts: 5184 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » September 19th, 2016, 12:20 am
I have been sing the following code in many skins and it works as intended; the skin will gain focus when the mouse is over it, and execute the OnUnfocusAction bang when focus is lost...
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
Group=#RootConfig#
OnUnfocusAction=[!DeActivateConfig "#RootConfig#\Menus\#MenuLocation#\#MenuName#\#MenuName#Menu" "#MenuName#Menu.ini"]
MouseOverAction=["#@#Addons\RainFocus\RainFocus.exe"]
I use it to ensure my fileview menus close when focus is lost... works every time!
winterwulf
Posts: 94 Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil
Post
by winterwulf » September 19th, 2016, 12:29 am
Good evening,
Here it worked now, but only to get focus from a skin to another.
when the focus is on a window or on dekstop, it didnt work for me.
gonna try your method to see what happens.
EDIT
Did the following:
Code: Select all
MouseOverAction=#@#Addons\RainFocus.exe
OnFocusAction=[!DeActivateConfig "#ROOTCONFIG#\Lyrics"]
Only got the OnFocusAction when I acctually click the skin =(
3.3.2 r2609 64-bit (May 16 2016)
Windows 7 Professional 64-bit (build 7601) Service Pack 1
Path: C:\Users\Ville\Dropbox\PortableApps\Rainmeter\
IniFile: C:\Users\Ville\Dropbox\PortableApps\Rainmeter\Rainmeter.ini
SkinPath: C:\Users\Ville\Dropbox\PortableApps\Rainmeter\Skins\
Virginityrocks
Posts: 478 Joined: February 26th, 2011, 10:22 pm
Post
by Virginityrocks » September 20th, 2016, 7:05 pm
Hey Faradey. I'm wondering if you can help me. I'm looking for a way for a plugin (possibly this plugin) to assign focus to a specified program window (ie Google Chrome), instead of a Rainmeter skin.
So, for example, if I press the "Google Chrome" button in Rainmeter, it will switch focus to the Google Chrome window (if one exists)
delfore08
Posts: 3 Joined: April 10th, 2020, 12:18 pm
Post
by delfore08 » June 19th, 2020, 5:43 pm
Nice addon. It solved my trouble. Many thanks to you! =)