赞
踩
- #!/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)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。