It is currently March 29th, 2024, 12:46 pm

Hardcoding @Resources

Get help with creating, editing & fixing problems with skins
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Hardcoding @Resources

Post by David8192 »

I wrote the code like this:

Code: Select all

[PlayOn]
Meter=Image
X=340
Y=r
ImageName=#@#Images\Bar
LeftMouseUpAction=[!WriteKeyValue PlayOff ImageName "#@#Images\noBarG"][!WriteKeyValue PlayOn ImageName "#@#Images\Bar"][!WriteKeyValue Variables Update "100" #@#Variables.inc][!Refresh]
UpdateDivider=-1

[PlayOff]
Meter=Image
X=R
Y=r
ImageName=#@#Images\noBarG
LeftMouseUpAction=[!WriteKeyValue PlayOn ImageName "#@#Images\BarG"][!WriteKeyValue PlayOff ImageName "#@#Images\nobar"][!WriteKeyValue Variables Update "-1" #@#Variables.inc][!Refresh]
UpdateDivider=-1
After left clicking, it rewrites to this:

Code: Select all

[PlayOn]
Meter=Image
X=340
Y=r
ImageName=C:\Users\DDDD\Documents\Rainmeter\Skins\David\Neonite_Blue\@Resources\Images\Bar
LeftMouseUpAction=[!WriteKeyValue PlayOff ImageName "#@#Images\noBarG"][!WriteKeyValue PlayOn ImageName "#@#Images\Bar"][!WriteKeyValue Variables Update "100" #@#Variables.inc][!Refresh]
UpdateDivider=-1

[PlayOff]
Meter=Image
X=R
Y=r
ImageName=C:\Users\DDDD\Documents\Rainmeter\Skins\David\Neonite_Blue\@Resources\Images\noBarG
LeftMouseUpAction=[!WriteKeyValue PlayOn ImageName "#@#Images\BarG"][!WriteKeyValue PlayOff ImageName "#@#Images\nobar"][!WriteKeyValue Variables Update "-1" #@#Variables.inc][!Refresh]
UpdateDivider=-1
I feel that the hardcoding of the path makes such meters hard to access if the skin is installed on another system. It has lingered for a couple of ages. Can this be altered?
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hardcoding @Resources

Post by balala »

David8192 wrote: December 5th, 2021, 2:59 pm I feel that the hardcoding of the path makes such meters hard to access if the skin is installed on another system. It has lingered for a couple of ages. Can this be altered?
Yep, it definitely can be. Modify the bangs as it follows:

Code: Select all

[PlayOn]
Meter=Image
X=340
Y=r
ImageName=#@#Images\Bar
LeftMouseUpAction=[!WriteKeyValue PlayOff ImageName "#*@*#Images\noBarG"][!WriteKeyValue PlayOn ImageName "#*@*#Images\Bar"][!WriteKeyValue Variables Update "100" "#@#Variables.inc"][!Refresh]
UpdateDivider=-1

[PlayOff]
Meter=Image
X=R
Y=r
ImageName=#@#Images\noBarG
LeftMouseUpAction=[!WriteKeyValue PlayOn ImageName "#*@*#Images\BarG"][!WriteKeyValue PlayOff ImageName "#*@*#Images\nobar"][!WriteKeyValue Variables Update "-1" "#@#Variables.inc"][!Refresh]
UpdateDivider=-1
As you can see I did here two modificationy:
  • I replaced the #@# variable by #*@*#. Here is a should description on why this has to be done.
  • I added quotes around the #@#Variables.inc parameter in the last bangs of both LeftMouseUpAction options. There might be cases when the parameter does work even not quoted, however it is a good idea to add them, because if it happens to have a space in the whole parameter (and in most cases it happens, there are few cases when it doesn't), the not-quoted parameter will fail.
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Hardcoding @Resources

Post by David8192 »

balala wrote: December 5th, 2021, 3:13 pm Yep, it definitely can be. Modify the bangs as it follows:

Code: Select all

[PlayOn]
Meter=Image
X=340
Y=r
ImageName=#@#Images\Bar
LeftMouseUpAction=[!WriteKeyValue PlayOff ImageName "#*@*#Images\noBarG"][!WriteKeyValue PlayOn ImageName "#*@*#Images\Bar"][!WriteKeyValue Variables Update "100" "#@#Variables.inc"][!Refresh]
UpdateDivider=-1

[PlayOff]
Meter=Image
X=R
Y=r
ImageName=#@#Images\noBarG
LeftMouseUpAction=[!WriteKeyValue PlayOn ImageName "#*@*#Images\BarG"][!WriteKeyValue PlayOff ImageName "#*@*#Images\nobar"][!WriteKeyValue Variables Update "-1" "#@#Variables.inc"][!Refresh]
UpdateDivider=-1
As you can see I did here two modificationy:
  • I replaced the #@# variable by #*@*#. Here is a should description on why this has to be done.
  • I added quotes around the #@#Variables.inc parameter in the last bangs of both LeftMouseUpAction options. There might be cases when the parameter does work even not quoted, however it is a good idea to add them, because if it happens to have a space in the whole parameter (and in most cases it happens, there are few cases when it doesn't), the not-quoted parameter will fail.
Awesomeeee!!!!!!!!!.
Thank you balala. It's perfect! I'll be off to the link as well to get more insight.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Hardcoding @Resources

Post by David8192 »

Okay. Confession. Up till this point, I had no idea what the use of escaping variables was. This is a good eye opener.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hardcoding @Resources

Post by balala »

David8192 wrote: December 5th, 2021, 3:41 pm Okay. Confession. Up till this point, I had no idea what the use of escaping variables was. This is a good eye opener.
I hope it's a little bit clearer now. Is it?
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Hardcoding @Resources

Post by David8192 »

balala wrote: December 5th, 2021, 4:18 pm I hope it's a little bit clearer now. Is it?
Yes. It is definitely clearer now. :bow:
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hardcoding @Resources

Post by balala »

David8192 wrote: December 5th, 2021, 5:55 pm Yes. It is definitely clearer now. :bow:
Great. :thumbup: