我正在创建简单的脚本来使用 shell 脚本转换 mp3 文件。我决定使用 applescript 自动化我的转换。基本上我正在做的是选择 mp3 文件,然后使用我的命令行拆分该文件,我想创建一个文件所在的文件夹(脚本将为我创建该文件夹)。
现在我只需要弄清楚如何获取文件文件夹的路径。我如何在applescript中做到这一点?
这是我到目前为止的脚本:
set mp3FileToSplit to choose file without invisibles
set thepath to mp3FileToSplit as text
set theposix to POSIX path of thepath
tell application "Finder" to set file_name to (name of mp3FileToSplit)
do shell script "/opt/local/bin/mp3splt -t 3.00 -d " & quoted form of file_name & " " & quoted form of theposix
现在该脚本所做的是在我的硬盘驱动器的根目录上创建文件夹,我需要位于文件所在的文件夹中。
任何帮助将不胜感激。