3

我正在尝试编写在 Wirecast 中打开媒体文件的脚本。我想将特定文件夹中的所有文件作为 Wirecast“镜头”打开。

根据 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.
4

1 回答 1

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
于 2013-10-10T17:56:44.263 回答