is there a way to take a picture with isight and applescript?

I was wanting to take a piture with applescript, maybe using quick time. Does anyone know how to do this?

Man! It is hard to find info on this subject! How about this? Is there a command that will get a screenshot of a wondow and turn it into a jpeg? this would work just as good. Thanks for any ideas. Ian

doc:

Yeah, the only way to get screenshots is via the shell, using the command [screencapture]. It is very poorly explained and difficult to work. You may be able to force it via GUI scripting, and I know there is a thread on here somewhere about it, but it is not my bag.

Here is something you wrote awhile back. It is interesting.

display dialog "Place the cross in the window you want, press the space bar to select, and press the mouse button to capture."
do shell script "screencapture -iw ~/desktop/screen01.png" /applescript]

I do not understand shell scripts at all. But, is there a way to make it do the same operation, but on the isight window? Right now, you are suppost to select the area and press the space bar. I does everything I need, but how can I make it target the "my isight" window?

found this

-i capture screen interactively, by selection or window
control key - causes screen shot to go to clipboard
space key - toggle between mouse selection and
window selection modes
escape key - cancels interactive screen shot
-c force screen capture to go to the clipboard
-m only capture the main monitor, undefined if -i is set
-w only allow window selection mode
-s only allow mouse selection mode
-W start interaction in window selection mode
-x do not play sounds
-S in window capture mode, capture the screen not the window
-C capture the cursor as well as the screen. only in non-interactive modes
-t image format to create, default is png
files where to save the screen capture, 1 file per screen

Ahhh.

If I could manipulate the mouse with a script to click on the “My iSight” window, I would be set.

do shell script "screencapture -iW ~/desktop/screen01.png"

Well done, doc, this modification will save your file as a jpg, if you wish:

do shell script "screencapture -iWtjpeg ~/desktop/screen01.jpg"

If you want to capture an image from an iSight camera, get the CLI tool “isightcapture”:

http://www.intergalactic.de/hacks.html

Then you can call it like so:

property isightcapture_path : "/path/to/isightcapture"
property base_name : "iSightCapture"
property the_width : 640
property the_height : 480
property image_format : "jpg"

set desktop_path to ((path to desktop) as Unicode text)
set i to 1
repeat
	try
		set target_file to (desktop_path & base_name & "_" & i & "." & image_format)
		get target_file as alias
		set i to i + 1
	on error
		exit repeat
	end try
end repeat

try
	do shell script (isightcapture_path & " -w " & the_width & " -h " & the_height & " -t " & image_format & " " & quoted form of POSIX path of target_file)
on error e
	beep
	activate
	display dialog e buttons {"OK"} default button 1 with icon 0 giving up after 10
end try

Jon

Here’s a version that will let you do time lapse shots. It will take one shot per second for 1 minute:

property isightcapture_path : "/path/to/isightcapture"
property base_name : "iSightCapture"
property the_width : 640
property the_height : 480
property image_format : "jpg"

set target_folder to (choose folder) as Unicode text
repeat 60 times
	my isight_capture(target_folder)
	delay 1
end repeat

on isight_capture(target_folder)
	set i to 1
	repeat
		try
			set target_file to (target_folder & base_name & "_" & i & "." & image_format)
			get target_file as alias
			set i to i + 1
		on error
			exit repeat
		end try
	end repeat
	try
		do shell script (isightcapture_path & " -w " & the_width & " -h " & the_height & " -t " & image_format & " " & quoted form of POSIX path of target_file)
	on error e
		beep
		activate
		display dialog e buttons {"OK"} default button 1 with icon 0 giving up after 10
	end try
end isight_capture

Jon