验证中...
定时打开360网页和关闭
原始数据 复制代码
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: #梦幻人生人
@license: Apache Licence
@contact: 1229218283@qq.com
@site: none
@software: PyCharm
@file: main.py
@time: 2018/1/8 0:27
"""
import win32api
import os
import datetime
import time
"""
#例子:
#打开指定应用
win32api.ShellExecute(0, 'open', r'D:\Users\Administrator\AppData'
r'\Roaming\baidu\BaiduNetdisk\BaiduNetdisk.exe', '','',1)
#关闭指定应用
os.system("taskkill /F /IM BaiduNetdisk.exe")
"""
def openApplication():
#打开360网页
win32api.ShellExecute(0, 'open', r'C:\Users\Administrator'
r'\AppData\Roaming\360se6\Application\360se.exe', '', '', 1)
def closeApplication():
#关闭360网页
os.system("taskkill /F /IM 360se.exe")
opentime={'hour':17,'minute':50,'second':0}
closetime={'hour':2,'minute':0,'second':0}
while True:
nowtime = datetime.datetime.now()
print unicode("当前的日期和时间是 %s" %nowtime,'utf-8')
if nowtime.hour == opentime['hour'] and nowtime.minute == opentime['minute']\
and nowtime.second == opentime['second']:
openApplication()
elif nowtime.hour == closetime['hour'] and nowtime.minute == closetime['minute'] \
and nowtime.second == closetime['second']:
closeApplication()
time.sleep(1)

评论列表( 0 )

你可以在登录后,发表评论

8_float_left_people 8_float_left_close