docs » cp.apple.finalcutpro
Represents the Final Cut Pro application, providing functions that allow different tasks to be accomplished.
Generally, you will require the cp.apple.finalcutpro module to import it, like so:
local fcp = require " cp.apple.finalcutpro"
Then, there are the UpperCase files, which represent the application itself:
MenuBar - The main menu bar.
prefs/PreferencesWindow - The preferences window.
etc...
The fcp variable is the root application. It has functions which allow you to perform tasks or access parts of the UI. For example, to open the Preferences window, you can do this:
fcp .preferencesWindow :show ()
In general, as long as Final Cut Pro is running, actions can be performed directly, and the API will perform the required operations to achieve it. For example, to toggle the 'Create Optimized Media' checkbox in the 'Import' section of the 'Preferences' window, you can simply do this:
fcp .preferencesWindow .importPanel :toggleCreateOptimizedMedia ()
The API will automatically open the Preferences window, navigate to the 'Import' panel and toggle the checkbox.
The UpperCase classes also have a variety of UI methods. These will return the axuielement for the relevant GUI element, if it is accessible. If not, it will return nil. These allow direct interaction with the GUI if necessary. It's most useful when adding new functions to UpperCase files for a particular element.
This can also be used to 'wait' for an element to be visible before performing a task. For example, if you need to wait for the Preferences window to finish loading before doing something else, you can do this with the just library:
local just = require " cp.just"
local prefsWindow = fcp .preferencesWindow
local prefsUI = just .doUntil (function () return prefsWindow :UI () end )
if prefsUI then
-- it's open!
else
-- it's closed!
end
By using the just library, we can do a loop waiting until the function returns a result that will give up after a certain time period (10 seconds by default).
Of course, we have a specific support function for that already, so you could do this instead:
if fcp .preferencesWindow :isShowing () then
-- it's open!
else
-- it's closed!
end
Delegates to: app , menu
Note: All values/methods/props from delegates can be accessed directly from the cp.apple.finalcutpro instance. For example:
fcp .app :UI () == fcp :UI () -- the same `cp.prop` result.
Signature
cp.apple.finalcutpro.ALLOWED_IMPORT_AUDIO_EXTENSIONS -> table
Type
Constant
Description
Table of audio file extensions Final Cut Pro can import.
Signature
cp.apple.finalcutpro.ALLOWED_IMPORT_EXTENSIONS -> table
Type
Constant
Description
Table of all file extensions Final Cut Pro can import.
Signature
cp.apple.finalcutpro.ALLOWED_IMPORT_IMAGE_EXTENSIONS -> table
Type
Constant
Description
Table of image file extensions Final Cut Pro can import.
Signature
cp.apple.finalcutpro.ALLOWED_IMPORT_VIDEO_EXTENSIONS -> table
Type
Constant
Description
Table of video file extensions Final Cut Pro can import.
Signature
cp.apple.finalcutpro.EARLIEST_SUPPORTED_VERSION -> string
Type
Constant
Description
The earliest version of Final Cut Pro supported by this module.
Signature
cp.apple.finalcutpro.EVENT_DESCRIPTION_PATH -> string
Type
Constant
Description
The Event Description Path.
Signature
cp.apple.finalcutpro.FLEXO_LANGUAGES -> table
Type
Constant
Description
Table of Final Cut Pro's supported Languages for the Flexo Framework
Signature
cp.apple.finalcutpro.PASTEBOARD_UTI -> string
Type
Constant
Description
Final Cut Pro's Pasteboard UTI
Signature
cp.apple.finalcutpro.preferences <cp.app.prefs>
Type
Constant
Description
The cp.app.prefs for Final Cut Pro.
Signature
cp.apple.finalcutpro.WORKSPACES_PATH -> string
Type
Constant
Description
The path to the custom workspaces folder.
Signature
cp.apple.finalcutpro.activeCommandSet <cp.prop: table; live>
Type
Variable
Description
Contins the 'Active Command Set' as a table. The result is cached, but
Signature
cp.apple.finalcutpro:customWorkspaces <cp.prop: table; live>
Type
Variable
Description
A table containing the display names of all the user created custom workspaces.
Signature
cp.apple.finalcutpro:openAndSavePanelDefaultPath <cp.prop: string>
Type
Variable
Description
A string containing the default open/save panel path.
Signature
cp.apple.finalcutpro.selectedWorkspace <cp.prop: string; live>
Type
Variable
Description
The currently selected workspace name. The result is cached, but updated
Signature
cp.apple.finalcutpro.commandSet(path) -> string
Type
Function
Description
Gets the Command Set at the specified path as a table.
Parameters
path - The path to the Command Set.
Returns
The Command Set as a table, or nil if there was a problem.
Signature
cp.apple.finalcutpro.main.CommandEditor.matches(element) -> boolean
Type
Function
Description
Checks to see if an element matches what we think it should be.
Parameters
element - An axuielementObject to check.
Returns
true if matches otherwise false
Signature
cp.apple.finalcutpro.viewer.TranscodeMedia.matches(element) -> boolean
Type
Function
Description
Checks if the element is an TranscodeMedia instance.
Parameters
element - The axuielement to check.
Returns
true if it matches the pattern for a Viewer TranscodeMedia.
Signature
cp.apple.finalcutpro.userCommandSetPath() -> string or nil
Type
Function
Description
Gets the path where User Command Set files are stored.
Parameters
Returns
A path as a string or nil if the folder doesn't exist.
Signature
cp.apple.finalcutpro.workflowExtensions() -> table
Type
Function
Description
Gets the names of all the installed Workflow Extensions.
Parameters
Returns
A table of Workflow Extension names
Signature
cp.apple.finalcutpro.main.Color(app) -> Color
Type
Constructor
Description
Creates a new Color instance.
Parameters
app - The Final Cut Pro app instance.
Returns
Signature
cp.apple.finalcutpro.viewer.TranscodeMedia(viewer)
Type
Constructor
Description
Creates a new TranscodeMedia instance.
Parameters
parent - The parent object.
Returns
Signature
cp.apple.finalcutpro.activeCommandSetPath <cp.prop: string>
Type
Field
Description
Gets the 'Active Command Set' value from the Final Cut Pro preferences
Signature
cp.apple.finalcutpro.alert <cp.ui.Alert>
Type
Field
Description
Provides basic access to any 'alert' dialog windows in the app.
Signature
cp.apple.finalcutpro.inspector.color.VideoInspector.audioEnhancements <cp.prop: PropertyRow>
Type
Field
Description
Audio Enhancements
Signature
cp.apple.finalcutpro.timeline.audioLanes <cp.prop: boolean>
Type
Field
Description
Indicates if audio lanes are currently showing. May be set to ensure it is showing or hidden.
Signature
cp.apple.finalcutpro.backgroundTasksDialog <cp.apple.finalcutpro.main.BackgroundTasksDialog>
Type
Field
Description
The BackgroundTasksDialog dialog window.
Signature
cp.apple.finalcutpro.browser <cp.apple.finalcutpro.main.Browser>
Type
Field
Description
The Browser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.color <ColorInspector>
Type
Field
Description
The ColorInspector instance from the primary window
Signature
cp.apple.finalcutpro.colorBoard <ColorBoard>
Type
Field
Description
The ColorBoard instance from the primary window
Signature
cp.apple.finalcutpro.presfs.GeneralPanel.colorCorrection <cp.ui.PopUpButton>
Type
Field
Description
The "Color Correction" PopUpButton.
Signature
cp.apple.finalcutpro.commandEditor <CommandEditor>
Type
Field
Description
The Final Cut Pro Command Editor
Signature
cp.apple.finalcutpro.inspector.color.ShareInspector.contentUI <cp.prop: hs._asm.axuielement; read-only>
Type
Field
Description
The axuielement containing the properties rows, if available.
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.contentUI <cp.prop: hs._asm.axuielement; read-only>
Type
Field
Description
The axuielement containing the properties rows, if available.
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.deselectAll <cp.ui.Button>
Type
Field
Description
The left text layer arrow at the bottom of the Inspector.
Signature
cp.apple.finalcutpro.inspector.color.VideoInspector.effects <cp.prop: PropertyRow>
Type
Field
Description
Effects
Signature
cp.apple.finalcutpro.effects <cp.apple.finalcutpro.main.EffectsBrowser>
Type
Field
Description
The EffectsBrowser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.eventViewer <cp.apple.finalcutpro.viewer.Viewer>
Type
Field
Description
The Event Viewer instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.exportDialog <cp.apple.finalcutpro.main.ExportDialog>
Type
Field
Description
The Final Cut Pro Export Dialog Box
Signature
cp.apple.finalcutpro.findAndReplaceTitleText <cp.apple.finalcutpro.main.FindAndReplaceTitleText>
Type
Field
Description
The FindAndReplaceTitleText dialog window.
Signature
cp.apple.finalcutpro.fullScreenWindow <FullScreenWindow>
Type
Field
Description
Returns the Final Cut Pro Full Screen Window (usually triggered by Cmd+Shift+F)
Signature
cp.apple.finalcutpro.generators <cp.apple.finalcutpro.main.GeneratorsBrowser>
Type
Field
Description
The GeneratorsBrowser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.inspector <cp.apple.finalcutpro.inspector.Inspector>
Type
Field
Description
The Inspector instance from the primary window.
Signature
cp.apple.finalcutpro.presfs.GeneralPanel.inspectorUnits <cp.ui.PopUpButton>
Type
Field
Description
The "Inspector Units" PopUpButton.
Signature
cp.apple.finalcutpro:isFrontmost <cp.prop: boolean; read-only; live>
Type
Field
Description
Is Final Cut Pro Frontmost?
Signature
cp.apple.finalcutpro.isInstalled <cp.prop: boolean; read-only>
Type
Field
Description
Is any version of Final Cut Pro Installed?
Signature
cp.apple.finalcutpro:isModalDialogOpen <cp.prop: boolean; read-only>
Type
Field
Description
Is a modal dialog currently open?
Signature
cp.apple.finalcutpro.main.Viewer.isPlaying <cp.prop: boolean>
Type
Field
Description
The 'playing' status of the viewer. If true, it is playing, if not it is paused.
Signature
cp.apple.finalcutpro.main.ControlBar.isPlaying <cp.prop: boolean>
Type
Field
Description
The 'playing' status of the viewer. If true, it is playing, if not it is paused.
Signature
cp.apple.finalcutpro.isRunning <cp.prop: boolean; read-only>
Type
Field
Description
Is Final Cut Pro Running?
Signature
cp.apple.finalcutpro.isShowing <cp.prop: boolean; read-only; live>
Type
Field
Description
Is Final Cut visible on screen?
Signature
cp.apple.finalcutpro.isSupported <cp.prop: boolean; read-only; live>
Type
Field
Description
Is a supported version of Final Cut Pro installed?
Signature
cp.apple.finalcutpro.isUnsupported <cp.prop: boolean; read-only>
Type
Field
Description
Is an unsupported version of Final Cut Pro installed?
Signature
cp.apple.finalcutpro.keywordEditor <KeywordEditor>
Type
Field
Description
The Final Cut Pro Keyword Editor
Signature
cp.apple.finalcutpro.libraries <cp.apple.finalcutpro.main.LibrariesBrowser>
Type
Field
Description
The LibrariesBrowser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.media <cp.apple.finalcutpro.main.MediaBrowser>
Type
Field
Description
The MediaBrowser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.mediaImport <MediaImport>
Type
Field
Description
The Final Cut Pro Media Import Window
Signature
cp.apple.finalcutpro.inspector.color.VideoInspector.pan <cp.prop: PropertyRow>
Type
Field
Description
Pan
Signature
cp.apple.finalcutpro.preferencesWindow <PreferencesWindow>
Type
Field
Description
The Final Cut Pro Preferences Window
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.preset <cp.ui.PopUpButton>
Type
Field
Description
The preset popup found at the top of the inspector.
Signature
cp.apple.finalcutpro.primaryWindow <cp.apple.finalcutpro.main.PrimaryWindow>
Type
Field
Description
The Final Cut Pro Primary Window
Signature
cp.apple.finalcutpro.presfs.GeneralPanel.resetDialogWarnings <cp.ui.Buton>
Type
Field
Description
The "Reset Dialog warnings" Button.
Signature
cp.apple.finalcutpro.secondaryWindow <cp.apple.finalcutpro.main.SecondaryWindow>
Type
Field
Description
The Final Cut Pro Preferences Window
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.textArea <cp.ui.TextArea>
Type
Field
Description
The Text Inspector main Text Area.
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.textLayerLeft <cp.ui.Button>
Type
Field
Description
The left text layer arrow at the bottom of the Inspector.
Signature
cp.apple.finalcutpro.inspector.color.TextInspector.textLayerRight <cp.ui.Button>
Type
Field
Description
The left text layer arrow at the bottom of the Inspector.
Signature
cp.apple.finalcutpro.presfs.GeneralPanel.timeDisplay <cp.ui.PopUpButton>
Type
Field
Description
The "Time Display" PopUpButton.
Signature
cp.apple.finalcutpro.timeline <Timeline>
Type
Field
Description
The Timeline instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.toolbar <cp.apple.finalcutpro.main.PrimaryToolbar>
Type
Field
Description
The Primary Toolbar - the toolbar at the top of the Primary Window.
Signature
cp.apple.finalcutpro.transcodeMedia <cp.apple.finalcutpro.main.TranscodeMedia>
Type
Field
Description
The TranscodeMedia sheet.
Signature
cp.apple.finalcutpro.transitions <cp.apple.finalcutpro.main.EffectsBrowser>
Type
Field
Description
The Transitions EffectsBrowser instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.UI <cp.prop: hs._asm.axuielement; read-only; live>
Type
Field
Description
The Final Cut Pro axuielement, if available.
Signature
cp.apple.finalcutpro.presfs.GeneralPanel.validateAudioUnits <cp.ui.Buton>
Type
Field
Description
The "Validate Audio Units" Button.
Signature
cp.apple.finalcutpro.viewer <cp.apple.finalcutpro.viewer.Viewer>
Type
Field
Description
The Viewer instance, whether it is in the primary or secondary window.
Signature
cp.apple.finalcutpro.inspector.color.VideoInspector.volume <cp.prop: PropertyRow>
Type
Field
Description
Volume
Signature
cp.apple.finalcutpro.windowsUI <cp.prop: hs._asm.axuielement; read-only; live>
Type
Field
Description
Returns the UI containing the list of windows in the app.
Signature
cp.apple.finalcutpro:activeLibraryPaths() -> table
Type
Method
Description
Gets a table of all the active library paths.
Parameters
Returns
A table containing any active library paths.
Signature
cp.apple.finalcutpro:closeLibrary(title) -> boolean
Type
Method
Description
Attempts to close a library with the specified title.
Parameters
title - The title of the FCP Library to close.
Returns
true if successful, or false if not.
Signature
cp.apple.finalcutpro:defaultCommandSetPath([locale]) -> string
Type
Method
Description
Gets the path to the 'Default' Command Set.
Parameters
Returns
The 'Default' Command Set path, or nil if an error occurred
Signature
cp.apple.finalcutpro:doShortcut(whichShortcut) -> Statement
Type
Method
Description
Perform a Final Cut Pro Keyboard Shortcut
Parameters
whichShortcut - As per the Command Set name
Returns
A Statement that will perform the shortcut when executed.
Signature
cp.apple.finalcutpro.getCommandShortcuts(id) -> table of hs.commands.shortcut
Type
Method
Description
Finds a shortcut from the Active Command Set with the specified ID and returns a table
Parameters
id - The unique ID for the command.
Returns
The array of shortcuts, or nil if no command exists with the specified id.
Signature
cp.apple.finalcutpro:getPath() -> string or nil
Type
Method
Description
Path to Final Cut Pro Application
Parameters
Returns
A string containing Final Cut Pro's filesystem path, or nil if Final Cut Pro's path could not be determined.
Signature
cp.apple.finalcutpro:hide() -> self
Type
Method
Description
Hides Final Cut Pro
Parameters
Returns
Signature
cp.apple.finalcutpro:importXML(path) -> boolean
Type
Method
Description
Imports an XML file into Final Cut Pro
Parameters
Returns
A boolean value indicating whether the AppleScript succeeded or not
Signature
cp.apple.finalcutpro:isSupportedLocale(locale) -> boolean
Type
Method
Description
Checks if the provided locale is supported by the app.
Parameters
language - The cp.i18n.localeID or string code. E.g. "en" or "zh_CN"
Returns
true if the locale is supported.
Signature
cp.apple.finalcutpro:keysWithString(string[, locale]) -> {string}
Type
Method
Description
Looks up an application string and returns an array of keys that match. It will take into account current locale the app is running in, or use locale if provided.
Parameters
key - The key to look up.locale - The locale (defaults to current FCPX locale).
Returns
The array of keys with a matching string.
Notes
This method may be very inefficient, since it has to search through every possible key/value pair to find matches. It is not recommended that this is used in production.
Signature
cp.apple.finalcutpro:launch([waitSeconds], [path]) -> self
Type
Method
Description
Launches Final Cut Pro, or brings it to the front if it was already running.
Parameters
waitSeconds - If provided, the number of seconds to wait until the launch completes. If nil, it will return immediately.path - An optional full path to an application without an extension (i.e /Applications/Final Cut Pro 10.3.4). This allows you to load previous versions of the application.
Returns
Signature
cp.apple.finalcutpro:openLibrary(path) -> boolean
Type
Method
Description
Attempts to open a file at the specified absolute path.
Parameters
path - The path to the FCP Library to open.
Returns
true if successful, or false if not.
Signature
cp.apple.finalcutpro:plugins() -> cp.apple.finalcutpro.plugins
Type
Method
Description
Returns the plugins manager for the app.
Parameters
Returns
Signature
cp.apple.finalcutpro:quit([waitSeconds]) -> self
Type
Method
Description
Quits Final Cut Pro, if it's running.
Parameters
waitSeconds - The number of seconds to wait for the quit to complete.
Returns
Signature
cp.apple.finalcutpro:recentLibraryNames() -> table
Type
Method
Description
Gets a table of all the recent library names (that are accessible).
Parameters
Returns
A table containing any recent library names.
Signature
cp.apple.finalcutpro:recentLibraryPaths() -> table
Type
Method
Description
Gets a table of all the recent library paths (that are accessible).
Parameters
Returns
A table containing any recent library paths.
Signature
cp.apple.finalcutpro:scanPlugins() -> table
Type
Method
Description
Scan Final Cut Pro Plugins
Parameters
Returns
Signature
cp.apple.finalcutpro:selectLibrary(title) -> axuielement
Type
Method
Description
Attempts to select an open library with the specified title.
Parameters
title - The title of the library to select.
Returns
The library row axuielement.
Signature
cp.apple.finalcutpro:show() -> cp.apple.finalcutpro
Type
Method
Description
Activate Final Cut Pro, if it is running.
Parameters
Returns
Signature
cp.apple.finalcutpro:string(key[, locale[, quiet]]) -> string
Type
Method
Description
Looks up an application string with the specified key.
Parameters
key - The key to look up.locale - The locale code to use. Defaults to the current locale.quiet - Optional boolean, defaults to false. If true, no warnings are logged for missing keys.
Returns
The requested string or nil if the application is not running.
Signature
cp.apple.finalcutpro:userCommandSets() -> table
Type
Method
Description
Gets the names of all of the user command sets.
Parameters
Returns
A table of user command sets as strings.