Saya mencoba mengurangi jumlah langkah dan meningkatkan kinerja untuk applescript saya, saya hanya ingin tahu apakah ada beberapa fungsi umum yang dapat saya terapkan.
Berikut ini contoh skrip ...
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
Ini adalah skrip kedua, dipanggil setelah skrip yang mulai merekam.