It is currently April 19th, 2024, 12:48 pm

Nesting square brackets in actions

Get help with creating, editing & fixing problems with skins
slartibartfast
Posts: 15
Joined: September 10th, 2012, 3:42 pm

Nesting square brackets in actions

Post by slartibartfast »

I'm pulling my hair out trying to figure out how to make this work. Every syntax variation I've experimented with fails. Basically what I want to do is dynamically choose at runtime what to execute in response to a mouse up event.

Here is the basic, non-dynamic version of what I want:

Code: Select all

LeftMouseUpAction=["[MeasureRSS1ItemLink01]"]
Now what I want to do is abstract to another level by generating the last two characters in the measure name from another measure. Logic tells me that I have to take the MeasureRSS1ItemLink01 and change it to something like MeasureRSS1ItemLink[OtherMeasure], resulting in code like:

Code: Select all

DynamicVariables=1
LeftMouseUpAction=["[MeasureRSS1ItemLink[OtherMeasure]]"]
I have [OtherMeasure] generating 01-50 correctly, but this code doesn't work. I wondered if MeasureRSS1ItemLink[OtherMeasure] needed an extra set of brackets to evaluate it before the next level up gets hold of it:

Code: Select all

LeftMouseUpAction=["[[MeasureRSS1ItemLink[OtherMeasure]]]"]
...but that doesn't do it either. I have spent two days poring over Rainmeter docs and these forums, trying every syntax variation with brackets and quotes I can think of, but I still can't figure out how to do this, or if Rainmeter can even manage it.

Any gurus out there who can help me?

Slarti
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Nesting square brackets in actions

Post by jsmorley »

No, you can't nest section names in a bang like that.

You can however nest a variable in a section name in a bang, so something like this:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
LinkVar=2

[MeasureLink1]
Measure=Time
Format=http://cnn.com

[MeasureLink2]
Measure=Time
Format=http://lifehacker.com

[Measure1or2]
Measure=Calc
Formula=Random
LowBound=1
HighBound=2
UpdateRandom=1

[MeterChoice]
Meter=Image
W=25
H=25
SolidColor=104,173,222,255
MouseOverAction=!SetVariable LinkVar [Measure1or2]
LeftMouseUpAction=["[MeasureLink#LinkVar#]"]
DynamicVariables=1
Would work. I have no idea how you are arriving at the number (represented by my little Measure1or2 fake with a random number) you are using, but you need to find some way to have it set the variable (in my example LinkVar) so the meter can dynamically use it.
Honimoura
Posts: 94
Joined: April 3rd, 2018, 11:15 am

Re: Nesting square brackets in actions

Post by Honimoura »

(I'm french, so, it's automatic traduction, sorry)

Hello,
I know that this subject is several years old but I have a problem of the same kind and I can not find a solution ...


I use 2 folder scan to list shortcuts and images with the same name. Basically to create icons that are named and is illustrated automatically according to what is in the scanned folders.

I managed to scan both folders, list files, match each shortcuts with their respective images.

But (always a but) I had to tamper with my research so that the results of scans shortcuts do not give their extentions to then be able to recover the name and search the image while indicating that it could s 'call either:
# # .jpg Image
# # .jpeg picture
# # .png picture
Until then it works.
So when I want to tell him that by clicking on the image of the shortcut it launches the shortcut it does not work because the shortcut is not called "shortcut.lnk" but just "shortcut" ...
So I tried them:

(With or without ! Execute dont work)

Code: Select all

LeftMouseUpAction=!Execute ["#Dossier#Raccourci1#lnk###"]

Code: Select all

LeftMouseUpAction=!Execute ["#Dossier##Raccourci1##lnk#"]
Dossier is path Folder <- Variable in this .ini
Raccourci is shortcut <- variable in another .ini
lnk is the extention <- variable in another ini


In short I tested all kinds of conbinaisons and I can not ... :17angry

A little help would save me well.
Thank you.
Last edited by Honimoura on April 3rd, 2018, 11:40 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Nesting square brackets in actions

Post by jsmorley »

Honimoura
Posts: 94
Joined: April 3rd, 2018, 11:15 am

Re: Nesting square brackets in actions

Post by Honimoura »

Thanks for your quick answer.
I have already looked and I do not know if the translation is erroned with google or if it is too complex but I tried with this tutorial and I did not succeed: s
Honimoura
Posts: 94
Joined: April 3rd, 2018, 11:15 am

Re: Nesting square brackets in actions

Post by Honimoura »

I tried :

Code: Select all

LeftMouseUpAction=[[#Dossier[#Raccourci1[#LNK]]]]
And even if it looks good to me it does not work either
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Nesting square brackets in actions

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Dossier=C:\MyPath\
Raccourci=MyShortcut
lnk=.lnk

[MeterTest]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[#Dossier][#Raccourci][#lnk]
LeftMouseUpAction=["[#Dossier][#Raccourci][#lnk]"]
1.png
Though to be honest, I don't see any "nesting" going on here... Just concatenating.
You do not have the required permissions to view the files attached to this post.
Honimoura
Posts: 94
Joined: April 3rd, 2018, 11:15 am

Re: Nesting square brackets in actions

Post by Honimoura »

I do not understand ... it does not work either.

Yet in text it displays well the right way, the good name and the good extention ...
To pull hair
Honimoura
Posts: 94
Joined: April 3rd, 2018, 11:15 am

Re: Nesting square brackets in actions

Post by Honimoura »

On the other hand it is not text to display but an image serving as an icon but I do not think it's a problem break
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Nesting square brackets in actions

Post by jsmorley »

Honimoura wrote:I do not understand ... it does not work either.

Yet in text it displays well the right way, the good name and the good extention ...
To pull hair
Try temporarily changing the mouse action to:

LeftMouseUpAction=[!Log "[#Dossier][#Raccourci][#lnk]"]

Then click the link. What does it say in the About / Log?