Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shenti

macrumors newbie
Original poster
Dec 4, 2015
4
1
Hi there!

I'm a complete AppleScript newbie. The only reason I'm trying to use it now is because I want to use VLC as my alarm clock to wake me up with a set playlist and volume every morning. The simplest way I've found on Google to do this is to make iCal run a script. I found a script for iTunes online and modified it a bit to suit my needs:

tell application "VLC (2.0.3)"
activate
set
sound volume to 100
play "/Users/Adriana/Desktop/Favs.m3u"
end tell

(Favs.m3u is the name of the playlist I want it to play and it's located on my desktop. The volume I want will be very high, but I might have to experiment with this because I don't want to wake up with a heart attack :p )

When I run the script I get this error:

error "The variable volume is not defined." number -2753 from "volume"

Can anyone tell me what I'm doing wrong, i.e. correct the script so I can use it? I'm using OSX 10.7.5 if that helps.

I know eventually I would like to learn AppleScript, but right now I'm just looking for he quick fix to start using VLC as my alarm... Any help would be nice :)
 

shenti

macrumors newbie
Original poster
Dec 4, 2015
4
1
This is what you want (assuming you want the volume at 100%).

Code:
set volume output volume 100

Thanks Weaselboy. It kind of worked, but the file is not opening. I get this from VLC: see attached image


If I choose the right file through that VLC window then it opens at the right volume, but I need it to open directly from iCal so it can work as an alarm... any ideas on what else could be wrong? Code looks like this:

tell application "VLC (2.0.3)"
activate
set volume
output volume 100
play "/Users/Adriana/Desktop/Favs.m3u"
end tell
 

Attachments

  • 2015-12-11 01.13.44 pm.jpg
    2015-12-11 01.13.44 pm.jpg
    94.1 KB · Views: 297

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,136
15,598
California
From looking at the Applescript documentation for VLC, it looks like you have to tell it what file/playlist to open before playing. So I think this would work.

Code:
tell application "VLC"
  OpenURL "file://~/Desktop/test/Favs.m3u"
  play
end tell
 

shenti

macrumors newbie
Original poster
Dec 4, 2015
4
1
From looking at the Applescript documentation for VLC, it looks like you have to tell it what file/playlist to open before playing. So I think this would work.

Code:
tell application "VLC"
  OpenURL "file://~/Desktop/test/Favs.m3u"
  play
end tell
hmmm I don't get the window anymore but an error from VLC... see attached image
 

Attachments

  • 2015-12-11 03.00.24 pm.jpg
    2015-12-11 03.00.24 pm.jpg
    140 KB · Views: 267

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
Try :

Code:
set myPlaylist to choose file
tell application "VLC"
open myPlaylist
--or without the set myPlaylist statement
--open alias "path:to:your:playlist:whatever.m3u"
end tell
 
  • Like
Reactions: shenti

shenti

macrumors newbie
Original poster
Dec 4, 2015
4
1
Thanks for all the help Weaselboy! I took your tips and at the beginning they didn't work: I got the playlist to open but not to play. Then I had the crazy idea of breaking up the command into smaller pieces and it worked! In the end the script looks like this:

tell application "VLC (2.0.3)"
activate
set volume
output volume 40
end tell

tell application "VLC (2.0.3)"
open "/Users/Adriana/Desktop/Favs.m3u"
end tell

tell application "VLC (2.0.3)"
play "/Users/Adriana/Desktop/Favs.m3u"
end tell

I have no idea why this is because I'm a complete beginner in Apple Script, but I'm really happy I can use my iCal as a personalized alarm clock now :)

Thanks again!! :)
 
  • Like
Reactions: Weaselboy
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.