AppleScript中选择文件的文件夹路径

AppleScript中选择文件的文件夹路径,applescript,filesplitting,Applescript,Filesplitting,我正在创建使用shell脚本转换mp3文件的简单脚本。我决定使用applescript自动转换。 基本上,我正在做的是选择mp3文件,然后使用命令行分割该文件,我想创建一个文件所在的文件夹(脚本将为我创建该文件夹) 现在我只需要弄清楚如何获得文件文件夹的路径。 在applescript中如何实现这一点 以下是我到目前为止的脚本: set mp3FileToSplit to choose file without invisibles set thepath to mp3FileToSplit a

我正在创建使用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
现在,该脚本所做的是在我的硬盘根目录上创建文件夹,我需要在文件所在的文件夹中

任何帮助都将不胜感激

tell application "Finder"
    set f to POSIX file "/private/etc/" as alias
    POSIX path of ((folder of f) as alias) -- /private/
end tell

do shell script "dirname /private/etc/" -- /private