- import time
- import socket
- HOST = "127.0.0.1"
- PORT = 55555
- def comm_words(timeout,first_word, second_word="", third_word=""):
- s.settimeout(timeout)
- data = first_word + second_word + third_word
- sdata = data.encode("CP1251")
- s.sendall(sdata)
- rdata = s.recv(512)
- rdata = rdata.decode("CP1251")
- if (rdata.find("Err") >= 0):
- print(f"Произошла ошибка при выполнении команды {first_word}")
- return 0
- else:
- return 1
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((HOST,PORT))
- timeout = 1
- comm_words(timeout, "SetSavePath D:\\Soft\\Cruise1\\v1024")
- i = 900
- while i > 99:
- frame_time = "SetTime 1 " + str(i)
- filename = " SetSaveFileName light_" + str(i)
- comm_words(timeout, frame_time)
- comm_words(timeout, filename+ "_001.tif")
- time.sleep(5)
- comm_words(timeout, "FileSave 1")
- comm_words(timeout, filename+ "_002.tif")
- comm_words(timeout, "FileSave 1")
- i = i-100
