Close

"Run the Command"

Having trouble with Sighthound Video? Post here for help.

Moderator: Staff

no avatar
mrmisi
 
Posts: 12
Joined: Tue Apr 22, 2014 9:55 am

"Run the Command"

by mrmisi » Tue Apr 22, 2014 10:07 am

Dear All,

I've written a script (actually 2, one for camera) to record the audio through the microphone using the windows tool (sound recorder).

The script is working, in fact, if I double click on it or run it on the command promt the record start; but, if I insert the file path (in 8.3 format) on the line "Run the command"(on your software) and click "test" the record doesn't start (it appear a cmd windows for a second but doesn't show any error message).

I attach one of the two script (the difference is the name of the directory which to save the record):

for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a

set datestamp=%dt:~0,8%
set timestamp=%dt:~8,6%
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%

set stamp=%DD%-%MM%-%YYYY% %HH%.%Min%.%Sec%
echo stamp: "%stamp%"
echo datestamp: "%datestamp%"
echo timestamp: "%timestamp%"

Start %SystemRoot%\system32\SoundRecorder.exe /File H:\Archivio\Sorveglianza\Audio\Soggiorno\%stamp%.wma /duration 0000:02:00

Thank you and best regards,
Matteo.

User avatar
ryan
 
Posts: 1015
Joined: Wed Aug 25, 2010 2:52 pm
Location: Palo Alto, California

Re: "Run the Command"

by ryan » Tue Apr 22, 2014 12:30 pm

Hi mrmisi,

I don't have a windows machine to test this on at the moment, but you may try removing the "echo" statements. In the current implementation, to prevent broken or never ending commands from holding open file descriptors, stdin/stdout/stderr are closed so programs which require these may fail. I'm not sure if echo on windows errors or is silent if stdout is closed.
Learn more about Sighthound Video in our support pages - Reference Guide | All Articles
Are you a developer? Check out our cloud APIs - Demo | Docs

no avatar
mrmisi
 
Posts: 12
Joined: Tue Apr 22, 2014 9:55 am

Re: "Run the Command"

by mrmisi » Wed Apr 23, 2014 6:32 am

Hy Ryan,

I removed all the command line with "echo" (which really is not needed on), but the problem still exists.

If I open it normally works, if it is opened through your software does not work (I get a window for a moment but nothing happens).

In the line "Run the command" I just put the path in 8.3 format or even something like "Run" or "Start"?

Now the script is as follows:

for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a

set datestamp=%dt:~0,8%
set timestamp=%dt:~8,6%
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%

set stamp=%DD%-%MM%-%YYYY% %HH%.%Min%.%Sec%


Start %SystemRoot%\system32\SoundRecorder.exe /File H:\Archivio\Sorveglianza\Audio\Soggiorno\%stamp%.wma /duration 0000:02:00

User avatar
ryan
 
Posts: 1015
Joined: Wed Aug 25, 2010 2:52 pm
Location: Palo Alto, California

Re: "Run the Command"

by ryan » Wed Apr 23, 2014 7:49 pm

Hi mrmsi,

I spent some time examining this and there appear to be a few issues, the primary being that Sound Recorder requires a 64 bit console to be created to execute. I was able to make this happen by wrapping your script in the following python script

import os
os.system(r'start C:\path\to\response.bat')

And configuring the response as

python.exe C:\\path\\to\\script.py

But this approach still has the problems that the command window remains after the batch file is executed, your wmic call is not available, and I had to make a copy of the sound recorder application to a different location as windows can obfuscate access to the system directories.

We'll look into adding more configuration options around the "run command" response in the future, but I don't have an access method for your particular script at this time.
Learn more about Sighthound Video in our support pages - Reference Guide | All Articles
Are you a developer? Check out our cloud APIs - Demo | Docs

no avatar
mrmisi
 
Posts: 12
Joined: Tue Apr 22, 2014 9:55 am

Re: "Run the Command"

by mrmisi » Thu Apr 24, 2014 5:22 am

Ok, thank you Ryan.

We hope in the future; however, just for knowledge,I've try to write another script with the only command to open the other script, like:

Start C:\...path...\script.cmd

and the problem is the same.
So, it look like that the problem isn't inside the script.

Now, I try to solve the problem creating an automatism to run the script with the e-mail notification and another software.

I've problem also on app remotation, but i will open a new topic different from this.
I hope that this new version that you've spoken about will be released soon.

Thx again.

no avatar
mrmisi
 
Posts: 12
Joined: Tue Apr 22, 2014 9:55 am

Re: "Run the Command"

by mrmisi » Thu Apr 24, 2014 9:47 am

Ok, I want only to inform, if this could help in the future, that I've solved the problem converting the batch file with a .bat to .exe converter.

Now it work.

Thanks for the helps.


Return to Technical Support
cron