Shell Script Arguments

abooth
edited August 2023 in AppleScript

Hi,

I see in the forum that AppleScripts are passed arguments about the cause of alert, is the same possible for shell scripts? I would like to pass off vehicle and human detection differently...

Thanks

Adam

Comments

  • Hi Adam, currently, no parameters are passed into shell commands invoked by SecuritySpy via the "Run shell command" function under Preferences > Cameras > Actions. However, what you can do is use an AppleScript to obtain the parameters, and from within that AppleScript you can use the "do shell script" command to issue shell commands.

  • Apologies for the thread resurrection, but I can't see where I found this before! Can you point me in the right direction for how to read the Applescript parameters please!

  • Found it, and it appears to be working!

  • Good to hear you found this. For the reference of anyone else coming across this discussion, the following parameters are passed into Action AppleScripts:

    • The camera number
    • The camera name
    • The reason for the trigger, which is a comma-separated list of the following reasons: Motion,Audio,Script,CameraEvent,WebEvent,OtherCamera,Manual,Human,Vehicle,Animal

    And here's how you would structure the AppleScript to use these arguments:

    on run args
    	set camNumber to item 1 of args
    	set camName to item 2 of args
    	set reasons to item 3 of args
    	
    	...
    
    end run