It is currently April 26th, 2024, 5:51 pm

Help with Hiding/Showing Skin with Active Opened Program

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7172
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by Yincognito »

And we just went from 0 ways of doing something to more than one way of doing it in no time. The beauty of open source modular design... 8-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
bukashka59
Posts: 6
Joined: March 2nd, 2020, 6:26 am

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by bukashka59 »

Ah man im can't get it to work can someone input that new code to make it work for me, i did install the powershellRM

here is modified code that worked but is missing the code for window in focus function...

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName="Adobe Premiere Pro.exe"
IfAboveValue=0
IfAboveAction=[!Show][!Delay 1000][!ZPos "1"][!Delay 1000][!Move "1460" "1155"]
IfBelowValue=0
IfBelowAction=[!Move "3089" "2045"][!Delay 1000][!ZPos "-1"]

[Rainmeter]
Update=1000
Group=EdgeSys

BackgroundMode=1
BackgroundMargins=30,10,10,10

ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings" "Settings.ini"]
ContextTitle=Open Settings panel

LeftMouseDoubleClickAction=[!ActivateConfig "#ROOTCONFIG#\Local Machine\CPU\Usage" "Normal.ini"]

OnRefreshAction=[!FadeDuration "100"]

[Metadata]
Name=CPU Usage
Author=Saber Akiyama
Information=Displays CPU Usage
License=Creative Commons BY-NC-SA 4.0 International
Version=3.0.1

[Variables]
@include=#@#Measures\CPU.inc
@include2=#@#String Styles.inc
@include3=#@#Variables.inc
@include4=#@#HWiNFO.inc

[mLabelCPU]
Meter=String
MeterStyle=SysLeftText
X=25
Y=20
DynamicVariables=1
SolidColor=0,0,0,1
Text=CPU Usage
ToolTipTitle=CPU Name
ToolTipType=1
ToolTipIcon=Info
ToolTipText="Driver Name: [CPUName]"

[mPercent]
Meter=String
MeterStyle=SysRightText
MeasureName=CPUUsgValue
MeasureName2=CPUUsgUnits
X=200r
Y=0r
NumOfDecimals=2
LeftMouseUpAction=["taskmgr.exe"]
Percentual=1
SolidColor=0,0,0,1
Text="%1%2"
ToolTipText=Open Task Manager

[mTopCPU]
Meter=String
MeterStyle=SysLeftText
MeasureName=mTopProc
X=15
Y=41r
W=265
Text="Top: %1"

[mBarCPU]
Meter=Bar
MeterStyle=SysBar
MeasureName=CPUUsgValue
TransformationMatrix=-1; 0; -1; 1; 15; 0
X=-237
Y=37
W=180
H=13
DynamicVariables=1 
thank you
User avatar
Yincognito
Rainmeter Sage
Posts: 7172
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by Yincognito »

bukashka59 wrote: March 5th, 2020, 5:44 pm Ah man im can't get it to work can someone input that new code to make it work for me, i did install the powershellRM
here is modified code that worked but is missing the code for window in focus function...
thank you
Jeff wrote: March 3rd, 2020, 7:36 pmthis but you add

Code: Select all

IfMatch = The Window Name
IfMatchAction = !SetVariable Active 1
IfNotMatchAction = !SetVariable Active 0
to [FGWindow] and on the Process measure you just add

Code: Select all

DynamicVariables=1
IfCondition = (#CURRENTSECTION# = 1) && (#Active# = 1)
IfTrueAction = ...
IfFalseAction = ...
you can probably modify the powershell lines to do both but idk right now how to, but that's how you get if the window is active/in focus and running :P
So, Jeff, it's your turn to help now - it's your discovery... :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16173
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by balala »

bukashka59 wrote: March 5th, 2020, 5:44 pm Ah man im can't get it to work can someone input that new code to make it work for me, i did install the powershellRM

here is modified code that worked but is missing the code for window in focus function...

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName="Adobe Premiere Pro.exe"
IfAboveValue=0
IfAboveAction=[!Show][!Delay 1000][!ZPos "1"][!Delay 1000][!Move "1460" "1155"]
IfBelowValue=0
IfBelowAction=[!Move "3089" "2045"][!Delay 1000][!ZPos "-1"]
I don't have installed Adobe Premiere Pro, so when I load the skin of your code, I always get executed the bangs of the IfBelowAction of the [MeasureProcess] measure. This in my case is somehow improper, moving the skin outside of my screen. Its horizontal resolution is smaller than 3089 pixels, so with the above used values, I got the skin moved outside of my screen. So, I had to rewrite the above values. Make sure in your case these values are correct and your screen has higher resolution then 3089 x 2045 pixels, to get kept the skin on screen.
Otherwise I'm not sure I do understand what the
bukashka59 wrote: March 5th, 2020, 5:44 pm im can't get it to work
does mean. Could you please give us a few details on what doesn't work? Do you see the skin on screen? If so, what do you see? What the skin does?
bukashka59
Posts: 6
Joined: March 2nd, 2020, 6:26 am

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by bukashka59 »

Hi again, the skin is not hiding when other windows other then premiere pro are open and are in focus. Im not a programmer and have no idea where i should stick that new piece of code that you guys gave me, plus there is the ... don't know what to put in there..... :(

Code: Select all

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName="Adobe Premiere Pro.exe"
IfAboveValue=0
IfAboveAction=[!Show][!Delay 1000][!ZPos "1"][!Delay 1000][!Move "1460" "1155"]
IfBelowValue=0
IfBelowAction=[!Move "3089" "2045"][!Delay 1000][!ZPos "-1"]
DynamicVariables=1
IfCondition = (#CURRENTSECTION# = 1) && (#Active# = 1)
IfTrueAction = ...
IfFalseAction = ...

[FGWindow]
IfMatch = Adobe Premiere Pro.exe
IfMatchAction = !SetVariable Active 1
IfNotMatchAction = !SetVariable Active 0

[Rainmeter]
Update=1000
Group=EdgeSys

BackgroundMode=1
BackgroundMargins=30,10,10,10

ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings" "Settings.ini"]
ContextTitle=Open Settings panel

LeftMouseDoubleClickAction=[!ActivateConfig "#ROOTCONFIG#\Local Machine\CPU\Usage" "Normal.ini"]

OnRefreshAction=[!FadeDuration "100"]

[Metadata]
Name=CPU Usage
Author=Saber Akiyama
Information=Displays CPU Usage
License=Creative Commons BY-NC-SA 4.0 International
Version=3.0.1

[Variables]
@include=#@#Measures\CPU.inc
@include2=#@#String Styles.inc
@include3=#@#Variables.inc
@include4=#@#HWiNFO.inc

[mLabelCPU]
Meter=String
MeterStyle=SysLeftText
X=25
Y=20
DynamicVariables=1
SolidColor=0,0,0,1
Text=CPU Usage
ToolTipTitle=CPU Name
ToolTipType=1
ToolTipIcon=Info
ToolTipText="Driver Name: [CPUName]"

[mPercent]
Meter=String
MeterStyle=SysRightText
MeasureName=CPUUsgValue
MeasureName2=CPUUsgUnits
X=200r
Y=0r
NumOfDecimals=2
LeftMouseUpAction=["taskmgr.exe"]
Percentual=1
SolidColor=0,0,0,1
Text="%1%2"
ToolTipText=Open Task Manager

[mTopCPU]
Meter=String
MeterStyle=SysLeftText
MeasureName=mTopProc
X=15
Y=41r
W=265
Text="Top: %1"

[mBarCPU]
Meter=Bar
MeterStyle=SysBar
MeasureName=CPUUsgValue
TransformationMatrix=-1; 0; -1; 1; 15; 0
X=-237
Y=37
W=180
H=13
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16173
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by balala »

bukashka59 wrote: March 6th, 2020, 6:07 pm Hi again, the skin is not hiding when other windows other then premiere pro are open.
But it doesn't even have to. What it does is to check if the program is running and if it does, the skin is shown (through the !Show bang of the IfAboveAction option) and moved to the 1460, 1155 position, while if it doesn't, nothing is hidden (there is no a !Hide bang in the IfBelow Action option), but the skin is moved to the 3089, 2045 position (quite right and down). I suppose that maybe a !Hide bang is missing from this last IfBelowAction option, but I'm not sure about your intention.
On the other hand, this code as it is written, can't check and doesn't even care too much, what other windows are open or what other programs are running. The [MeasureProcess] measure checks only the status of Adobe Premiere Pro. Would you like to hide the skin when other programs are running? Which one, because the code can't check if ANY other program is running? This is quite hard to be achieved, or even more, it probably can't be. I don't see a way to check if any unnamed program is running, not talking that in Windows probably always is running some programs, so there is no way to not have programs opened. So, I'm not sure what to recommend in this point...
User avatar
Yincognito
Rainmeter Sage
Posts: 7172
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by Yincognito »

balala wrote: March 6th, 2020, 6:27 pm But it doesn't even have to. What it does is to check if the program is running and if it does, the skin is shown (through the !Show bang of the IfAboveAction option) and moved to the 1460, 1155 position, while if it doesn't, nothing is hidden (there is no a !Hide bang in the IfBelow Action option), but the skin is moved to the 3089, 2045 position (quite right and down). I suppose that maybe a !Hide bang is missing from this last IfBelowAction option, but I'm not sure about your intention.
On the other hand, this code as it is written, can't check and doesn't even care too much, what other windows are open or what other programs are running. The [MeasureProcess] measure checks only the status of Adobe Premiere Pro. Would you like to hide the skin when other programs are running? Which one, because the code can't check if ANY other program is running? This is quite hard to be achieved, or even more, it probably can't be. I don't see a way to check if any unnamed program is running, not talking that in Windows probably always is running some programs, so there is no way to not have programs opened. So, I'm not sure what to recommend in this point...
No, balala, the OP wants to implement Jeff's solution, using the PowershellRM plugin ... and he doesn't know how to do it. I'm in the process of trying just that, but I'll have to see how it works first.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16173
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by balala »

Yincognito wrote: March 6th, 2020, 6:44 pm No, balala, the OP wants to implement Jeff's solution, using the PowershellRM plugin ... and he doesn't know how to do it. I'm in the process of trying just that, but I'll have to see how it works first.
Oh, sorry. Was not careful enough, it seems.
Ok go ahead and try help him, in this case.
User avatar
Yincognito
Rainmeter Sage
Posts: 7172
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by Yincognito »

bukashka59 wrote: March 6th, 2020, 6:07 pmHi again, the skin is not hiding when other windows other then premiere pro are open and are in focus. Im not a programmer and have no idea where i should stick that new piece of code that you guys gave me, plus there is the ... don't know what to put in there..... :(
Ok, so this is what you should do:

1. Go here and download PowershellRM_0.6.0.rmskin, then install the skin into your Rainmeter, but uncheck PowerShellRMExample in the "Rainmeter Skin Installer" window, in order to only install the plugin's DLL files, without the sample skin in the download (you should know how to do this by now, right?)
2. Now replace your code with this (make sure you remember the values that you want for the movement, because I didn't use your last posted code when writing the code below):

Code: Select all

[Variables]
Active=0

[GetFunc]
Measure = Plugin
Plugin = PowershellRM
Line  = Add-Type @"
Line2 =   using System;
Line3 =   using System.Runtime.InteropServices;
Line4 =   public class USER32 {
Line5 =     [DllImport("user32.dll")]
Line6 =     public static extern IntPtr GetForegroundWindow();
Line7 = }
Line8 = "@
UpdateDivider = -1

[FGWindow]
Measure = Plugin
Plugin = PowershellRM
Parent = GetFunc
Line = $proc = Get-Process | ? { $_.MainWindowHandle -eq [USER32]::GetForegroundWindow() }
Line2 = $proc.ProcessName
IfMatch=^notepad$
IfMatchAction=[!SetVariable Active 1]
IfNotMatchAction=[!SetVariable Active 0]

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName="notepad.exe"
IfCondition=(#CURRENTSECTION#=1) && (#Active#=1)
IfTrueAction=[!Show][!Delay 1000][!ZPos "1"][!Delay 1000][!Move "100" "100"]
IfFalseAction=[!Move "50" "50"][!Delay 1000][!ZPos "-1"][!Delay 1000][!Hide]
DynamicVariables=1

[Rainmeter]
Update=1000
Group=EdgeSys

BackgroundMode=1
BackgroundMargins=30,10,10,10

ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings" "Settings.ini"]
ContextTitle=Open Settings panel

LeftMouseDoubleClickAction=[!ActivateConfig "#ROOTCONFIG#\Local Machine\CPU\Usage" "Normal.ini"]

OnRefreshAction=[!FadeDuration "100"]

[Metadata]
Name=CPU Usage
Author=Saber Akiyama
Information=Displays CPU Usage
License=Creative Commons BY-NC-SA 4.0 International
Version=3.0.1

[Variables]
@include=#@#Measures\CPU.inc
@include2=#@#String Styles.inc
@include3=#@#Variables.inc
@include4=#@#HWiNFO.inc

[mBackground]
Meter=Shape
Shape=Rectangle 0.5,0.5,(300-1),(100-1) | Fill Color 67,67,67,255 | Stroke Color 188,185,178,255 | StrokeWidth 1
DynamicVariables=1

[mLabelCPU]
Meter=String
MeterStyle=SysLeftText
X=25
Y=20
DynamicVariables=1
SolidColor=0,0,0,1
Text=CPU Usage
ToolTipTitle=CPU Name
ToolTipType=1
ToolTipIcon=Info
ToolTipText="Driver Name: [CPUName]"

[mPercent]
Meter=String
MeterStyle=SysRightText
MeasureName=CPUUsgValue
MeasureName2=CPUUsgUnits
X=200r
Y=0r
NumOfDecimals=2
LeftMouseUpAction=["taskmgr.exe"]
Percentual=1
SolidColor=0,0,0,1
Text="%1%2"
ToolTipText=Open Task Manager

[mTopCPU]
Meter=String
MeterStyle=SysLeftText
MeasureName=mTopProc
X=15
Y=48r
W=265
Text="Top: %1"

[mBarCPU]
Meter=Bar
MeterStyle=SysBar
MeasureName=CPUUsgValue
TransformationMatrix=-1; 0; -1; 1; 15; 0
X=-250
Y=37
W=200
H=15
DynamicVariables=1
As you can see, I've used notepad / notepad.exe to test if this works, so you would need to replace it with your Adobe Premiere Pro's window name, and also to put your desired X/Y values for skin movement in the relevant bangs. You should also be aware that in some programs (Premiere Pro is probably one of them), the name of the window changes according to the file being opened with that program (so if you have a movie.mp4 video opened, the name of the window will be something like Adobe Premiere Pro - movie.mp4). If that's the case, some "cosmetic" changes should be made in the 2 options where you now see notepad / notepad.exe, in order to still trigger the actions if you, say, load a different video in Premiere Pro. Normally, a Adobe Premiere Pro.* (where .* is the regex equivalent for "any character, taken any number of times") should be enough to solve it (if that's the "base" name - aka the part that doesn't change with a different video opened - of the Premiere Pro window, that is).

In other words, just like when I posted the last time, you'd have to adapt the code to your needs. This shouldn't be too hard, considering you did just fine last time when we went down this road. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
bukashka59
Posts: 6
Joined: March 2nd, 2020, 6:26 am

Re: Help with Hiding/Showing Skin with Active Opened Program

Post by bukashka59 »

again thank you Yincongnito, ive tried to use what you gave me, unfortunately makes my system a bit unresponsive and looking at taskmanager rainmeter goes to 3.5% ofcpu use... and thats 18core &4.5ghz..... also it doesnt show any values for cpu usage or top program thats using that cpu....as well as made all texts black.....

Seems like its not the best way to go about this as its taking too much of the resources...