It is currently May 24th, 2019, 10:04 pm

Focus skin window on MouseAction (Not clicking)

Help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 313
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Focus skin window on MouseAction (Not clicking)

StArL0rd84 » May 16th, 2019, 4:49 pm

I am making a skin that is hidden away and is revealed when scrolling down within a area at the top of the screen.
When one clicks a button the skin should hide. Easy...
But if for some reason one clicks outside of the skin (unfocus) the skin should also hide.
But then the skin would not have focus and the unfocus action would not fire.

I know this question has come up before on the forum, and there's already a solution posted by ~Faradey~ that works.
https://forum.rainmeter.net/viewtopic.php?f=128&t=22839&hilit=rainfocus#p120520
It's an autoit .exe which i would be fine with.

But the little spinning wheel and CPU spike when the program is launched, i could do without.

At first i used NirCMD to simulate a mouse click, but also .exe.

The following PowerShell command can bring focus to a process.
But there's a significant delay when used with RunCommand, and i don't know if i can use it for a Rainmeter "window"
(New-Object -ComObject WScript.Shell).AppActivate((get-process notepad).MainWindowTitle)

Would be nice if there was a simple bang, plugin or even lua script, that could bring focus to the skin.
If you know a way to do this, please let me know.
Thank you.

-Michael
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))