I'm trying to reduce the number of steps and and increase performance for my applescript, I just wondered if there are some common functions I can employ.
Here's an example script...
tell application "QuickTime Player"
activate
-- Get the iCloud file path to avoid permission error
set filePath to "Macintosh HD:Users:jm:Library:Mobile Documents:com~apple~QuickTimePlayerX:Documents:movie.wav"
set f to a reference to file filePath
-- Get a handle to the initial window
set windowID to id of first window whose name = "Audio Recording"
set audio to first document whose name = (get name of first window whose id = windowID)
tell audio
stop
end tell
-- Get second handle to new titled window
set windowID2 to id of first window whose name = "Untitled"
set audio2 to first document whose name = (get name of first window whose id = windowID2)
tell audio2
-- Save audio file
save audio2 in f
end tell
-- Get third handle to new titled window
set windowID3 to id of first window whose name = "movie.wav.qtpxcomposition"
set audio3 to first document whose name = (get name of first window whose id = windowID3)
tell audio3
close audio3 saving no
end tell
end tell
This is the second script, called after a script which starts recording.