Applescript to play videos in vlc

applescriptvideovlc

Hello I am trying to run an applescript that will launch VLC media player and play all the files in a folder whenever a new file is added. It seemed to work fine initially then I restarted my computer and not it wont run. I am running the script as a folder Action. please see attached script. What am I missing?

on adding folder items to theAttachedFolder after receiving theNewItems
-- Get the name of the attached folder

-- Get List of files in folder  
    set the_files to get every file of theAttachedFolder

-- open vlc using files in folder which should result in a vlc playlist 
of all files in folder

    tell application "Finder" to open {the_files} using application 
    file "VLC.app"


end adding folder items to

Any help will be greatly appreciated, I'm pretty new to this.
Thank you.

Best Answer

on adding folder items to this_folder after receiving these_items
    tell application "VLC"
        set thePlaylist to "file:///Users/Smokestack/Desktop/For Vlc" -- substitute with your own actual folder path to the folder action folder following the format “file:///“
        OpenURL thePlaylist
    end tell
end adding folder items to