2

I have a FileMaker Pro database of music files which uses AppleScript to pass it's search results into an iTunes playlist.

I would like to use VLC instead of iTunes to play the audio files since I have a number of FLAC files which iTunes will not play.

I haven't been able to figure out how to pass the AppleScript results to VLC. It's easy to use AppleScript to get VLC to play a folder of music using:

tell application "VLC"
    OpenURL "file:///Volumes/NoDoubt/Music/Rock Pop/PQR/Pink Floyd/Wish You Were Here/"
    play
end tell

However, if I wanted to instead play a mix of songs from a variety of folders I need to be able to insert each file path into the VLC player.

This is what the AppleScript returned search results from FileMaker Pro looks like:

{"NoDoubt:Music:Rock Pop:ABC:The Beatles:Abbey Road:01_come_together_alac.m4a", "NoDoubt:Music:Rock Pop:DEF:Fleetwood Mac:Rumours:01_second_hand_news_alac.m4a", "NoDoubt:Music:Rock Pop:MNO:Van Morrison:hymns_to_the_silence_disc_1:1-02_i'm_not_feeling_it_anymore_alac.m4a", "NoDoubt:Music:Rock Pop:PQR:Pink Floyd:Wish You Were Here:04_wish_you_were_here_alac.m4a"}

How can I pass the search results of these individual tracks to VLC to play?

3
  • If you can get POSIX paths, you can just open them, no conversions are necessary.
    – red_menace
    Commented Apr 10, 2019 at 20:51
  • You could and should convert the FLAC to mp3, keeping the FLAC as backup if you want, then playing mp3 audio as you like. You’d not only be able to play the playlists in iTunes, but VLC could duplicate the playlists straight out of iTunes. Also, VLC is scriptable from both bash and Lua, in case FileMaker can send search results to VLC by way of a shell script. I don’t use the program myself, but my guess is it would probably be able to and be better in some ways than AppleScript, which VLC doesn’t really maintain.
    – CJK
    Commented Apr 17, 2019 at 15:39
  • Another posit: FileMaker, if it lives up to its name, can hopefully use its search results to create temporary (even hidden if you like) folder, and create alias or symlink files pointing to the songs that are in its search results. This would be a neat way to keep a live updated folder with music tracks changed in response to FM, and keeping VLC updated by way of an AppleScript folder action. I’m liking this idea the more I think about what it could do.
    – CJK
    Commented Apr 17, 2019 at 15:42

1 Answer 1

1

This AppleScript code works for me using the latest version of macOS Mojave.

As a side note, I understand your list is generated from searching a FileMaker database. However, I do not have that application nor do I know what your code is to search the database file, so I "hard coded" the file list just for example purposes.

set theSongs to {"NoDoubt:Music:Rock Pop:ABC:The Beatles:Abbey Road:01_come_together_alac.m4a", ¬
    "NoDoubt:Music:Rock Pop:DEF:Fleetwood Mac:Rumours:01_second_hand_news_alac.m4a", ¬
    "NoDoubt:Music:Rock Pop:MNO:Van Morrison:hymns_to_the_silence_disc_1:1-02_i'm_not_feeling_it_anymore_alac.m4a", ¬
    "NoDoubt:Music:Rock Pop:PQR:Pink Floyd:Wish You Were Here:04_wish_you_were_here_alac.m4a"}

set theSongsAlias to {}

repeat with thisSong in theSongs
    set end of theSongsAlias to alias thisSong
end repeat

tell application "VLC" to open theSongsAlias
1
  • This AppleScript works as well as the suggestion from user3439894. Since the results will always be different because they are FileMaker Pro search results, what you need to add instead of the code at the top set theSongs to {"NoDoubt... is set theSongs to result and it will work. One issue that comes up is that VLC sorts the song list instead of just adding them in the order of the search results. This script also works with Vox which is a dedicated music player that plays FLAC files as well.
    – Joe
    Commented Apr 11, 2019 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .