Starting in 10.4.10, Apple put in some security restrictions that made using utilities like isightcapture unusable to anyone but the console user. This limited the ability to remotely log into a system and capture video from an iSight camera through the command line. In addition, it stopped you from being able to setup a cron to run every so often because the isightcapture application was not run by the console user, but by root or crond. This broke the ability of people running their own little scripts running on a local machine.
Common errors:
FATAL: setting data channel failed - cam busy/not connected ?
open requires the user to be logged in at the console to launch applications.
It took some trial and error, but I finally managed a way to overcome this under Leopard 10.5.1 and I assume it will work under Tiger 10.4 was well. The method involves using Applescript. While you can run the isightcapture utility remotely via SSH it requires using the GUI side Applescript, not the command line side. This means that visual feedback will happen when the application is launched. The Applescript icon will show up in the dock, the application will move to the foreground and run then quit. It happens pretty quick and short of your dock expand and contracting you'd never know it was running.
For those setting up their own scripts on their own computer or managed computers for whatever purpose, this is probably not a problem. For those wishing to take snapshots secretly on remote machines, this won't help you out unless it's your computer and the screen saver is running or monitor is off. Granted, that is what Apple was doing when it started blocking access and while running the same script via osascript renders errors. In addition, it won't work if the user it is running under is not the active logged in user session.
I am sure there is something I have missed, but this should get things going again for most people.
Open Script Editor and type in:
Modify the code to your liking and setup above. Then save the script as an application to a location and name of your choice, but for this example I will use isightscript.app.
Open up Terminal and type "crontab -e" and hit return. This probably will bring up an empty listing, but whether it is empty or you have entries already, go to the end of any listings and on a new line type:
The above code will execute your script every minute 24/7. If you only wish to run it every hour on the hour:
Anyhow, standard crontab practice applies to entries. You can define certain time ranges, certain days of the week, etc.
To try out your code without using crontab or if you are logged in remotely via SSH, you can just type "open /path/to/isightscript.app" in terminal and you should see the script load, it will take a picture and return.
Plus, since your using Applescript, you can do all sorts of fun things like sending an email of the output to you or uploading it to a remote web server. Imagine if you are away from your machine and you wanted to take a picture, you could send a email message with certain text to your account, when Mail.app sees this incoming email, based on a defined rule, it could launch this Applescript and take a picture then send the resulting image back to you. While I have not included the code to do all that above, you get the idea. Using Automator would get you on the right track.
Common errors:
FATAL: setting data channel failed - cam busy/not connected ?
open requires the user to be logged in at the console to launch applications.
It took some trial and error, but I finally managed a way to overcome this under Leopard 10.5.1 and I assume it will work under Tiger 10.4 was well. The method involves using Applescript. While you can run the isightcapture utility remotely via SSH it requires using the GUI side Applescript, not the command line side. This means that visual feedback will happen when the application is launched. The Applescript icon will show up in the dock, the application will move to the foreground and run then quit. It happens pretty quick and short of your dock expand and contracting you'd never know it was running.
For those setting up their own scripts on their own computer or managed computers for whatever purpose, this is probably not a problem. For those wishing to take snapshots secretly on remote machines, this won't help you out unless it's your computer and the screen saver is running or monitor is off. Granted, that is what Apple was doing when it started blocking access and while running the same script via osascript renders errors. In addition, it won't work if the user it is running under is not the active logged in user session.
I am sure there is something I have missed, but this should get things going again for most people.
Open Script Editor and type in:
Code:
do shell script "/your/path/isightcapture imagename"
Modify the code to your liking and setup above. Then save the script as an application to a location and name of your choice, but for this example I will use isightscript.app.
Open up Terminal and type "crontab -e" and hit return. This probably will bring up an empty listing, but whether it is empty or you have entries already, go to the end of any listings and on a new line type:
Code:
* * * * * open /path/to/isightscript.app
The above code will execute your script every minute 24/7. If you only wish to run it every hour on the hour:
Code:
0 * * * * open /path/to/isightscript.app
Anyhow, standard crontab practice applies to entries. You can define certain time ranges, certain days of the week, etc.
To try out your code without using crontab or if you are logged in remotely via SSH, you can just type "open /path/to/isightscript.app" in terminal and you should see the script load, it will take a picture and return.
Plus, since your using Applescript, you can do all sorts of fun things like sending an email of the output to you or uploading it to a remote web server. Imagine if you are away from your machine and you wanted to take a picture, you could send a email message with certain text to your account, when Mail.app sees this incoming email, based on a defined rule, it could launch this Applescript and take a picture then send the resulting image back to you. While I have not included the code to do all that above, you get the idea. Using Automator would get you on the right track.