Skip to content

Group support in Applescript

edited March 2020 in SecuritySpy
I looked through the documentation and didn't find anything, so I suspect I know the answer. But just want to confirm I'm not missing something.

Is there a way to toggle an entire group of cameras on or off, as opposed to having to call out the individual camera ID? It'd be pretty handy to enable "all inside cameras", etc, and not have to update the script as you add or remove cameras.

As a followup, assuming that's not possible...can you combine multiple camera IDs in one Applescript command, or do you have to chain multiple "do shell script"s together to get what you need done, done?

Thanks in advance!
Steve

Comments

  • Hey Steve!
    I am having so e ti e to try and figure out the “do shell script” commands for SS.
    I have tried: do shell script "curl -g http://“ip address:port”/++setSchedule?cameraNum=0&schedule=1&override=3&mode=CA"
    I get the “OK” response but no changes are made to the system or triggers.

    Can you share a sample command with me? Much appreciated.

    As for groups, that is a great idea for my use case also. I know -1 will choose all cameras, but looking forward to Bens responses.

    Cheers!
    Chris
  • Hey Chris, thanks for chiming in. I'm not sure how much help I'll be, as I'm just using what's shown on the AppleScript examples help page, and thankfully it worked for me. Did you do the "action=save" at the end though, didn't see it in your snippet?

    Yes, looking forward seeing what Ben has to say re:Groups also.

    Best, Steve
  • The AppleScript command for this does not support groups, but the HTTP command does. This request (as shown by @CVH above) is correct for setting both a schedule and an override:

    ++setSchedule?cameraNum=0&schedule=1&override=3&mode=CA

    If you are having any problem with this not working as it should, please update to the latest beta version of SecuritySpy (currently 5.2.2b11), which should fix any issues.

    To reference a group instead of a camera number in the above request, specify the group number plus 1000 (so 1000 is the first group, 1001 is the second group etc.), for example:

    ++setSchedule?cameraNum=1001&schedule=1&mode=CA

    Schedule/override codes can be found in the SecuritySpy Web Server Specification document.
  • Thanks Ben. I downloaded the Beta, and it did indeed fix one of the weird things I was seeing. It's all working nicely now, including groups. Thanks!
  • Update fixed my issues also with control from http! Thank you.
  • edited March 2020
    Hi Ben, sorry one more question on this. The below doesn't find the cameras when, but does when I specify the ID. Any idea what I'm doing wrong? Thanks!

    do shell script "curl -d " & "?'cameraNum=1000&camEnabledCheck=1&action=save' http://name:password@192.168.0.1:8000/camerasettings"
  • Sorry but you can't set camera settings for multiple cameras at once - for the camerasettings request, you must specify one camera's number for the cameraNum parameter.
  • Ok, that makes sense I suppose. Thank you!
  • Is it possible to open a window for groups from AppleScript?
  • BenBen
    edited March 2020
    Hi @CVH, yes this is possible. Here's how to open a group window:

    tell application "SecuritySpy"
        set window "Group Name" visible yes
    end tell

    Here's how to close a group window:

    tell application "SecuritySpy"
        set window "Group Name" visible no
    end tell

    The "set window" command also allows you to position and resize the window, if you want to do so.
  • Thank you, that works great.
Sign In or Register to comment.