mirror of
https://github.com/WMK965/965-Python-Learning-Repo.git
synced 2025-04-27 07:53:21 +00:00
Update Tools
This commit is contained in:
commit
d878973881
55
Executor/main.py
Normal file
55
Executor/main.py
Normal file
@ -0,0 +1,55 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
if len(sys.argv) == 1 or str(sys.argv[1]) == "/?":
|
||||
print('''Usage: /q/ for quotes
|
||||
/? for this help message
|
||||
/a <arg> for customize exec (Do not require /q/)
|
||||
/l <Link> execute as custom Link''')
|
||||
sys.exit()
|
||||
|
||||
count = len(sys.argv)
|
||||
in_string = str()
|
||||
data = sys.argv[1:]
|
||||
exec_program = 'C:\Program Files\Google\Chrome\Application\chrome.exe'
|
||||
processed = 0
|
||||
if '/l' in sys.argv and processed == 0:
|
||||
argp = sys.argv.index('/l')
|
||||
if len(sys.argv) <= 4:
|
||||
in_string = " " + str(str(sys.argv[argp + 1]).split('//')[1])
|
||||
data = sys.argv[2]
|
||||
if "/a" in data:
|
||||
in_string = ""
|
||||
data = str(data).split("%20")[1:]
|
||||
processed = 0
|
||||
else:
|
||||
print("Single Value")
|
||||
processed = 1
|
||||
data = []
|
||||
elif len(sys.argv) >= 5:
|
||||
in_string = str(str(sys.argv[argp + 1]).split('//')[1])[:-1]
|
||||
data = sys.argv[1:argp] + sys.argv[argp + 2:]
|
||||
argp = data.index('/a')
|
||||
exec_program = str(data[argp + 1])
|
||||
data = data[1:argp] + data[argp + 2:]
|
||||
processed = 1
|
||||
if '/a' in sys.argv and processed == 0:
|
||||
argp = sys.argv.index('/a')
|
||||
exec_program = str(sys.argv[argp + 1])
|
||||
data = sys.argv[1:argp] + sys.argv[argp + 2:]
|
||||
elif '/a' in data and processed == 0:
|
||||
argp = data.index('/a')
|
||||
exec_program = str(data[argp + 1]).replace("%5C", "\\")
|
||||
data = data[1:argp] + data[argp + 2:]
|
||||
print(f'Count: {count}', f'\nData List:{data}', f'\nSys Arguments List:{sys.argv}')
|
||||
for arg in data:
|
||||
if "/q/" in arg:
|
||||
if "/q/" in arg[:3]:
|
||||
arg = f'"{arg[3:]}'
|
||||
if "/q/" in arg[-3:]:
|
||||
arg = f'{arg[:-3]}"'
|
||||
in_string = in_string + " " + arg
|
||||
else:
|
||||
in_string = in_string + " " + arg
|
||||
print(f'Starting: "{exec_program}"{in_string}')
|
||||
print(os.popen(f'"{exec_program}"{in_string}').read())
|
65
PyForceAwake/main.py
Normal file
65
PyForceAwake/main.py
Normal file
@ -0,0 +1,65 @@
|
||||
import pyautogui
|
||||
import time
|
||||
import os
|
||||
|
||||
# basePATH
|
||||
screenWidth, screenHeight = pyautogui.size()
|
||||
currentMouseX, currentMouseY = pyautogui.position()
|
||||
loop = 1
|
||||
time_set = 0
|
||||
|
||||
|
||||
while True:
|
||||
inp = int(input('''*****************************************
|
||||
** 当前时间 {0} **
|
||||
*****************************************
|
||||
** 扣1继续 | 扣2设置时间(%H:%M & min) **
|
||||
*****************************************
|
||||
'''.format(time.strftime("%H:%M:%S", time.localtime()))))
|
||||
|
||||
if inp == 1:
|
||||
|
||||
while loop > 0:
|
||||
print("[INFO][{0}] Moving...".format(time.strftime("%H:%M:%S", time.localtime())))
|
||||
pyautogui.moveTo(1280, 720)
|
||||
time.sleep(4)
|
||||
pyautogui.moveTo(1920, 1080, duration=2)
|
||||
pyautogui.click()
|
||||
time.sleep(594)
|
||||
print("[INFO][{0}] Loop {1} Ended".format(time.strftime("%H:%M:%S", time.localtime()), loop))
|
||||
loop = loop - 1
|
||||
|
||||
if time_set == 1:
|
||||
os.system("shutdown -s -t 60")
|
||||
|
||||
break
|
||||
|
||||
elif inp == 2:
|
||||
target = input()
|
||||
time_set = 1
|
||||
local_min = 60 * int(time.strftime("%H:%M", time.localtime()).split(":")[0]) + int(time.strftime("%H:%M", time.localtime()).split(":")[1])
|
||||
|
||||
try:
|
||||
target_min = 60 * int(target.split(":")[0]) + int(target.split(":")[1])
|
||||
if target_min > local_min:
|
||||
loop = (target_min - local_min) // 10
|
||||
elif 0 < target_min - local_min < 10:
|
||||
loop = 1
|
||||
elif local_min - target_min > 720:
|
||||
loop = (target_min - local_min + 1440) // 10
|
||||
elif local_min - target_min <= 720:
|
||||
loop = (target_min - local_min + 720) // 10
|
||||
|
||||
except IndexError:
|
||||
target = int(target)
|
||||
if 0 < target < 10:
|
||||
loop = 1
|
||||
elif target > 10:
|
||||
loop = target // 10
|
||||
|
||||
except ValueError:
|
||||
print("[WARN][{0}] Input Format/Data Error".format(time.strftime("%H:%M:%S", time.localtime())))
|
||||
continue
|
||||
|
||||
print("[INFO][{0}] Scheduled Shutdown Enabled".format(time.strftime("%H:%M:%S", time.localtime())))
|
||||
print("[INFO][{0}] {1} Loop Set".format(time.strftime("%H:%M:%S", time.localtime()), loop))
|
Loading…
Reference in New Issue
Block a user