我正在编写一份Apple Script,最终将为从EyeTV导出的所有iTunes内容标记广告。但是我遇到了一个简单的问题,就是关于AppleScript路径的问题,这是由EyeTV应用程序返回的录制位置。以下是上下文:
set recordingID to 370404006
set myid to recordingID as integer
tell application "EyeTV"
set eyetvr_file to get the location of recording id myid as alias
end tell
return eyetvr_file
alias "Macintosh HD2:Documents:EyeTV Archive:South Park.eyetv:000000001613eaa6.eyetvr"
现在我需要提取包含路径和文件前缀000000001613eaa6(使用这个问题),以便我可以在文件000000001613eaa6.edl中查找相应的商业标记。但遇到了一个问题:
tell application "Finder"
set eyetv_path to container of eyetvr_file
set root_name to name of eyetvr_file
set fext to name extension of eyetvr_file
end tell
结果如下:
eyetv_path: 应用程序“Finder”中“Macintosh HD2”的“Documents”文件夹中的“EyeTV Archive”文件夹中的文档文件“South Park.eyetv”
root_name: “000000001613eaa6.eyetvr”
fext: “.eyetvr”,而不是空字符串。我要如何从eyetvr_file或root_name正确提取“.eyetvr”?我已经尝试了一堆技巧,例如
set fext to name extension of (eyetvr_file as document)
但是这会产生如下错误:
错误“无法将别名\"Macintosh HD2:Documents:EyeTV Archive:South Park.eyetv:000000001613eaa6.eyetvr”转换为文档类型。",错误编号为-1700,来自别名“Macintosh HD2:Documents:EyeTV Archive:South Park.eyetv:000000001613eaa6.eyetvr”