Q: Applescript to record webcam video
Hi,
I am new to applescripts and I am trying to write a script to record from webcam for say X seconds. I am using the script below but I am getting an error that I do not have permission to save this file to Desktop. How can I avoid this error? Secondly how can I save the file with Date and Time stamp appended in the name of the file.
Thanks a lot in advance, this is my first post in the community
tellapplication "QuickTime Player" set newMovieRecording to new movie recording tell newMovieRecording start delay 5 pause save newMovieRecording in "/users/rohitbhutani/desktop/movie.mov" stop close newMovieRecording end tell
MacBook Air, OS X Mavericks (10.9.5)
Posted on Jul 15, 2016 7:22 AM
The following should do the trick:
set theCurrentDate to current date
set dateTime to short date string of theCurrentDate & space & time string of theCurrentDate
set P to offset of "/" in dateTime
set dateTime to text 1 through (P - 1) of dateTime & "-" & text (P + 1) through -1 of dateTime
set P to offset of "/" in dateTime
set dateTime to text 1 through (P - 1) of dateTime & "-" & text (P + 1) through -1 of dateTime
set theFilePath to "/Users/rohitbhutani/Desktop/movie " & dateTime & ".mov"
tell application "QuickTime Player"
set newMovieRecording to new movie recording
tell newMovieRecording
start
delay 5
pause
save newMovieRecording in POSIX file theFilePath
stop
close newMovieRecording
end tell
end tell
Posted on Jul 15, 2016 9:08 AM