v3 released - v2 works perfectly but will run extra break before completely closing
must run from same folder as jieguan
"How long to run (hours)" is how long the bot will run for (this includes playtime and breaks)
"Interval of running (hours)" is a range of how long it will bot straight, in this case, between 2 and 5 hours at a time
"Interval of break (minutes" is a range of how long the bot will take a break after it finishes each run interval
As soon as the how long to run time is reached, bot will kill itself and stop running.
Warning: as of today, I just wrote this so I have only tested that the intervals of running and breaking work - I haven't confirmed that it will stop running after 12 hours
Here is source code if u rather run from source or don't trust exe
NOTICE ME ZHIPEI
must run from same folder as jieguan
"How long to run (hours)" is how long the bot will run for (this includes playtime and breaks)
"Interval of running (hours)" is a range of how long it will bot straight, in this case, between 2 and 5 hours at a time
"Interval of break (minutes" is a range of how long the bot will take a break after it finishes each run interval
As soon as the how long to run time is reached, bot will kill itself and stop running.
Warning: as of today, I just wrote this so I have only tested that the intervals of running and breaking work - I haven't confirmed that it will stop running after 12 hours
Here is source code if u rather run from source or don't trust exe
NOTICE ME ZHIPEI
Python:
import time
import random
import sys
import os
import subprocess
import PySimpleGUI as sg
from datetime import datetime
form = sg.FlexForm('PythonTest')
layout = [
[sg.Text('Please enter your runtime settings')],
[sg.Text('How long to run (hours):', size=25), sg.InputText('12', key='runtime')],
[sg.Text('Interval of running (hours):', size=25), sg.InputText('2', key='minrangehours'), sg.InputText('5',key='maxrangehours')],
[sg.Text('Interval of break (minutes):', size=25), sg.InputText('15', key='minrangeminutes'), sg.InputText('60', key='maxrangeminutes')],
[sg.Submit(), sg.Cancel()]
]
window = sg.Window('Run Schedule', layout)
event, values = window.read()
if event == 'Cancel':
os._exit(0)
window.close()
try: #Make sure values are integers!
for item in values:
int(values[item])
except ValueError as e:
print ('You are noob like zhipei! Only number work in program') #how dare u call me noob zhipei (╬◥益◤)
os.system("pause")
os._exit(0)
starttime=time.perf_counter()
timedefault=values['runtime']
minrun = int(values['minrangehours'])
maxrun = int(values['maxrangehours'])
minbreak = int(values['minrangeminutes'])
maxbreak = int(values['maxrangeminutes'])
hours=int(3600)
minutes=int(60)
print(datetime.now().strftime("%H:%M:%S - ")+ "Running for " + str(timedefault) + " hours")
while( ((time.perf_counter()-starttime)/hours) < int(timedefault)):
runtime = random.randint(minrun*hours, maxrun*hours)
print(datetime.now().strftime("%H:%M:%S - ") + "This run will be for " + str(round(runtime/hours, 2)) + " hours")
startrun=time.perf_counter()
arr = os.listdir()
filename = ""
for file in arr:
if file.endswith(".exe"):
if len(file)==16:
filename = file
if filename == "":
print("FILE NOT FOUND")
os._exit(0)
DETACHED_PROCESS = 0x00000008
pid = subprocess.Popen([filename],creationflags=DETACHED_PROCESS).pid
while( ((time.perf_counter()-startrun) < runtime) and (((time.perf_counter()-starttime)/hours) < int(timedefault)) ):
pass
sleeptime = random.randint(minbreak*minutes,maxbreak*minutes)
temppath = os.getenv("LocalAppData")
arr = os.listdir(temppath + "\\Temp")
runningfile = ""
for file in arr:
if file.endswith(".exe"):
if len(file)==16:
runningfile = file
subprocess.call("taskkill /im "+runningfile, stdout=subprocess.PIPE)
subprocess.call("taskkill /im "+ "d2r.exe", stdout=subprocess.PIPE)
if ((time.perf_counter()-starttime)/hours) >= int(timedefault):
print(datetime.now().strftime("%H:%M:%S - ") + "Finished running. Stopping.")
os.system("pause")
os._exit(0)
print(datetime.now().strftime("%H:%M:%S - ") + "taking break for " + str(round(sleeptime/minutes, 2)) + " minutes")
time.sleep(sleeptime)