Author Topic: Email on Motion Scripts  (Read 2702 times)

0 Members and 1 Guest are viewing this topic.

Offline lmolson

  • Member
  • *
  • Posts: 14
Email on Motion Scripts
« on: February 02, 2010, 10:59:49 PM »
I have a remote cabin that I have been using an unstable application to record my images and upload them to a website.  I purchased imagasalsa to hopefully correct this problem.  I also was under the understanding that it had motion capabilities with email, but see that I would have to wirte a script to make this happen.  Has anyone created a script along this line?  Any pointers or headstarts would be appreciated.

Lance Olson

www.kolobmountain.net

Offline lmolson

  • Member
  • *
  • Posts: 14
Re: Email on Motion Scripts
« Reply #1 on: February 06, 2010, 01:49:58 PM »
OK I have figured out how to send the email.  I have created a batch file that runs blat.exe which sends the email.  I can run the example shell script on an interval basis, but how do I get the script to trigger on motion.  When I check the motion box it does not run the script.  I must have to change the Public Sub name but can't figure out how.  Any help is appreciated.

Lance

'This sample script shows how to execute an external program.  This may be useful to call batch files,
'for example.

'In the Script Setup window, set the interval to the speed you want to call this procedure.
'If you set it to 1 second, you will see a new Notepad window popup each second!

Public Sub interval()
   Call ShellRunExample
End Sub

Private Sub ShellRunExample()
   Dim oShell
   Dim ReturnValue
   Set oShell=CreateObject("WScript.Shell")
   
   ReturnValue=oShell.Run("c:\motion.bat",1,False)
   
   'See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp
   'for detailed notes on the Run method.
   'Brief:
   'First Argument: strCommand, command line you want to run and any parameters
   '    You can also specify a file if it's type is registered and it will automatically call
   '    the associated program and load the file (i.e. "myworddoc.doc")
   'Second Argument (Optional): intWindowStyle, 1=default (11 different values -- see link above)
   'Third Argument (Optional): bWaitOnReturn, True=Wait for program to finish before returning to
   '    script, False=Continue script
   'Note:  If you decide to wait for the program to finish, ImageSalsa will stall until the program
   '    returns and your script completes.  If you want to run a DOS batch file and wait until
   '    the batch file completes, you can echo to a new file as the last line of the batch file.
   '    Then, make periodic script calls until the file is present (using the FileExists method
   '    of the File System Object Model.  It is also recommended that you wait a couple more
   '    seconds for the batch file to exit and clean up.
   'Return Value: Numerical value returned from program.  If bWaitOnReturn=False, returns 0.
End Sub

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7023
    • Eagle Bay Weather
Re: Email on Motion Scripts
« Reply #2 on: February 11, 2010, 05:36:22 PM »
Yawcam will do this.