Shell script or not...?

I’m trying to get an iSight picture useing the software from http://www.intergalactic.de/hacks.html. Unfortunatly

do shell script "$ ./isightcapture -w 320 -h 240 -t png image.png"

doesn’t work. How do you use this stuff? Please leave out the confusing extras and just give me the line of script which will take the picture. Thank you!

Model: iMac
AppleScript: 2.1.1
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

where do you have put the isightcapture file?
I put it in /usr/bin then the shell command is simple

do shell script "isightcapture -w 320 -h 240 -t png image.png"

the captured picture is saved into the root directory

even better:


do shell script "/usr/bin/isightcapture -w 320 -h 240 -t png image.png"

you can’t always depend on the $PATH variable to be set correctly. if you know where ‘isightcapture’ (or whatever executable you are using) lives, tell AppleScript!

if you aren’t sure where something lives, try this:

which <executable>

such as, which isightcapture
if the executable is in your path, ‘which’ will find the first one.

cheers.

edited to add:

if you are NOT sure where an executable lives and you want to write a script for use on multiple machines (where the executable could be literally anywhere), here is a trick i’ve used in the past with great success:


property myiSightCapture : "no"

try
    set myiSightCapture to (do shell script "/usr/bin/locate isightcapture | sed 2,10000d")
end try

if myiSightCapture is "no" then
    display dialog "Cannot find iSightCapture on this computer."
else
    doMain()
end if

on doMain()
    display dialog "We've found iSightCapture!  Replace this with your actual code"
end doMain

you could use the same technique with the ‘find’ command if you are not sure that the ‘locate’ database is up to date.

Where is usr/bin? The isightcapture is on the desktop if that helps. Alias Gentfamdisc:Users:Tim:Desktop:isightcapture

OOH, WAIT! I put this in

do shell script "/Users/Tim/Desktop/isightcapture -w 320 -h 240 -t png image.png"

and the little isight green light went on!..for about 2 seconds. Then it turned off and I got an error. Did i do something wrong?
It said “FATAL: graphics exporter failed”.

the folder /usr/bin is an invisible folder where lots of UNIX command line files are stored.
You can open it from the Finder typing shift-cmd-G and the path.

But it should also work on the desktop. Is there a file image.png at the root directory?

Considering that changing the script to end in face.png returns the same error, I suppose not. I don’t have an administrators account. Might that affect something?