Need help to run code that automatically starts at 4:30pm every day on Python Visual Studio Code. I don't want to print anything I just want to execute my commands like: pg.keyUp('enter')
.
For example.
import schedule
import time
def job():
pg.keyUp('enter') < This no work
schedule.every(60).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
Only works with printing text.
I use a 3rd-party software called Task Till Dawn. I believe it's open-sourced, and it works really well.
You can use crontab to run the script at 16:30 every day.
30 16 * * * /usr/bin/python script.py
Change script.py to the full python file location
Here is a guide on how to use crontabs
Using Task Till Dawn, I was able to schedule a python script to run on Windows. It looks like it should work on a mac too according to their downloads . Here are the steps I took:
"C:/ProgramData/Anaconda3/envs/py37/pythonw.exe" "C:/pathto/test.py"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.