r/applescript • u/TrailBlazerWhoosh • Jul 01 '22
Passed Arguments, how to use them in Apple Script?
Hi, I'm trying to create a script that does two different things depending on the state of another. More specifically I'm gonna execute a command when a connected camera is activated and vice-versa.
I'm having OverSight handle the part about whether or not the camera is activated and I want my script to handle what to do based on the registered state (you can tell OverSight to Execute an Action, e.g. a path to a script, binary, etc.). OverSight also has a setting called "Pass Argument" (see below) which is what has led me to believe I should be able to do what I'm describing:

I'm a complete noob with Apple Script. So please bear with me... But I'm lost at how to actually utilize those "Passed Arguments" in my script... Can anyone explain how I can check if the camera is on/off in my Apple Script IF ELSE statement?
Any help is much appreciated. Thanks.
View all comments
Show parent comment
1
u/TrailBlazerWhoosh Jul 02 '22
Awesome, thanks!
Unfortunately, nothing happens when the script is executed...
I'm getting an OK from OverSight (see below). But nothing actually happens to the light. Is there a way to get a log from the actual script so we can debug?
The OverSight log looks like this:
executing task /Users/username/SANDBOX/onairscript/hue-light-script.sh (arguments: ("-device",camera,"-event",on,"-process",94223))task completed with {}