【发布时间】:2021-01-31 20:32:24
【问题描述】:
当我升级到 MacBook Pro M1 时,我遇到了一个工作流程停止工作的问题。 此工作流程用作 Finder 文件中的快速操作。首先,我尝试直接从 Automator 运行,令我惊讶的是它可以工作,然后再次尝试作为快速操作但不起作用。我已经在互联网上搜索了一个多月并尝试了不同的方法,但无法通过 Quick Action 使其再次起作用。
为了便于解释,我只提取了有问题的代码。目的是获取电影文件的大小。以下代码可在 Automator 中运行,但从快速操作运行时会出现错误:找不到文件。
tell application "Finder"
set existingMovies to (every file of theFolder) as alias list
end tell
repeat with movie in existingMovies
--repeat with movie in input
set theMovie to the (quoted form of POSIX path of movie) as string
set movieSize to do shell script "/usr/bin/mdls -name kMDItemDurationSeconds -raw -nullMarker 0 " & theMovie
end repeat
然后我尝试使用工作流的输入参数(在本例中为文件列表,因为此工作流使用“工作流接收当前:电影文件”)。使用这种方法,它既适用于 Automator,也适用于 Finder Action
repeat with movie in input
set theMovie to the (quoted form of POSIX path of movie) as string
set movieSize to do shell script "/usr/bin/mdls -name kMDItemDurationSeconds -raw -nullMarker 0 " & theMovie
end repeat
在所有情况下,我都使用同一个文件夹。 输入指定的文件列表似乎与我从指定文件夹(existingMovies)创建的文件列表有所不同。
知道为什么会这样吗?
【问题讨论】:
标签: applescript