I am trying to get an xml from FCP to list the .mov files in an edit sequence. Its listed in the xml element called “pathurl”
here is my script so far(yes i know I am crap at this but I am trying to improve)
set xx to {}
set destination_folder to (choose folder with prompt "select destination folder")
set Master_xml_folder to (choose folder with prompt "select the folder that contains the xmls")
tell application "Finder"
set xml_file_list to files of folder Master_xml_folder
end tell
repeat with current_xml_file in (items 1 thru (count of xml_file_list) of xml_file_list)
try
set the_URL to (current_xml_file as alias)
set the_doc to XMLOpen the_URL
set the_root to XMLRoot the_doc
set the_child to XMLChild the_root index 1
set media_branch to XMLFind the_child name "media"
set video to XMLFind media_branch name "video"
set numboftracks to XMLCount video
--so that I skip over the branch called "format"
set numberofvideotracks to numboftracks - 1
set trackcounter to 2
--working with 1 track at a time
repeat with i from 1 to numberofvideotracks
set track to XMLChild video index trackcounter
set clipitem to XMLFind video name "track"
set numbofclips to XMLCount clipitem
--working with 1 clip at a time in the current track
set numbofclips_count to 1
repeat with ii from 1 to numbofclips
try
set next_clipitem to XMLChild track index numbofclips_count
set file_ to (XMLFind next_clipitem name "file")
set pathurl to (XMLFind file_ name "pathurl")
set pathurl_to_move to XMLGetText pathurl
--makeing the list of files to copy
set end of mylist to pathurl_to_move
set numbofclips_count to numbofclips_count + 1
on error
display dialog "error"
end try
end repeat
--move to the next track
set trackcounter to trackcounter + 1
end repeat
end try
end repeat
--b109c2 2,1
--a127c3 2,2
--a125c7 3,2
mylist
I can get the first two .movs in the xml into the list but not the 3rd one. the 3rd one is on track 2.
I think it may be because some of the branches of the clipitem part of the xml dont have the pathurl information. but I dont know anymore.
Can anyone see where I am going wrong?
Thanks
Here is a shortened version of the xml
<?xml version="1.0" encoding="UTF-8"?> 4687C78B-BE4D-4C6F-9B47-83902BC2A823 add 4/11test2 762 FALSE 25 FALSE 25 01:00:00:00 90000