Run action and pass paramaters to video to poweshell script.

Joined
Jul 10, 2022
Messages
6
Reaction score
0
Location
Sweden
Hi!
I'm hoping this is a simple question but I'm unable to find the answers when searching.
I would like to know what I write in the parameters field to get the video file that was just exported along with this trigger.

If I cant get the file I'll have to write a script to scrape the folder \Export programmatically but I hope theres a simpler way.


1665336535477.png

I have set Blue Iris up to export the video file to a folder as shown below and that works great.
1665336601928.png


1665336632532.png

These are the files Id like to get passed as a paramater.

1665336906668.png


Thank you.
 
Joined
Jul 10, 2022
Messages
6
Reaction score
0
Location
Sweden
The purpose of this whole thing is to create a script that pulls two images from the video at the X second mark that the action is happening at (10 seconds in for me), post them to telegram and then post the video.
I want to pull two images so it makes it easier to find important videos and removes the need to watch them all to figure out if it was something of importance.

Maybe this can be achieved in an easier way?
 
Joined
Jul 10, 2022
Messages
6
Reaction score
0
Location
Sweden
I just wrote some code to find the file using a batch script on trigger as I don't think its possible to get it from parameters.

But when the trigger is activated the file does not even exist.. The below code prints the last exported file since the file has not been exported when the trigger is run.

Bash:
@echo off


SET VideoFolder=D:\Surveillance\BlueIris\Export


for /f %%i in ('dir "%VideoFolder%" /b/a-d/od/t:c') do set LAST=%%i

rem for /f %i in ('dir "%VideoFolder%" /b/a-d/od/t:c') do set LAST=%i


SET videoPath=%VideoFolder%\%LAST%

echo %videoPath%
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,163
Reaction score
1,259
Location
SF Bay Area
I would like to know what I write in the parameters field to get the video file that was just exported along with this trigger.
First, try configuring the Run action like the following example.
In this example, 'hello there' is the passed argument.
1665420125621.png

Here's the example script.
Code:
# NOTE: param() MUST BE THE 1ST FIRST LINE OF CODE IN THIS SCRIPT
param($p1)
if ($p1) {
    msg.exe * /TIME:5 "with argument '$p1'"
} else {
    msg.exe * /TIME:5 "without argument"
}
 

Attachments

Last edited:

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,163
Reaction score
1,259
Location
SF Bay Area
to get the video file that was just exported.
Second, before attempting to execute your script 'Send.ps1', you could trying running the script below.
Then you could use consistent filenames like 'latest[1].mp4' as arguments for 'Send.ps1'.

See the code comments for an explanation of how it works.

The following screenshots illustrate what it does.

Before
1665419439384.png

After
  • file ‘latest[1].mp4’ is a copy of file ‘DW1.20221009_1034.txt’, the newest file.
  • file ‘latest[2].mp4’ is a copy of file ‘DW1.20221009_1033.txt’, the next newest file.
1665419514183.png

Script 'test_copylatest.ps1'
Code:
# CREATE A 'STACK' OF THE LATEST N *.MP4 FILES IN FOLDER
# by jaydeel at ipcamtalk
#
# THE NEWEST FILE IS NAMED 'latest[1].mp4'
# THE NEXT NEWEST FILE IS NAMED 'latest[2].mp4'
# AND SO ON, UP TO THE LIMIT SPECIFIED BY VARIABLE $stack_cnt
#
# SORT FILES IN DESCENDING ORDER AND COPY ONLY THE TOP 'N'
$source_path = "D:\Surveillance\BlueIris\Export"
$dest_path = "D:\Surveillance\BlueIris\Export"
$stack_cnt = 2
$j = 1  # INITIALIZE STACK INDEX
# SORT BY THE FILE LAST-WRITE DATES
@(Get-ChildItem $source_path -Filter *.mp4 | Sort LastWriteTime -Descending) | select -First $stack_cnt | % {
    # CREATE STACK ENTRY
    Copy-Item -path $_.FullName -destination $("$dest_path\latest[$j].mp4") -force
    $j++  # INCREMENT STACK INDEX
}
 
Last edited:
Top