MacOS – Make a screen-shot and upload with a script

applescriptcommand linemacosscreen capture

I am not very good with AppleScript but I would imagine this is something quite easy for the AppleScript guru out there, I am looking to make a screenshot of a region like with doing Apple-Shift-s and feed it the ScreenShot filename to a shell script which would take care of the upload.

Thanks.

PS: I don't need the shell script part just the AppleScript one.

Best Answer

simply run shell command:

screencapture -i filename

this will start screencapture in interactive mode (selecting region). See screencapture -h or man screencapture

If you realy need run the screencapture command from the applescript just use:

do shell script "screencapture -i filename"

you can test the applescript from shell:

osascript -e 'do shell script "screencapture -i /tmp/filename.png"'