It is currently April 25th, 2024, 2:52 pm

Play .wav file from LUA script

Discuss the use of Lua in Script measures.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Play .wav file from LUA script

Post by Mordasius »

I want a LUA script to play a sound when something happens and have tried

SKIN:Bang('!execute [PLAY NewFeed.wav]')

Problem is that it seems to play a default / error sound. What have I done wrong?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Play .wav file from LUA script

Post by Kaelri »

Have you upgraded to this week's 2.1 Beta? The PLAY bang was broken in the last one, but should now be fixed.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Play .wav file from LUA script

Post by Mordasius »

Kaelri wrote:Have you upgraded to this week's 2.1 Beta?.
Just uploaded Rainmeter-2.1-r912-beta but still get the same Bong! Bong! when the LUA script runs.

Is the SKIN:Bang('!execute [PLAY NewFeed.wav]') the command / statement I should be using?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Play .wav file from LUA script

Post by jsmorley »

You need the path to the .wav file.

CurrPath = SKIN:GetVariable("CURRENTPATH")
SKIN:Bang('PLAY '..CurrPath..'NewFeed.wav')

NO path is "relative" to the skin in a .lua file, and in any case the PLAY command requires a full filespec.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Play .wav file from LUA script

Post by Kaelri »

Mordasius wrote:Is the SKIN:Bang('!execute [PLAY NewFeed.wav]') the command / statement I should be using?
Or simply SKIN:Bang(PLAY NewFeed.wav).

It's not just you, though. I can't get PLAY to work either; looks like something's still broken on Rainmeter's end.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Play .wav file from LUA script

Post by jsmorley »

Kaelri wrote: Or simply SKIN:Bang(PLAY NewFeed.wav).

It's not just you, though. I can't get PLAY to work either; looks like something's still broken on Rainmeter's end.
http://forum.rainmeter.net/viewtopic.php?p=55478#p55478
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Play .wav file from LUA script

Post by Mordasius »

Thank you Kaelri and JS Morley - It will take me a day or two to catch up with your advice and suggestions, but I'm sure I'll get there in the end.

Many, Many Thanks to both of you.. :welcome:
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Play .wav file from LUA script

Post by Kaelri »

Whoops, sorry. Somehow I managed to completely miss your message.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Play .wav file from LUA script

Post by Mordasius »

This just seems to bring me back to this post. What have I done wrong?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Play .wav file from LUA script

Post by Kaelri »

He was linking me to the post he made right before mine, which I missed by being an idiot.