更改为 MacBook Pro M1 后工作流程停止工作
Workflow stopped working after changing to MacBook Pro M1
当我升级到 MacBook Pro M1 时,工作流停止工作时出现问题。
此工作流程用作 Finder 文件中的快速操作。首先,我直接从 Automator 尝试 运行ning,令我惊讶的是它有效,然后再次尝试快速操作但不起作用。我已经在 Internet 上搜索了一个多月并尝试了不同的方法,但无法通过“快速操作”使其再次起作用。
为了便于解释,我只提取了有问题的代码。目的是获取电影文件的大小。以下代码在 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) 创建的文件列表有些不同。
知道为什么会这样吗?
我无法在我的机器上复制你的问题,所以我不能确定哪里出了问题。但这是对脚本的 'best practices' 修改。看看能不能解决你的问题。
on run {input, parameters}
-- always use System Events, not the Finder, where possible
tell application "System Events"
repeat with thisFolder in input
set existingMovies to (every file of thisFolder)
repeat with movie in existingMovies
-- dereference properties with 'get'
set theMovie to the (quoted form of (get POSIX path of movie))
set movieSize to do shell script "/usr/bin/mdls -name kMDItemDurationSeconds -raw -nullMarker 0 " & theMovie
end repeat
end repeat
end tell
return input
end run
当我升级到 MacBook Pro M1 时,工作流停止工作时出现问题。 此工作流程用作 Finder 文件中的快速操作。首先,我直接从 Automator 尝试 运行ning,令我惊讶的是它有效,然后再次尝试快速操作但不起作用。我已经在 Internet 上搜索了一个多月并尝试了不同的方法,但无法通过“快速操作”使其再次起作用。
为了便于解释,我只提取了有问题的代码。目的是获取电影文件的大小。以下代码在 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) 创建的文件列表有些不同。
知道为什么会这样吗?
我无法在我的机器上复制你的问题,所以我不能确定哪里出了问题。但这是对脚本的 'best practices' 修改。看看能不能解决你的问题。
on run {input, parameters}
-- always use System Events, not the Finder, where possible
tell application "System Events"
repeat with thisFolder in input
set existingMovies to (every file of thisFolder)
repeat with movie in existingMovies
-- dereference properties with 'get'
set theMovie to the (quoted form of (get POSIX path of movie))
set movieSize to do shell script "/usr/bin/mdls -name kMDItemDurationSeconds -raw -nullMarker 0 " & theMovie
end repeat
end repeat
end tell
return input
end run