AppleScript
Support
You can use AppleScript to control EvoCam, and to customize EvoCam's behavior.
Triggering
a refresh from a script or another application
Saving
the current image to a file
Changing
text in a caption item
Writing
scripts that are executed by EvoCam
Triggering
a refresh from another application
You can cause EvoCam to capture the current image using the 'capture now'
command. This command causes an image refresh, and resets the refresh timer
when EvoCam is in periodic refresh mode.
tell application "EvoCam"
capture now
end tell |
When you have multiple webcam windows, you must specify the webcam window to
use. You specify the window using its index, which can be found in the window's
title bar. Here is how you would cause window "EvoCam 2" to capture
now:
tell application "EvoCam"
capture now webcam 2
end tell |
Saving
the current image to a file
You can cause EvoCam to save the current image to a file using the following
AppleScript commands:
tell application "EvoCam"
save image as file "Macintosh HD:Images Folder:Webcam
Image"
end tell |
Again, when you have multiple webcam windows, you must specify the webcam window
to use:
tell application "EvoCam"
save image webcam 2 as file "Macintosh HD:Images
Folder:Webcam Image"
end tell |
Change the path as necessary to specify where EvoCam should save the image file.
In this example, the image is saved as 'Webcam Image' in the folder 'Images
Folder' on the volume 'Macintosh HD'.
Changing
text in a caption item
Caption items can be named for easy access from AppleScript using the 'Item
Name' command in the 'Items' menu. For example, if you have a caption item that
displays a daily message, you can name the item "message" and change it using
the following AppleScript commands:
tell application "EvoCam"
set item "message" to "Welcome!"
end tell |
This script changes the text of an item in webcam window 2:
tell application "EvoCam"
set item "message" of webcam 2 to "Welcome!"
end tell |
By incorporating these commands into a 'Before Capture' script, you can create
dynamic captions that change for each image captured. See the next section for
more information on creating a 'Before Capture' script.
Writing
Scripts that are executed by EvoCam
Running scripts when events occur
EvoCam can run AppleScripts when certain events occur. Use the 'AppleScript
Settings' command in the 'Options' menu to specify the scripts to be run when
EvoCam is launched, when EvoCam quits, or before and after EvoCam captures an
image.
Note: The 'capture now' command cannot be used in scripts that are executed
by EvoCam. If this command is used, it will be ignored.
Running scripts when motion is detected
Motion sensor items can also be configured to run an AppleScript when they detect
motion. To set the script to be used, select 'Run script' in the 'On motion'
popup menu, and click the 'Script' button to specify which script to run.