So I have 2 scripts that need to be combined into one. But the second requires that the process initiated by the first is complete before it attempts to run. So the first half of the script looks into a folder, finds the newest file (a QT movie) inside the folder and then exports a new video into a new location. No problem…so far looks like this:
set theFolder to alias "Macintosh HD:" --The folder holding the ORIGINAL Quicktime movie tell application "Finder" set fileList to every document file of theFolder -- or which class you prefer set newest_file to first item of (sort fileList by creation date) -- or modification date end tell tell application "QuickTime Player" open newest_file with timeout of 30000 seconds export movie 1 to file (path to desktop & "New Movie" & ".mov") as QuickTime movie end timeout close movie 1 saving no delay 5 quit "Quicktime Player" end tell
Then once the file has been completely exported I need Fetch 4.0.3 to retrieve the newest file of the destination folder and upload this file to an FTP server. So this 2nd half so far looks like this:
set theDesktop to path to desktop tell application "Finder" set fileList to every document file of theDesktop -- or which class you prefer set newest_export to first item of (sort fileList by modification date) as alias -- or creation date --Uploads the newest file to the appropriate remote directory tell application "Fetch 4.0.3" activate with timeout of 30000 seconds --will affect only the file upload put into url "FTP INFO HERE" item newest_export end timeout quit end tell end tell display dialog "File Uploaded." buttons "OK" default button "OK"
So in the above example, there is a QT movie at the root (“Macintosh HD”). QT will open the newest file (to be generate once daily) and export it to the desktop. Fetch will scan the desktop for the newest file THERE and upload it. These are not going to be the actuall file locations/destinations but that’s irrelevant. I’m trying to keep my “example” above simple.
So…the question is: How best to have Fetch wait for the QT Export process to be done? With a timeout? If you notice in the first script (the QT export) that it calls for QT to QUIT once done. Maybe Fetch can use an “if ‘System Event’ Quicktime Player”… to see if QT is even running before it tries to proceed? And have it proceed only if QT is NOT running?
Thanks in advance for any input in this matter.