AppleScript 中选择文件的文件夹路径
我正在创建简单的脚本来使用 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
现在该脚本的作用是在我的硬盘驱动器的根目录上创建文件夹,并且我需要位于该文件所在的文件夹中。
任何帮助将不胜感激。
I'm creating simple script to convert mp3 files using shell script. I decided to automate my conversion using applescript.
Basically what I'm doing is selecting mp3 file then splitting that file using my command line and i want to create a folder where the file is located (script will create that for me).
Now I just need to figure out how to get a path to a folder of the file.
How do I do that in applescript?
Here is the script that I have so far:
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
Right now what that script does is creating folder on the root of my hard drive and I need to be in the folder where the file is located.
Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或者
Or