Delete / Overwrite file on download

Hi All

First let me say I can do this in automator, but it is unreliable about keeping time without me creating a calendar event for each hour, and sometimes even after it has run a number of times, it pops up its dialogue box saying you are running this for the first time and stalls everything.

The software that runs the AutoDJ prefers AppleScript (of which I know very little as you will probably see from the code snippet below)

Objective: Script to run every hour and download the relevant news file from suppliers server before playout

What’s in Place: I currently have automator doing the downloads, but its not as reliable as it needs to be, this script will be added to the News intro jingle track entry, the adding to top of playlist part of the code work perfectly (so its uncommented below - Jingle runs for 15 seconds

The Assistance I would appreciate: Ive been through the forums and I think I’ve cobbled together a script that should work if I take the comments out, but I am reluctant to test it, on the live machine which is the only one with RadioLogic installed so, could someone please check the code, correcting if necessary and advise?

I know (think) I have written for it to delete the file, but my preference would be for the script to simply overwrite the file on each download rather than having to delete the file first.

--Applescript to automatically download and update the 3Minute bulletin from FeatureStoryNews

--This Section Deletes the existing file without prompting
--tell application "Finder"
--delete file "/Users/mediacentre/Music/NewsFiles/FSNBulletin.mp3"
--end tell

--This Section DOWNLOADS NEW news file
--do shell script "curl -s 'http://www.fsnradionews.com/FSNNews/FSNBulletin.mp3' > /Users/mediacentre/Music/NewsFiles/FSNBulletin.mp3"

--This Section adds ShortNews To The Top Of The Playlist (This bit is currently working in when Automator successfully gets the file)
tell application "Radiologik DJ"
	AddFileToTopOfQueue "/Users/mediacentre/Music/NewsFiles/FSNBulletin.mp3"
end tell

Hope I’m not trying to do the impossible
Thanks in advance
Rich

Model: MacMini
AppleScript: ?
Browser: Safari 601.5.17
Operating System: Mac OS X (10.10)

Hi,

you don’t need to explicitly delete the file, cURL overwrites an existing file with the same path automatically.

This is a slightly different syntax

do shell script "curl -s -o /Users/mediacentre/Music/NewsFiles/FSNBulletin.mp3 'http://www.fsnradionews.com/FSNNews/FSNBulletin.mp3'"

To make the script portable use a relative path

set bulletinPath to POSIX path of (path to music folder) & "NewsFiles/FSNBulletin.mp3"
do shell script "curl -s -o " & quoted form of bulletinPath & space & "'http://www.fsnradionews.com/FSNNews/FSNBulletin.mp3'"

tell application "Radiologik DJ"
	AddFileToTopOfQueue bulletinPath
end tell