你好。当Popen调用时,我尝试在sqlservermgmtstudio中模拟Enter键ssms.exe我们失败了。我需要什么来编码?我显然是个Python新手。***目标是点击Enter,这样SSMS一旦启动就可以“连接”。如果需要,请查看屏幕截图。非常感谢。你知道吗
#! python3
from subprocess import Popen
import pyautogui
import time
import os
import signal
## 1. To open SSMS:
proc = Popen("C:\\Program Files (x86)\\Microsoft SQL Server\\130\\Tools\\Binn\\ManagementStudio\\Ssms.exe", shell=True)
print("After Popen")
proc.wait()
print("After wait")
focus = False
print("After focus")
while (focus == False):
print("In While loop")
focus = pyautogui.PAUSE = 1
pyautogui.FAILSAFE = True
pyautogui.press('enter')
if (focus == True):
break
目前没有回答
相关问题 更多 >
编程相关推荐