I have a series of compound clips in my library named with the syntax "sXXX TOP" where XXX is a 3-digit number, like s005 TOP, s011 TOP, s149 TOP, etc.
I also have a list of video clips named "sXXX SUBTITLE TRACK" in my library.
I would like to write a LUA script in CommandPost to automatically add the "sXXX SUBTITLE TRACK" to each corresponding "sXXX TOP" compound clip, above all other clips in the compound clip's timeline, at timecode 00:00:00 of the compound clip.
I would also like to apply a pre-programmed GreenScreen effect to that "sXXX SUBTITLE TRACK" clip once added to the compound clip (the effect can be copied from a BASE SUBTITLE TRACK clip present in a BASE TIMELINE compound clip).
Bottom line is: is it possible to do that in CommandPost ? I'm an expert programmer, but a beginner in CommandPost and LUA.
To test my installation, I tried running some of the sample action snippet. This one works:
-----------------------------------------
-- Select all even clips in Timeline
-----------------------------------------
cp.apple.finalcutpro:launch()
local clips = cp.apple.finalcutpro:timeline():contents():clipsUI()
table.sort(clips, function(a, b) return a.AXPosition.x < b.AXPosition.x end)
local evenClips = {}
for i, clip in ipairs(clips) do
if (i % 2 == 0) then
table.insert(evenClips, clip)
end
end
cp.apple.finalcutpro:timeline():contents():selectClips(evenClips)
But this doesn't work:
local fcp = require "cp.apple.finalcutpro"
fcp.preferencesWindow:show()
I get this error:
...ensions/cp/apple/finalcutpro/prefs/PreferencesWindow.lua:112: attempt to call a nil value (method 'mainMenuName')
stack traceback:
...ensions/cp/apple/finalcutpro/prefs/PreferencesWindow.lua:112: in method 'show'
[string "local fcp = require "cp.apple.finalcutpro"..."]:2: in main chunk
[C]: in function 'xpcall'
...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:546: in function <...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:522>
I tried this:
local allClips = cp.apple.finalcutpro.main.LibrariesBrowser:clips(function(clip)
return true
end) or {}
Getting this error:
[string "..."]:2: attempt to index a nil value (field 'main')
stack traceback:
[string "..."]:2: in main chunk
[C]: in function 'xpcall'
...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:546: in function <...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:522>
and this:
local browser = require("cp.apple.finalcutpro.main.LibrariesBrowser")
-- Use the 'clips' method with a filter function that returns true for every clip.
local allClips = browser:clips(function(clip)
return true
end) or {}
Getting this error:
...xtensions/cp/apple/finalcutpro/main/LibrariesBrowser.lua:388: attempt to call a nil value (method 'isListView')
stack traceback:
...xtensions/cp/apple/finalcutpro/main/LibrariesBrowser.lua:388: in method 'clips'
[string "local browser = require("cp.apple.finalcutpro..."]:3: in main chunk
[C]: in function 'xpcall'
...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:546: in function <...armProjects/CommandPost/src/extensions/hs/_coresetup.lua:522>
Originally posted by @jcmourey in #3393 (reply in thread)
I have a series of compound clips in my library named with the syntax "sXXX TOP" where XXX is a 3-digit number, like s005 TOP, s011 TOP, s149 TOP, etc.
I also have a list of video clips named "sXXX SUBTITLE TRACK" in my library.
I would like to write a LUA script in CommandPost to automatically add the "sXXX SUBTITLE TRACK" to each corresponding "sXXX TOP" compound clip, above all other clips in the compound clip's timeline, at timecode 00:00:00 of the compound clip.
I would also like to apply a pre-programmed GreenScreen effect to that "sXXX SUBTITLE TRACK" clip once added to the compound clip (the effect can be copied from a BASE SUBTITLE TRACK clip present in a BASE TIMELINE compound clip).
Bottom line is: is it possible to do that in CommandPost ? I'm an expert programmer, but a beginner in CommandPost and LUA.
To test my installation, I tried running some of the sample action snippet. This one works:
But this doesn't work:
I get this error:
I tried this:
Getting this error:
and this:
Getting this error:
Originally posted by @jcmourey in #3393 (reply in thread)