rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: Paranoia on December 22, 2015, 12:45:53 PM
-
Hello. I have Batch script, which make shot from USB WebCamera and write it into JPG file.
And I want share this image via HFS. I add this file into HFS FileSystem, but I should "refresh image" (make shot from WebCam into this file).
How I can run Batch script from HFS when it's necessary? I mean:
- HFS hook receive "GET /image.jpg request"
- HFS run batch script (update this image)
- HFS send answer (image) to browser
-
i would try something like this
right click on the root, properties, diff template, and enter this:
[test]
{.exec|myBatchScript.}{.mime|image/jpeg.}{.load|C:\outputImage.jpg.}
of course you have to make some replacements in such text,
then you access your browser http://myaddress/~test
i cannot try it for you, sorry. Good luck.
-
Wow, thank you!
Unfortunately, there is some glitch. I can display image:
[test]
{.mime|image/jpeg.}{.load|image.jpg.}But when I add exec command before it (notepad for test):
[test]
{.exec|notepad.}{.mime|image/jpeg.}{.load|image.jpg.}Then I got corrupted (no image) output (in browser).
Why?
-
Nice idea! :) Would you like to share that Batch script with us? It may be of help to any other user who want to do the same task (and we may also review it to make it work with HFS). Thank you :)
-
But when I add exec command before it (notepad for test):
[test]
{.exec|notepad.}{.mime|image/jpeg.}{.load|image.jpg.}Then I got corrupted (no image) output (in browser).
Why?
I guess you have to test it with your real script (for example, "WebCamShot.vbs"), and not with the "Notepad", because the script delivers an JPEG image, and the Notepad doesn't...
-
Ofcourse I test it with my script first (.bat). I use Notepad just for simplify code for you.
And when I test it that way:
[test]
{.exec|notepad.}{.mime|image/jpeg.}{.load|image.jpg.}Then I ofcourse have "image.jpg" file, but it's not displayed as I said above.
-
sorry, i forgot to specify that the exec command works in 2 ways.
The version you are using is not waiting for the program to exit, and thus you have not the result ready when "load" is executed.
To do so, you just have to write it this way:
{.exec|batchfile|out=x.}
-
http://www.rejetto.com/forum/hfs-~-http-file-server/webcam-on-hfs/msg1058698/#msg1058698