- Posts: 7
- Joined: Mon Jul 12, 2021 10:35 pm
- Real Name: Clayton Beutler
Hello,
I am attempting to search through all of the subfolders inside of my root folder for a clip named "WIF_FA21_1.mov" and append frames "244710" through "422920" to the timeline. However, my Lua script encounters an error whenever my media pool contains any audio items. This is the current Lua script that I'm trying:
The script does what I want it to do until I add a ".aif" file into the media pool; then the script encounters an error before it can reach the folder that the "WIF_FA21_1.mov" clip is inside. This is the error that it spits out:
Can someone please help me to understand why introducing the ".aif" file into the mix keeps the script from working? I would imagine the equivalent python script breaks for the same reason, so if anyone has advice for a python script that performs the same function (but is able to pass through mixed media files without the "nil value" error) that would be much appreciated.
Thank you
I am attempting to search through all of the subfolders inside of my root folder for a clip named "WIF_FA21_1.mov" and append frames "244710" through "422920" to the timeline. However, my Lua script encounters an error whenever my media pool contains any audio items. This is the current Lua script that I'm trying:
- Code: Select all
resolve = Resolve()
projectManager = resolve:GetProjectManager()
project = projectManager:GetCurrentProject()
mediaPool = project:GetMediaPool()
rootFolder = mediaPool:GetRootFolder()
folders = rootFolder:GetSubFolderList()
-- Go through all folders (in first sublevel)
for folderIndex in pairs(folders) do
folder = folders[folderIndex]
curFolder = folder:GetName()
print(curFolder)
if curFolder ~= "" then
-- Go through all clips in folders
clips = folder:GetClips()
for clipIndex in pairs(clips) do
clip = clips[clipIndex]
videoFormat = clip:GetClipProperty()["Format"]
videoName = clip:GetClipProperty()["Clip Name"]
if videoFormat ~= "AIFF" then
if videoName == "WIF_FA21_1.mov" then
subClip = {}
subClip["mediaPoolItem"] = clip
subClip["startFrame"] = 422710
subClip["endFrame"] = 422920
if mediaPool:AppendToTimeline({ subClip }) then
print("Successfully found and added clip"" .. clip:GetName() .. "\" to current timeline.")
end
end
end
end
end
end
The script does what I want it to do until I add a ".aif" file into the media pool; then the script encounters an error before it can reach the folder that the "WIF_FA21_1.mov" clip is inside. This is the error that it spits out:
- Code: Select all
...script.lua:20: attempt to index a nil value
Can someone please help me to understand why introducing the ".aif" file into the mix keeps the script from working? I would imagine the equivalent python script breaks for the same reason, so if anyone has advice for a python script that performs the same function (but is able to pass through mixed media files without the "nil value" error) that would be much appreciated.
Thank you