It is currently April 26th, 2024, 10:55 pm

Using a variable in !ActivateConfig bang

Get help with creating, editing & fixing problems with skins
al97729
Posts: 8
Joined: January 31st, 2017, 3:18 pm

Using a variable in !ActivateConfig bang

Post by al97729 »

Hello,

I am currently trying to create my own skin using Rainmeter, i have been doing quite well until I hit a problem. For some reason it will not let me use a variable in the ActivateConfig bang. Here is the code:

OnRefreshAction=[!ActivateConfig "#AppsLocation#\Game" "Game.ini"]

Value of AppsLocation = D:\Rainmeter\Skins\GameBar\Apps\

Location of config I am attempting to activate = D:\Rainmeter\Skins\GameBar\Apps\Game\Game.ini

When i use the line:
OnRefreshAction=[!ActivateConfig "\GameBar\Apps\Game\" "Game.ini"]

It does work, but when I add the variable, it doesn't work anymore, could anyone please help me with this problem?

I have also tried lines:
OnRefreshAction=[!ActivateConfig #AppsLocation#\Game "Game.ini"]
OnRefreshAction=[!ActivateConfig #AppsLocation#"\Game" "Game.ini"]

But neither work.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using a variable in !ActivateConfig bang

Post by jsmorley »

!ActivateConfig doesn't use a full "path" to the config / skin you want to load, but the "config name" as the first parameter, and the skin .ini file name as the second.

https://docs.rainmeter.net/manual/skins/#Config

So the value of AppsLocation should just be GameBar\Apps

And then:

OnRefreshAction=[!ActivateConfig "#AppsLocation#\Game" "Game.ini"]

Should work.

It will then resolve to:

OnRefreshAction=[!ActivateConfig "GameBar\Apps\Game" "Game.ini"]
al97729
Posts: 8
Joined: January 31st, 2017, 3:18 pm

Re: Using a variable in !ActivateConfig bang

Post by al97729 »

Thank you, is there any way to trim a path down in order to get just the config folder?

I am using the FileView plugin; this retrieves the entire path of the folder and i am unsure how/if i can convert that to just the config folder.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using a variable in !ActivateConfig bang

Post by jsmorley »

It will need to be something like this:

Code: Select all

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

[MeasureFileView]
Measure=Plugin
Plugin=FileView
Path="#SKINSPATH#"
Recursive=2
Count=1
ShowDotDot=0
ShowFolder=0
ShowHidden=0
ShowSystem=0
Extensions=ini

[MeasureSkin1Config]
Measure=Plugin
Plugin=FileView
Path=[MeasureFileView]
Type=PathToFile
Index=1
RegExpSubstitute=1
Substitute="#SKINSPATH#":"","^(.*)\\$":"\1"

[MeasureSkin1Name]
Measure=Plugin
Plugin=FileView
Path=[MeasureFileView]
Type=FileName
Index=1

[MeterSkin1]
Meter=String
MeasureName=MeasureSkin1Config
MeasureName2=MeasureSkin1Name
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Config: [MeasureSkin1Config]#CRLF#Skin: [MeasureSkin1Name]
LeftMouseUpAction=[!ActivateConfig "[MeasureSkin1Config]" "[MeasureSkin1Name]"]
DynamicVariables=1
Note that I use a regular expression in the Substitute to remove the final trailing "\" character from the path we end up with as the "config name". !ActiveateConfig won't like the trailing "\".
al97729
Posts: 8
Joined: January 31st, 2017, 3:18 pm

Re: Using a variable in !ActivateConfig bang

Post by al97729 »

I have just used that code (the updated version) and it works for getting the path of the skins folder and the config folder seperately. But strangely, it doesn't get the correct config folder... My config folder is called "GameBar\Apps" and it gives me the config folder of a folder called, "Illustro\Disk". What is the reason for this? I cannot seem get it to change to any other config folder.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using a variable in !ActivateConfig bang

Post by jsmorley »

al97729 wrote:I have just used that code (the updated version) and it works for getting the path of the skins folder and the config folder seperately. But strangely, it doesn't get the correct config folder... My config folder is called "GameBar\Apps" and it gives me the config folder of a folder called, "Illustro\Disk". What is the reason for this? I cannot seem get it to change to any other config folder.
You are going to have to play around with FileView. The issue in this case is that when you search for ".ini" files with Recursive=2 in the C:\Users\YourName\Documents\Rainmeter\Skins folder, it will sort the results by name, but based on the name on the .ini file, NOT the name of the folder(s) it is in. I'm sure that since Illustro\Disk has a .ini file: 1 Disk.ini, that number is causing it to sort to the top.

I think you are going to want to add some specificity to the Path you are using, and perhaps use Recursive=1 instead of Recursive=2. I'm not an expert on FileView, but I'm sure there is a way to get there...
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Using a variable in !ActivateConfig bang

Post by fonpaolo »

Usually, the path to your skins is in:
C:\Users\YourUserName\Documents\Rainmeter\Skins\
Rainmeter program is in:
C:\Program Files\Rainmeter\
...and yours?

edit to add: your path is D:\Rainmeter\Skins\GameBar\Apps\
al97729
Posts: 8
Joined: January 31st, 2017, 3:18 pm

Re: Using a variable in !ActivateConfig bang

Post by al97729 »

Thank you for the help. I have tried other numbers on the recursive option, but any number other than 2 results in nothing at all, no path to anything. You have given me a great start to solving my issue though, thank you.
al97729
Posts: 8
Joined: January 31st, 2017, 3:18 pm

Re: Using a variable in !ActivateConfig bang

Post by al97729 »

The path to my rainmeter and skin folder is different because i did not install rainmeter in the default location. I do not install any programs on my C drive, they all go on my D drive, and games go on my Z drive.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using a variable in !ActivateConfig bang

Post by jsmorley »

al97729 wrote:The path to my rainmeter and skin folder is different because i did not install rainmeter in the default location. I do not install any programs on my C drive, they all go on my D drive, and games go on my Z drive.
That doesn't matter. #SKINSPATH# will still be correct.