Final Cut Pro (FCPX) - AppleScript to create Library and Events

Hi,

I’m tinkering around with a script to create a template project with AppleScript.
Although it says that it cannot move object into container. The storage location is already set within final cut, and it doesn’t accept location specifier with scripting. I come with some swift background, but am new to dabbling in AppleScript.


tell application "Final Cut Pro"
activate
make new library with properties {name: "A new library"}
end tell
[/AppleScript]

The exact error returned is: 

"Final Cut Pro got an error: AppleEvent handler failed."

All of FCPX libraries and Projects are essentially XML files.
Which can be created from NSDictionaries.

There is a great deal of documentation about the format online

https://developer.apple.com/documentation/professional_video_applications/fcpxml_reference

Thanks for the point to the xml. Had a chance to tinker with it this weekend, new to xml, but it’s fairly straightforward to grasp. Starting to have some success, but not quite there yet. I’m curious if there is any programmatic way to convert a dtdfile to classes or structs in swift… would be a life saver. Well another one… after your pointer to xml.