Hello,
I’m still a bit of a novice with AppleScript and have been having some trouble getting what seems like a very simple folder action to work. I work in online interactive audio and want a simple automated process for converting newly exported hi-resolution audio files to the best low-bitrate setting available, which means using the LAME encoder via terminal with custom options.
Here’s my script that isn’t working:
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to (count of added_items)
if name of (item i of added_items) does not contain “mp3” then
set audioName to name of (item i of added_items)
do shell script “cd ~/Desktop/LAME/”
do shell script "lame -a --abr 32 -B40 " & audioName & ".wav " & audioName & “.mp3”
end if
end repeat
display dialog “All .WAV files have been encoded to .MP3”
end adding folder items to
When I drop a file into the folder nothing happens. After digging around in various forums and tutorials, I suspect something having to do with my shell script commands or my conditionals to avoid the folder action from being triggered by the output of the encoder, creating an endless loop!
Any help would be much appreciated!
thanks,
Wally