當我點擊一個新窗口按鈕時,它總是在Windows 7 64位操作系統的後臺打開。如何在pyautoit中顯示總是出現在背景中而不是前景的窗口?
對於我的自動化任務,我需要將該窗口置於前臺。
以下是我pyautoit代碼:
autoit.send("{TAB 2}")
sleep(3)
autoit.send("{ENTER}") # After this step new window appears in background
Wnd = autoit.win_wait("[CLASS:#32770]", 15)
autoit.win_activate(Wnd)
sleep(5)
autoit.send("{ENTER}")
我試圖win_wait和win_activate,如下圖所示:
Wnd = autoit.win_wait("[CLASS:#32770]", 15)
autoit.win_activate(Wnd)
但我得到以下錯誤:
WindowsError: exception: access violation reading 0x00000001
然後我嘗試瞭如下URL所示的「regedit」選項:
http://ask.brothersoft.com/when-i-open-a-program-window-sometimes-it-opens-in-the-background-instead-of-the-foreground-253939.html
但沒有用。我仍然看到同樣的問題。
任何人都可以幫我解決這個問題嗎?
嘗試不同直接從Autoit運行。 isHandle Winactivate等。如果可行,那麼在你的py腳本中使用那個。 – Xenobiologist