OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to minimize a specific window in Python

  • Thread starter Thread starter Aisgbnok
  • Start date Start date
A

Aisgbnok

Guest
Hello I am new to Python and do not know how to minimize a specific window in this case Microsoft Word 2010 all I can minimize is the Python Shell. Here is my code just in case you need it.

Code:
import win32gui, win32con
import os
import math
import time

M=6
Minimize = win32gui.GetForegroundWindow()

print("Program Started on "+time.ctime())

while M >0:
time.sleep(1)
print(M," more seconds until Word is opened")
M -=1

time.sleep(1)    
os.startfile("C:\Documents and Settings\All Users\Start Menu\Programs\MicrosoftOffice\Microsoft Word 2010")
print("Microsoft Word 2010 opened "+time.ctime())

time.sleep(2)
win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE)
<p>Hello I am new to Python and do not know how to minimize a specific window in this case Microsoft Word 2010 all I can minimize is the Python Shell. Here is my code just in case you need it.</p>

<pre><code>import win32gui, win32con
import os
import math
import time

M=6
Minimize = win32gui.GetForegroundWindow()

print("Program Started on "+time.ctime())

while M >0:
time.sleep(1)
print(M," more seconds until Word is opened")
M -=1

time.sleep(1)
os.startfile("C:\Documents and Settings\All Users\Start Menu\Programs\MicrosoftOffice\Microsoft Word 2010")
print("Microsoft Word 2010 opened "+time.ctime())

time.sleep(2)
win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE)
</code></pre>
 
Top