Save Screen Capture to specific location

Set a target folder and this script will save screen captures as PDF in that folder with uniquely numbered names. Uncomment the end of the script for more information about the screencapture CLI which will allow you to save portions, set the captuer to the clipboard, etc.

OS version: OS X

set target_folder to (path to desktop) as string
set file_prefix to "sc_"
set sc_num to 0
tell application "Finder"
	repeat
		set sc_num to sc_num + 1
		set file_name to file_prefix & sc_num & ".pdf"
		if (exists of file (target_folder & file_name)) = false then exit repeat
	end repeat
end tell
do shell script "/usr/sbin/screencapture -x " & ((quoted form of POSIX path of target_folder & file_name) as string)

(*
--to return screencapture help:

try
	return do shell script "screencapture"
on error the_err
	return the_err
end try
*)