run script against output file after writing to disk (openALPR)
  • Hello,

    I'm looking to do some operations against recorded files after they have been fully written to disk. I see that there is the option of using AppleScript as an Action. But I am unclear how to get the filename of the captured event out of it.

    Here is my scenario:
    I want to use the alpr software to detect license plates.
    I want to run this each time a new capture event is written to disk. I do not want to start the action until the recording is finished, and the recording file is closed.
    I would like the ability in the SecuritySpy UI to "run script after capture"
    I would like to use any type of script, ideally a bash shell script, or even python.

    What would be the best way to do this?
    Thanks!
  • I also have interest in openALPR and more general script integration (other than Applescript) - spawining a (ba)sh process would be ideal. I've not done more than build openALPR to check capability so far, but was thinking of piping action emails containing the images into it.
  • There is currently no option to run a script after a file is captured, but I can certainly see how this would be useful. I'll see if we can add this in a future update.
  • Thanks Ben!
    Please let me know if you need someone to beta test the "run script after capture" functionality!
  • This functionality has now been implemented, in the latest beta version of SecuritySpy (currently 4.2.7b2).

    As it's an advanced feature that won't be useful for most users, I didn't want to clutter the UI with a new setting for it. So, what you need to do is create a script using Script Editor and save it with the name "ProcessCapturedFile" in the ~/SecuritySpy folder (i.e. the SecuritySpy folder within your Home folder). It must have the file extension ".scpt" (this is added by Script Editor by default).

    If this script exists, SecuritySpy will invoke it whenever a captured file has finished, and will pass in the camera number, camera name, and file path as parameters. Here's an example script that demonstrates how to get the parameters:

    on run args
    set cameraNum to item 1 of args
    set cameraName to item 2 of args
    set filePath to item 3 of args
    end run

    Note that it will be invoked for all captured files - movies and images. If you want to ignore images, then you'll need to check the file extension for .mov or .m4v files, and ignore .jpg files.

    Please test this and let me know if it works as expected.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!