www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#pip install pyautogui -i https://pypi.tuna.tsinghua.edu.cn/simple/
#pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple/
#pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple/
#
#pip install pypiwin32 -i https://pypi.tuna.tsinghua.edu.cn/simple/
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import pyautogui
import cv2
import numpy as np
import os 
'''
img = pyautogui.screenshot(region=[300,50,200,100])
img = cv2.cvtColor(np.asarray(img),cv2.COLOR_RGB2BGR)

cv2.imshow("截屏",img)
#cv2.waitKey(0)
'''

from PyQt5.QtWidgets import QApplication
import win32gui
import sys
import configconst
import time


print(configconst.SAVE_PATH)
pt = configconst.SAVE_PATH
#time.sleep(5)

hwnd = win32gui.FindWindow(None, 'C:/Windows/system32/cmd.exe')
app = QApplication(sys.argv)
screen = QApplication.primaryScreen()
img = screen.grabWindow(hwnd).toImage()
import time
dt = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())
print(dt)
#os.chdir(r"C:\Users\Administrator\Desktop\问题处理\images")
#os.chdir(pt)

if os.path.exists(pt):
    #os.chdir(r"C:\Users\Administrator\Desktop\问题处理\images")
    os.chdir(pt)
    print("dir ok")
else:
    print("创建dir")
    os.makedirs(pt, exist_ok=True)
    os.chdir(pt)
    
img.save("%s-screenshot.jpg"%(dt))
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c chk.bat",vbhide

 

posted on 2022-11-16 15:51  秦瑞It行程实录  阅读(116)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui