I'm trying to automatically save a Quicktime recording to a directory with an specific file name including date and time.
To create the path, the I created a input dialog to create the folder and a subfolder with the date.
tell application "Finder"
activate
set DateStamp to short date string of (current date)
set patientname to text returned of (display dialog "patient name:" default answer "")
set folderpath to POSIX path of (choose folder with prompt "choose folder")
do shell script "/bin/mkdir -p " & quoted form of folderpath & "/" & quoted form of (patientname) & "/" & DateStamp
end tell
Then I open Quicktime and start the Recording. After stopping the recording, the new record should be saved under the specific name + date + time in the new created subfolder.
tell application "QuickTime Player"
activate
repeat
set tdoc to new movie recording -- document "Movie Recording"
say "Ready!"
delay 1
repeat while exists tdoc
delay 1
end repeat -- the recording is stopped
say "Stop!"
tell front document
set TimeStamp to time string of (current date)
set fileName to POSIX path of folderpath & "/" & patientname & "/" & DateStamp & "/" & patientname & "_" & DateStamp & "_" & TimeStamp & ".mov"
save it in POSIX file fileName
close
end tell
end repeat
end tell
After saving the new Record should close and a new recording window should appear.
However, there is always an error saying, I have no writing permission to save the file.
What do I have to change? i have no idea.
Although I have to say that I am very new to apple script. thanks in advance!
PS: I'm Using QuickTime Player Version 10.5 (1148.4.1) and MacOS Ventura 13.0.1