Page 1 of 1

Condition syntax and Read a File

Posted: May 22nd, 2020, 9:55 pm
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

Re: Condition syntax and Read a File

Posted: May 23rd, 2020, 4:30 am
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.

Re: Condition syntax and Read a File

Posted: May 23rd, 2020, 11:06 am
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!!!!

Re: Condition syntax and Read a File

Posted: May 23rd, 2020, 3:21 pm
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.

Re: Condition syntax and Read a File

Posted: May 23rd, 2020, 11:47 pm
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??

Re: Condition syntax and Read a File

Posted: May 24th, 2020, 5:11 am
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.

Re: Condition syntax and Read a File

Posted: May 24th, 2020, 8:03 am
by mak_kawa
My mistake! :-)

Re: Condition syntax and Read a File

Posted: May 24th, 2020, 8:04 am
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.