It is currently April 16th, 2024, 8:25 am

Bringing skin to focus on start up(without exe)

Tips and Tricks from the Rainmeter Community
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Bringing skin to focus on start up(without exe)

Post by death.crafter »

This is highly recommended that you don't use this unless you need it very much.

There is another way, that is using an ahk executable to perform this action, but some av programs flag them as (false) positive. So I was trying to find a solution when I stumbled upon this one.

But not everything is perfect. This one will be slower than ahk one.
And also this won't bring the skin to focus on mouse over once you click on some other skin. That's just how Rainmeter works.
I get window handle from title, which changes to the skin you focus on or load or refresh. I will find a better way to make this work if possible.
So all you have to do is run a ps script through run command plugin.

Here is the powershell script:

Code: Select all

param (
	[Parameter(mandatory)]
	$processTitle
)

$winApi = '
    	[DllImport("user32.dll")] public static extern int SetForegroundWindow(IntPtr hwnd);
'

$type = Add-Type -MemberDefinition $winApi -Name WindowAPI -PassThru

$hwnd = (Get-Process | Where-Object MainWindowTitle -eq $processTitle | Select-Object MainWindowHandle).MainWindowHandle

$type::SetForegroundWindow($hwnd)
RunCommand:

Code: Select all

[Focus]
Measure=Plugin
Plugin=RunCommand
Program=powershell
Parameter=&('#@#Addons\Focus.ps1') -processTitle '[#CURRENTPATH][#CURRENTFILE]'
State=Hide
OutputType=ANSI
Script file zip:
Focus.zip
You do not have the required permissions to view the files attached to this post.
from the Realm of Death