This AppleScript lets you capture screenshots either on demand or at scheduled intervals, automatically saving each capture in a designated folder with a unique, timestamped filename. Notifications alert you whenever a screenshot is taken, ensuring you always know when your screen has been captured.
Warning: This script requires specific macOS permissions to function correctly. In particular, macOS Catalina and later require that you enable Screen Recording permissions for the app running the script (e.g., Script Editor or Terminal), and you may also need to grant Automation or Full Disk Access in Security & Privacy settings. Without these permissions, the screenshot functionality and notifications might not work as expected.
Click to view script…
-- Automated Screen Capture Script
-- Ensure the "Screenshots" folder exists on the Desktop
do shell script "mkdir -p ~/Desktop/Screenshots"
-- Ask the user to choose a capture mode
display dialog "Choose Screenshot Mode:" buttons {"On Demand", "Scheduled"} default button "On Demand"
set modeChoice to button returned of result
if modeChoice is "On Demand" then
my takeScreenshot()
else if modeChoice is "Scheduled" then
display dialog "Enter interval between screenshots (in seconds):" default answer "60"
set intervalSeconds to (text returned of result) as integer
display dialog "Enter number of screenshots to capture:" default answer "10"
set numberShots to (text returned of result) as integer
repeat with i from 1 to numberShots
my takeScreenshot()
delay intervalSeconds
end repeat
end if
-- Handler to take a screenshot and save it with a timestamped filename
on takeScreenshot()
-- Create a timestamp
set timeStamp to do shell script "date +%Y%m%d-%H%M%S"
set fileName to "Screenshot-" & timeStamp & ".png"
set filePath to "~/Desktop/Screenshots/" & fileName
-- Capture the screenshot silently (-x suppresses the shutter sound)
do shell script "screencapture -x " & filePath
display notification "Captured: " & fileName with title "Screen Capture"
end takeScreenshot