Lets say for example, you want to control the Animation Amount of Motion VFX's awesome mMusic Video 2, Subtitle 05 Animation Amount:
To do this we can use UI Browser or Xcode's Accessibility Inspector to find some information about the location of this slider in the Accessibility Hierarchy.
Accessibility Inspector:
UI Browser:
With this information we can determine that the AXSlider is contained within a AXScrollArea within an AXGroup.
We can also see that the AXDescription for this particular slider is "animation amount slider".
With this information we can now put together a Lua Snippet to get this slider, and increment it:
local fcp = require "cp.apple.finalcutpro"
local axutils = require "cp.ui.axutils"
local Slider = require "cp.ui.Slider"
animationAmountSlider = Slider(fcp.inspector.title, function()
local title = fcp.inspector.title
local ui = title and title:UI()
local groupA = ui and axutils.childAtIndex(ui, 1)
local groupB = groupA and axutils.childAtIndex(groupA, 1)
local animationAmountSliderUI = groupB and axutils.childWithDescription(groupB, "animation amount slider")
return animationAmountSliderUI
end)
animationAmountSlider:show():increment()
hs.eventtap.keyStroke({"shift"},"]",0)
hs.eventtap.keyStroke({},"-",0)
hs.eventtap.keyStroke({},"1",0)
hs.eventtap.keyStroke({},"0",0)
hs.eventtap.keyStroke({},"return",0)
hs.eventtap.keyStroke({"cmd"},"up",0)-- Need To Assign Toggle Fade Out in FCPX
hs.eventtap.keyStroke({"cmd","alt"},"f",0)
hs.eventtap.keyStroke({"cmd"},"down",0)-- Need To Assign Toggle Fade In in FCPX
hs.eventtap.keyStroke({"cmd","shift"},"f",0)
hs.eventtap.keyStroke({"ctrl"},"s",0)
hs.eventtap.keyStroke({"shift"},"]",0)
hs.eventtap.keyStroke({},"-",0)
hs.eventtap.keyStroke({},"1",0)
hs.eventtap.keyStroke({},"0",0)
hs.eventtap.keyStroke({},"return",0)
hs.eventtap.keyStroke({"cmd"},"up",0)
hs.eventtap.keyStroke({"cmd"},"down",0)-- Need To Assign Toggle Fade In in FCPX
hs.eventtap.keyStroke({"cmd","shift"},"f",0)
hs.eventtap.keyStroke({"ctrl"},"s",0)
hs.eventtap.keyStroke({},"down",0)
hs.eventtap.keyStroke({"shift"},"[",0)
hs.eventtap.keyStroke({"shift"},"=",0)
hs.eventtap.keyStroke({},"1",0)
hs.eventtap.keyStroke({},"0",0)
hs.eventtap.keyStroke({},"return",0)
hs.eventtap.keyStroke({"cmd"},"up",0)
hs.eventtap.keyStroke({"cmd"},"down",0)-- Need To Assign Toggle Fade Out in FCPX
hs.eventtap.keyStroke({"cmd","alt"},"f")
hs.eventtap.keyStroke({"ctrl"},"s")
hs.eventtap.keyStroke({"shift"},"[",0)
hs.eventtap.keyStroke({"shift"},"=",0)
hs.eventtap.keyStroke({},"1",0)
hs.eventtap.keyStroke({},"0",0)
hs.eventtap.keyStroke({},"return",0)
hs.eventtap.keyStroke({"cmd"},"up",0)-- Need To Assign Toggle Fade In in FCPX
hs.eventtap.keyStroke({"cmd","shift"},"f",0)
hs.eventtap.keyStroke({"cmd"},"down",0)-- Need To Assign Toggle Fade Out in FCPX
hs.eventtap.keyStroke({"cmd","alt"},"f",0)
hs.eventtap.keyStroke({"ctrl"},"s",0)