It is currently April 26th, 2024, 7:20 pm

Bangs as Variables and nirCmd

Get help with creating, editing & fixing problems with skins
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Bangs as Variables and nirCmd

Post by brijamelsh »

Hello

I'm trying to change a variable with nircmd. i know how to change a simple variable, but im trying to change a variable that contains a bang.

Variable:

Code: Select all

Bang=["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "MyColor" "GetUnderColor" "ColorTarget" "#IncFile#" "0"]
Action to change variable:

Code: Select all

LeftMouseDoubleClickAction=!Execute ["#ADDONSPATH#NirCmd\Nircmd.exe" inisetval "GetUnderColor.ini" "Variables" "Bang" "["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "Swatch1" "GetUnderColor" "ColorTarget" "#IncFile#" "0"]"]
This should work, no? However nircmd is not changing the variable.
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Bangs as Variables and nirCmd

Post by Alex2539 »

It's because of the quotation marks. Because one of your parameters includes quotation marks, it's screwing with the entire string. Here's what I mean:

You have this parameter:

Code: Select all

"["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "Swatch1" "GetUnderColor" "ColorTarget" "#IncFile#" "0"]"
Unfortunately, even though the entire thing is encased in quotation marks, the quotation marks inside are making it think that the string has ended prematurely. Instead of one string, it think you have several that look like this:

Code: Select all

"["
#ADDONSPATH#GetUnderColor\GetUnderColor.exe
" "
Swatch1
" "
GetUnderColor
" "
ColorTarget
" "
#IncFile#
" "
0
"]"
The only way around this right now is to separate all of the parameters that you want to store in the variable (ie: everything in quotation marks). Also, because the initial launch of the addon requires that you have quotation marks around the program path, as do the parameters, you will need to change how the Bang variable is being used. I presume that somewhere you have an action that looks something like this:

Code: Select all

SomethingAction=!Execute #Bang#
Instead, you're going to want to set #Bang# to just #ADDONSPATH#GetUnderColor\GetUnderColor.exe and then use it like this:

Code: Select all

SomethingAction=!Execute ["#Bang#" "#Param1" "#Param2#" "#Param3#" "#Param4#" "#Param5#"]
So each of the variables is encased in quotation marks without needing to include the marks within the variables themselves. Unfortunately, you're going to run into problems if you change the program you are running and it requires fewer parameters than that one.
ImageImageImageImage
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: Bangs as Variables and nirCmd

Post by brijamelsh »

Makes sense, thanks.

I ended up doing a sort of work around, but this might work better and make my code a litte cleaner.
lyonhart
Posts: 1
Joined: August 1st, 2010, 4:18 pm

Re: Bangs as Variables and nirCmd

Post by lyonhart »

can any one tell me how this code work??

Code: Select all

LeftMouseUpAction=!Execute ["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "MyColor" "GetUnderColor" "ColorTarget" "#IncFile#" "0"]
i mean in "GetUnderColor" "ColorTarget" "#IncFile#" "0"
because when it execute,it will be refresh all skins,so annoying.
hufht..
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: Bangs as Variables and nirCmd

Post by brijamelsh »

lyonhart wrote:can any one tell me how this code work??

Code: Select all

LeftMouseUpAction=!Execute ["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "MyColor" "GetUnderColor" "ColorTarget" "#IncFile#" "0"]
i mean in "GetUnderColor" "ColorTarget" "#IncFile#" "0"
because when it execute,it will be refresh all skins,so annoying.
hufht..
; !Execute ["#ADDONSPATH#GetUnderColor\GetUnderColor.exe" "parm1" "parm2" "parm3" "parm4" "parm5"]
1) Variable name you wish to set (ex: MyColor)
2) Name of the current Rainmeter Config (ex: Enigma\Sidebar)
3) Name of the meter displaying the "target" image (ex: ArrowMeter)
4) Path and name of the .inc or .ini file you wish modified (ex: #CURRENTPATH#UserVariables.inc
5) Return value in Hex: "1", RGB: "0"
I believe the skin refresh is done by the exe itself. The point of the plugin is to edit your uservariables.inc file, and have all of the skins use that variable, if they didn't refresh, the color wouldn't be used.

You might want to head over to the plugins forum and post in the plugins thread, might be of more help.