It is currently May 26th, 2020, 9:08 am

Condition syntax and Read a File

Get help with installing and using Rainmeter.
evil_dark_lxs
Posts: 2
Joined: May 22nd, 2020, 4:05 am

Condition syntax and Read a File

Post by evil_dark_lxs »

I'm using a spotify skin, in the .ini I get
[Variables]
ARTIST = ***; (artist playing)

I've a folder with many artist named files (extension .vbs)
I want to open that files when the artist variable is equal to the one of the file inside that folder

How can I do it, I don't know how to use that variable in .lua
I was seeing this but I don't understand much using the variables
https://docs.rainmeter.net/snippets/read-write-file/


is what appears in this video, in the upper left, so that it changes automatically depending on what I'm listening to
https://www.youtube.com/watch?v=NX7ni1iftSo

PS: with MouseOverAction=!Execute ["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\#ARTIST#.vbs"], this works, but I want it to be automatic
mak_kawa
Posts: 641
Joined: December 30th, 2015, 9:47 am

Re: Condition syntax and Read a File

Post by mak_kawa »

Hi evil_dark_lxs

You should have a measure to get Artist name from Spotify. What if you set OnChangeAction= option to the measure? For example, OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\#ARTIST#.vbs"].

But honestly, I am not sure this action does work or not, because I can't actually examine your code... sorry if I am misunderstanding.

Ps. !Execute bang is deprecated in current Rainmeter.
evil_dark_lxs
Posts: 2
Joined: May 22nd, 2020, 4:05 am

Re: Condition syntax and Read a File

Post by evil_dark_lxs »

mak_kawa wrote:
May 23rd, 2020, 4:30 am
Hi evil_dark_lxs

You should have a measure to get Artist name from Spotify. What if you set OnChangeAction= option to the measure? For example, OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\#ARTIST#.vbs"].

But honestly, I am not sure this action does work or not, because I can't actually examine your code... sorry if I am misunderstanding.

Ps. !Execute bang is deprecated in current Rainmeter.
:D :D :D :D :D :D :D :D

it worked for me

thk u!!!!
User avatar
balala
Rainmeter Sage
Posts: 10587
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Condition syntax and Read a File

Post by balala »

mak_kawa wrote:
May 23rd, 2020, 4:30 am
You should have a measure to get Artist name from Spotify. What if you set OnChangeAction= option to the measure? For example, OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\#ARTIST#.vbs"].
Yes, but this is working only if there is a bang to set the artist as a variable, something like for instance OnChangeAction=[!SetVariable ARTIST "[MeasureArtist]"], on the measure returning the artist's name (in my example the name of this measure is [MeasureArtist]). Neither Rainmeter, nor the NowPlaying measure are not setting the ARTIST variable, which could be used into the above OnChangeAction.
mak_kawa
Posts: 641
Joined: December 30th, 2015, 9:47 am

Re: Condition syntax and Read a File

Post by mak_kawa »

Hi balala

Ah... you are right. I too was wondering where/how the variable ARTIST is set, but of course i don't know. So, I have assumed by definition that evil_dark_lxs specified/set the ARTIST variable somewhere in the skin.

My another idea is...OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\[MeasureArtist].vbs", direct reference of the measure value. Does this work??
User avatar
balala
Rainmeter Sage
Posts: 10587
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Condition syntax and Read a File

Post by balala »

mak_kawa wrote:
May 23rd, 2020, 11:47 pm
Ah... you are right. I too was wondering where/how the variable ARTIST is set, but of course i don't know. So, I have assumed by definition that evil_dark_lxs specified/set the ARTIST variable somewhere in the skin.
Yep, this is the problem with incomplete codes, like this. We don't know where and how the ARTIST variable is set. In fact I believe, it doesn't even have to be set, the [MeasureArtist] measure name can be used, instead of setting one more variable. Doesn't worth, at least for now. But there might be something in the complete code, which would require it? Well, we don't know...
mak_kawa wrote:
May 23rd, 2020, 11:47 pm
My another idea is...OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\[MeasureArtist].vbs", direct reference of the measure value. Does this work??
Yes, it probably does work, if you're closing the bracket, because it is missing, but is needed: OnChangeAction=["C:\Users\Alexis\Documents\Rainmeter\Skins\Effect\Music\[MeasureArtist].vbs"]. Otherwise it should work.
mak_kawa
Posts: 641
Joined: December 30th, 2015, 9:47 am

Re: Condition syntax and Read a File

Post by mak_kawa »

My mistake! :-)
User avatar
balala
Rainmeter Sage
Posts: 10587
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Condition syntax and Read a File

Post by balala »

mak_kawa wrote:
May 24th, 2020, 8:03 am
My mistake! :-)
Yep, but don't worry, it happens many times to all of us.