Browse Source

feat:钢联

Roc 1 year ago
parent
commit
1c30cb21d9
1 changed files with 10 additions and 1 deletions
  1. 10 1
      rpa_mysteel_refresh.py

+ 10 - 1
rpa_mysteel_refresh.py

@@ -13,6 +13,9 @@ import datetime
 hug.API(__name__).http.output_format = hug.output_format.json
 
 exePath = r"C:\Program Files (x86)\Kingsoft\WPS Office\11.8.2.12085\office6\et"
+# exePath = exePath = r"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"
+# exePath = exePath = r"C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
+
 
 # 顶部钢联按钮的x,y位置
 gl_button_x = 645
@@ -44,7 +47,7 @@ def mysteel_chemical_refresh(FilePath):
     # FilePath = urllib.parse.unquote(FilePath)
     FilePath = FilePath.replace('"', '')
 
-    # pyautogui.hotkey('win', 'd')
+    pyautogui.hotkey('win', 'd')
     # time.sleep(2)
     #
     # moveX = 1100
@@ -107,6 +110,12 @@ def mysteel_chemical_refresh(FilePath):
 
             except Exception as e:
                 print("打开", fileFullPath, "失败:", e)
+
+                ## 失败的话,截图记录下原因
+                screenshot = pyautogui.screenshot()
+                imgPath = datetime.datetime.now().strftime("%Y%m%d%H%M%S")+"_screenshot_img.png"
+                screenshot.save(imgPath)
+
                 hwnd = win32gui.GetForegroundWindow()
                 found_title = win32gui.GetWindowText(hwnd)
                 print("窗口名称:", found_title)