我试图在Wirecast中打开媒体文件的脚本。 我想打开特定文件夹中的所有文件,如Wirecast" shot"。
根据Wirecast Dictionary,添加镜头的applescript命令语法是:
AddShotWithMedia 图层与posix_path 任何
我无法弄清楚如何获取文件夹中所有文件的posix路径列表,或者将applescript路径转换为Wirecast可接受的posix路径。
以下是代码:
tell application "Finder"
set SettingsFolder to folder "WirecastMedia" of home
set MediaFolder to folder "Titles" of SettingsFolder
set TitleList to entire contents of MediaFolder
end tell
tell application "Wirecast"
activate
set myFile to (file "KorgWirecast.wcst" of SettingsFolder)
open myFile as alias
set myDoc to last document
set myLayer to the layer named "Titles" of myDoc
repeat with aFile in TitleList
AddShotWithMedia myLayer with posix_path aFile
end repeat
end tell
...它在 AddShotWithMedia 行中失败并显示以下消息:
Can’t make «class docf» "ManyVoicesSuper.png" of «class cfol» "Titles"
of «class cfol» "WirecastMedia" of «class cfol» "ram" of «class cfol»
"Users" of «class sdsk» of application "Finder" into the expected type.
答案 0 :(得分:4)
file "ManyVoicesSuper.png of folder "Titles" ... of application "Finder"
是Finder对该文件的引用。你需要的是一个POSIX路径形式的字符串。我注意到你正在使用包含子文件夹的entire contents
文件夹,但是如果你只需要从顶层文件夹中获取文件,你可以像这样使用系统事件:
tell application "System Events"
set TitleList to POSIX path of disk items of folder "~/WirecastMedia/Titles"
end tell