Reputation: 247
I'm trying to script the opening of media files in Wirecast. I want to open all of the files in a specific folder as Wirecast "shots".
According to the Wirecast Dictionary, the applescript command syntax to add a shot is:
AddShotWithMedia layer with posix_path anything
I can't figure out how to either get a list of posix paths to all the files in a folder, or alternatively, convert an applescript path to a posix path acceptable to Wirecast.
Here's the code:
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
...it fails on the AddShotWithMedia line with the message:
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.
Upvotes: 3
Views: 5285
Reputation: 3722
file "ManyVoicesSuper.png of folder "Titles" ... of application "Finder"
is a Finder reference to the file. What you need is a string in the form of a POSIX path. I notice you're using entire contents
of the folder, which includes subfolders, but if you only need to get files out of the top folder, you can use System Events like this:
tell application "System Events"
set TitleList to POSIX path of disk items of folder "~/WirecastMedia/Titles"
end tell
Upvotes: 4