Start a new topic

Windows BAT (Batch file) to turn on/off cameras

Greetings,


I created two batch files that you can edit for turning on and off your PTZOptics cameras.  In my case, they're the 30x SDI.  I'm posting the short version right now because I'm pressed for time. I'll try to come back to create a detailed how-to for someone who has no experience with PCs, batch files, etc.


First, download the Packet Sender portable program and save it in a safe folder (to prevent accidental deletion; don't leave it in your downloads is what I'm saying).

https://packetsender.com/download


I have a OneDrive account that I store the files in so that they're recoverable in case the PC dies. Replace the program path to suit your setup.


Create two new text documents and rename them to "Turn_On_Cameras.bat" and "Turn_Off_Cameras.bat" or something similar.  Store then somewhere safe as well.


Turn_On_Cameras.bat:

  

@echo off
# Power on cameras
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.21 5678 "81 01 04 00 02 FF"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.22 5678 "81 01 04 00 02 FF"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.23 5678 "81 01 04 00 02 FF"
pause
# Call Primary Preset on each camera
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.21 5678 "81 01 04 3f 02 01 ff"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.22 5678 "81 01 04 3f 02 04 ff"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.23 5678 "81 01 04 3f 02 01 ff"

  

Our cameras are at 192.168.1.21, .22, and .23. So replace the address as necessary.

After I power on the cameras, I wait until the OSD information disappears from the preview screen, and then I press "any key" to recall preset #1, which is the first preset we are likely to use on each camera for any given service.


Turn_Off_Cameras.bat

  

@echo off
# Call Preset 88 (Hex 58) on each camera
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.21 5678 "81 01 04 3f 02 58 ff"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.22 5678 "81 01 04 3f 02 58 ff"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.23 5678 "81 01 04 3f 02 58 ff"
pause
# Power off cameras
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.21 5678 "81 01 04 00 03 FF"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.22 5678 "81 01 04 00 03 FF"
"D:\600 Software\PacketSenderPortable\packetsender.exe" -x 192.168.1.23 5678 "81 01 04 00 03 FF"

  

In my case, I created a preset at location 88 (hex 58) that points the cameras straight down before I turn them off. This helps prevent dust from settling on the lenses when not in use, and also serves as a visual indicator when the cameras turn on (because they do their rotation thing). So the batch file recalls that preset on each camera, and then waits for the user to press "any key" to then send the command to power off the camera.


I hope someone finds this useful.


Login to post a comment