RunAppleScript( scriptString )
scriptString is a string. The string is the text of the script.
THIS FUNCTION WILL ONLY WORK ON macOS.
This function will run an Apple Script to allow control of the Finder and other applications. This could be used to control manufacturer camera control applications for cameras not directly supported by Moving Light Assistant.
Example…
-- This script will bring Image Capture to the front and simulate pressing the space bar
-- to capture an image from the tethered camera.
photoScript = "tell application \"Image Capture\"\n"
photoScript = photoScript .. "activate\n"
photoScript = photoScript .. "tell application \"System Events\"\n"
photoScript = photoScript .. "key code 49\n"
photoScript = photoScript .. "end tell\n"
photoScript = photoScript .. "end tell\n"
RunAppleScript(photoScript)
Wait(0.5)
-- We need MLA to be at the front to wait for image to arrive.
mlaScript = "tell application \"Moving Light Assistant\"\n"
mlaScript = mlaScript .. "activate\n"
mlaScript = mlaScript .. "end tell\n"
RunAppleScript(mlaScript)
Wait(0.5)
Note that any "
(quote) character needs to be ‘escaped’, i.e. tell application "Image Capture"
would need to have a \
character before the quote to become tell application \"Image Capture\"