It is currently March 29th, 2024, 8:25 am

LeftMouseUpAction calling variables with space not working

Get help with creating, editing & fixing problems with skins
LolnationCH
Posts: 2
Joined: July 28th, 2019, 3:57 pm

LeftMouseUpAction calling variables with space not working

Post by LolnationCH »

Hello, I have a issue with when calling variables with space for the LeftMouseUpAction.

Sample of my .ini (shorten a lot)

Code: Select all

[Variables]
@Include=#@#shortcutlinks.inc
.
.
.
[ShortcutMenuIcon2]
Meter=Image
ImageName=#@#Images\icon2.png
LeftMouseUpAction=[#Shortcut2Link#][!ToggleMeterGroup SpyMissionMenu]
.
.
.
and my .inc

Code: Select all

Shortcut1Link="firefox.exe"
Shortcut1Text="Firefox"

Shortcut2Link="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"
Shortcut2Text="Visual Studio 2019"

Shortcut3Link="C:\ProgramData\Microsoft VS Code\Code.exe"
Shortcut3Text="VS Code"
Now, Firefox works flawless. Visual Studio 2019 does (apparently) nothing and vs code opens the ProgramData folder, which lead me to try doubling the backslash (nothing changed) and after backslashing my spaces (also not working).

Now, i found this post https://forum.rainmeter.net/viewtopic.php?t=13058 and they seems to be using the same code for the link execution (appart of the !Execute, which is deprecated https://docs.rainmeter.net/manual/bangs/).

I don't understand what I'm doing wrong...

Thanks in advance for your help!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LeftMouseUpAction calling variables with space not working

Post by jsmorley »

LolnationCH wrote: July 28th, 2019, 4:09 pm Hello, I have a issue with when calling variables with space for the LeftMouseUpAction.

Sample of my .ini (shorten a lot)

Code: Select all

[Variables]
@Include=#@#shortcutlinks.inc
.
.
.
[ShortcutMenuIcon2]
Meter=Image
ImageName=#@#Images\icon2.png
LeftMouseUpAction=[#Shortcut2Link#][!ToggleMeterGroup SpyMissionMenu]
.
.
.
and my .inc

Code: Select all

Shortcut1Link="firefox.exe"
Shortcut1Text="Firefox"

Shortcut2Link="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"
Shortcut2Text="Visual Studio 2019"

Shortcut3Link="C:\ProgramData\Microsoft VS Code\Code.exe"
Shortcut3Text="VS Code"
Now, Firefox works flawless. Visual Studio 2019 does (apparently) nothing and vs code opens the ProgramData folder, which lead me to try doubling the backslash (nothing changed) and after backslashing my spaces (also not working).

Now, i found this post https://forum.rainmeter.net/viewtopic.php?t=13058 and they seems to be using the same code for the link execution (appart of the !Execute, which is deprecated https://docs.rainmeter.net/manual/bangs/).

I don't understand what I'm doing wrong...

Thanks in advance for your help!

The problem is where you have the "quotes".

You have them on the variable in the .inc file:

Shortcut2Link="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"

But they don't help there. You don't ever need quotes on any option value in Rainmeter. They are just stripped off and ignored.

Shortcut2Link=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe

Where you DO need them is in bangs, if any of the bang parameters contain spaces.

LeftMouseUpAction=["#Shortcut2Link#"][!ToggleMeterGroup SpyMissionMenu]

A Primer on Quotes in Rainmeter
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction calling variables with space not working

Post by balala »

jsmorley wrote: July 28th, 2019, 4:13 pm LeftMouseUpAction=["#Shortcut2Link#"][!ToggleMeterGroup SpyMissionMenu]
Even if not absolutely required and not even needed, for me seems a good practice to get used to use quotations when posting measure / meter names as well. For instance instead of [!ToggleMeterGroup SpyMissionMenu] I'm always using [!ToggleMeterGroup "SpyMissionMenu"].
Again the bang written with no quotations works same way. It's just a matter of habit.
LolnationCH
Posts: 2
Joined: July 28th, 2019, 3:57 pm

Re: LeftMouseUpAction calling variables with space not working

Post by LolnationCH »

Perfect, it works now. Thanks to both of you!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction calling variables with space not working

Post by balala »

LolnationCH wrote: July 28th, 2019, 7:49 pm Thanks to both of you!
Thank jsmorley. I didn't help you, just had a comment. :stop:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LeftMouseUpAction calling variables with space not working

Post by jsmorley »

balala wrote: July 28th, 2019, 5:13 pm Even if not absolutely required and not even needed, for me seems a good practice to get used to use quotations when posting measure / meter names as well. For instance instead of [!ToggleMeterGroup SpyMissionMenu] I'm always using [!ToggleMeterGroup "SpyMissionMenu"].
Again the bang written with no quotations works same way. It's just a matter of habit.
I'm not sure I entirely agree with this. I think a better habit to get into is to never use spaces in measure or meter names.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction calling variables with space not working

Post by balala »

jsmorley wrote: July 28th, 2019, 9:15 pm I'm not sure I entirely agree with this. I think a better habit to get into is to never use spaces in measure or meter names.
Definitely. Not using spaces nor into measure, nor into meter names is definitely the best practice, but even if in the names are no spaces, including the names into quotations is still a good practice in my opinion, same as we add quotations to the number in a [!SetVariable MyVariable "0"] bang. The quotations are not needed nor here, but recommended to be used.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LeftMouseUpAction calling variables with space not working

Post by jsmorley »

balala wrote: July 29th, 2019, 9:38 am Definitely. Not using spaces nor into measure, nor into meter names is definitely the best practice, but even if in the names are no spaces, including the names into quotations is still a good practice in my opinion, same as we add quotations to the number in a [!SetVariable MyVariable "0"] bang. The quotations are not needed nor here, but recommended to be used.
There is no right or wrong approach for this really. I just make it a firm practice to never use spaces in any [SectionName] or Variable name, and since the static names of options never have spaces, I really only have to remember to quote any "values" I use in a bang. I don't quote section names or variable names or option names. This actually visually helps me see what is what in the bang.

[!SetOption SomeSection SomeOption "Some Value" "Some\Config"]

Having said that, you were entirely correct before. [!ToggleMeterGroup "SpyMissionMenu"] follows this rule, as SpyMissionMenu is a "value" and should really be quoted for consistency of approach.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction calling variables with space not working

Post by balala »

jsmorley wrote: July 29th, 2019, 10:53 am There is no right or wrong approach for this really. I just make it a firm practice to never use spaces in any [SectionName] or Variable name, and since the static names of options never have spaces, I really only have to remember to quote any "values" I use in a bang. I don't quote section names or variable names or option names. This actually visually helps me see what is what in the bang.

[!SetOption SomeSection SomeOption "Some Value" "Some\Config"]

Having said that, you were entirely correct before. [!ToggleMeterGroup "SpyMissionMenu"] follows this rule, as SpyMissionMenu is a "value" and should really be quoted for consistency of approach.
Yes, I think this is just a matter of habit. :great: