It is currently March 29th, 2024, 9:26 am

NirCmd Command Implimentation

Get help with creating, editing & fixing problems with skins
Laura44
Posts: 2
Joined: September 8th, 2017, 9:13 pm

NirCmd Command Implimentation

Post by Laura44 »

Hello! This is my first post so sorry for any odd wording choices.

So I'm currently working on a program that allows the use of links to either open a program or bring up its screen (using "windowskey+key1" to bring it up from the taskbar) so I am able to remove my taskbar completely for my desktop to look right.

I've tried to do this by creating a plugin measure to detect whether a program is running, and a bang to either run the program (currently chrome.exe) or use NirCmd's "sendkeypress" command to send lwin+1 and toggle open the program.
Both commands I have written work independently fine when placed after LeftMouseUpAction, and when the NirCmd command is replaced with a different program (such as notepad.exe), the whole program also works.

The problem is where the SetToggle bang is activated. Although it is set to change Command to the same bang that worked previously (Toggle), it will not work when clicked, and will instead run the Open command that it should have been changed from.

I've also tried replacing the !SetVariable bangs to !SetOption, and to make them change the LeftMouseUpAction directly, but that didn't work.

Here is my code, I would appreciate any help or advice I can get for this.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,1

[Variables]
;Two link options
Open=["Chrome.exe"]
Toggle=["C:\Program Files\NirCmd\NirCmd.exe" sendkeypress lwin+1]

SetOpen=[!SetVariable Command #Open#]
SetToggle=[!SetVariable Command #Toggle#]

;Command set to "open" on computer startup
Command=#Open#

[MeasureProcess]
Measure=Plugin
Plugin=Process
ProcessName=Chrome.exe

;Chrome not open
IfBelowValue=0
IfBelowAction=#SetOpen#

;Chrome open
IfAboveValue=0
IfAboveAction=#SetToggle#

[ChromeMeter]
;Currently text to show whether program is open for error testing
Meter=String
Text=[MeasureProcess]
AntiAlias=1
FontColor=255,255,255,255
FontFace=Dudu Calligraphy
FontSize=30
LeftMouseUpAction=#Command#
DynamicVariables=1
Last edited by jsmorley on September 8th, 2017, 9:41 pm, edited 1 time in total.
Reason: Changed to use [code][/code] tags.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: NirCmd Command Implimentation

Post by balala »

Sorry for the late reply.
First of all, are you sure if you write the ["C:\Program Files\NirCmd\NirCmd.exe" sendkeypress lwin+1] bang to the LeftMouseUpAction option of the [ChromeMeter] meter, it is working well? Because I couldn't get it to work. And I also couldn't if I wrote it to a command prompt.
So, first we would need to make it to work properly. Does it?
Laura44
Posts: 2
Joined: September 8th, 2017, 9:13 pm

Re: NirCmd Command Implimentation

Post by Laura44 »

It's okay, I'm glad to get one.

I have succeeded in running the program in cmd, hardcoded as part of an !Execute bang, and hardcoded as part of a runprogram plugin measure. The problem only occurs when I try to implement it as part of a dynamic variable system.

It doesn't work when I try to use !SetOption for the MouseUp in [ChromeMeter], nor for Program/Parameter in a [RunCommandMeasure], nor !SetVariable as a separate #Program# variable using DynamicVariables=1

I also tried splitting the program line up into the path and program as one variable, and the sendkeypress as another, nothing has worked.

I did at one point succeed in bringing up the NirCmd window as if I'd ran it without the sendkeypress message, but as soon as I tried implementing that, it stopped doing anything.