Applescript获取不带扩展名的文件名

Applescript获取不带扩展名的文件名,applescript,Applescript,我想获得文件夹中一个文件的名称,该文件的扩展名为mp4或mov,但不带扩展名,并将其放入变量中。在这个文件夹中有多个文件,但只有一个在mp4或mov中 现在,我所拥有的是: set _ext to {"mp4", "mov"} set _folder to "path_folder" tell application "Finder" set _name to name of every file of _folder whose name extension is in "_ext"

我想获得文件夹中一个文件的名称,该文件的扩展名为mp4或mov,但不带扩展名,并将其放入变量中。在这个文件夹中有多个文件,但只有一个在mp4或mov中

现在,我所拥有的是:

set _ext to {"mp4", "mov"}
set _folder to "path_folder"

tell application "Finder"
   set _name to name of every file of _folder whose name extension is in "_ext"
end tell

有人可以帮忙吗?

脚本中还有一些其他问题,请尝试此问题。它使用更具描述性的变量名,变量
baseName
包含结果,文件名不带扩展名

set allowedExtensions to {"mp4", "mov"}
set targetFolder to "path_folder"

tell application "Finder"
    try
        set {name:fileName, name extension:fileExtension} to first file of folder targetFolder whose name extension is in allowedExtensions
        set baseName to text 1 thru ((get offset of "." & fileExtension in fileName) - 1) of fileName
    on error
        display dialog "File not found" buttons {"Cancel"} default button 1
    end try
end tell

您好,我尝试了此操作,但它始终返回“未找到文件”,即使文件夹
targetFolder
中有扩展名正确的文件,也必须包含文件夹的完整HFS路径(以冒号分隔),或者该文件夹必须是桌面文件夹的子文件夹。外观如下:将targetFolder设置为“/Volumes/TRAVAIL/AUDIO/EN_-COURS/CONVERSION.BOUNCE/BOUNCE/”和文件位于文件夹BOUNCEI中,以冒号分隔:
“TRAVAIL:AUDIO:EN_-COURS:CONVERSION.BOUNCE:BOUNCE:”
(无卷前缀!)