Mar-29-2020, 08:47 PM
Hi,
Id like to know how i can make one script from 2 or more so i can just run one script with multiple functions.
Below are the 2 scripts which i want to have running in one script.
Both scripts have their own output file and time of execution.
Id like to know how i can make one script from 2 or more so i can just run one script with multiple functions.
Below are the 2 scripts which i want to have running in one script.
Both scripts have their own output file and time of execution.
import time
import schedule
#starttime=time.time()
def task():
#Input_file: "C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat"
#Output_file: "C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat"
while True:
""" Not to append duplicate data to output file"""
existingLines = set(line.strip() for line in open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie .dat"))
outfile = open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie .dat", "a+")
for content in open("C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat", "r"):
if content.strip() not in existingLines: # to void duplicate lines
outfile.write(content)
existingLines.add(content)
outfile.close()
schedule.every().minute.at(":01").do(task)
while True:
schedule.run_pending()
time.sleep(1)
refresh()import time
import schedule
#starttime=time.time()
def task():
#Input_file: "C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat"
#Output_file: "C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat"
while True:
""" Not to append duplicate data to output file"""
existingLines = set(line.strip() for line in open("C:\\Users\\Makada\\Desktop\\CR1000_Table2 - kopie.dat"))
outfile = open("C:\\Users\\Makada\\Desktop\\CR1000_Table2 - kopie.dat", "a+")
for content in open("C:\\Campbellsci\\LoggerNet\\CR1000_Table2.dat", "r"):
if content.strip() not in existingLines: # to void duplicate lines
outfile.write(content)
existingLines.add(content)
outfile.close()
schedule.every().minute.at(":10").do(task)
while True:
schedule.run_pending()
time.sleep(1)
refresh()
