Take screen shot using applescript

Hi

How can I take a screen shot of an application or the whole screen using applescript?
I want to take a screen shot when an applescript broke.

If you have a standard Jaguar install, this should place a screenshot on the clipboard.

do shell script "/usr/sbin/screencapture -c"

And this should place a screenshot in a PDF file on the desktop.

set ptd to POSIX path of (path to desktop as string)
set shellCommand to "/usr/sbin/screencapture " & ptd & "script_screenshot.pdf"

do shell script shellCommand

Caution: If you use the PDF version, you should add checks to make sure that the file name doesn’t already exist.

Hi!

Well, I’m a rooky.
How can I change the path that the new shots are going to be saved into a dedicated folder on the desktop???

Lets say at the beginning of the script there is a command to create a folder and later on the shot should be saved in there…

Thanks
Dirk

Take a look at this script I posted on Code Exchange.

Jon