Open a program with python minimized or hidden.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wtzolt
    New Member
    • Feb 2010
    • 6

    Open a program with python minimized or hidden.

    Hi,

    What I'm trying to do is to write a script which would open an application only in process list. Meaning it would be "hidden". I don't even know if its possible in python.

    If its not possible, I would settle for even a function that would allow for a program to be opened with python in a minimized state like "wsMinimize d" from Delphi, something like this:

    Code:
    import subprocess
    def startProgram():
        subrpocess.minimize(subprocess.Popen('C:\test.exe')) #  I know this is wrong but you get the idea...
    startProgram()
    Any ideas?
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    There is a way on Windows using win32com.client . Example
    Code:
    import win32com.client
    wordapp = win32com.client.Dispatch("Word.Application")
    wordapp.Visible=0

    Comment

    • wtzolt
      New Member
      • Feb 2010
      • 6

      #3
      Originally posted by bvdet
      There is a way on Windows using win32com.client . Example
      Code:
      import win32com.client
      wordapp = win32com.client.Dispatch("Word.Application")
      wordapp.Visible=0
      Yes the problem is that the program that i want to lounch and hide doesn't have
      a COM server registered under the name.
      Its just a simple number crunching program outputting the results onto desktop.

      There has to be a way to do this using subprocess...

      Comment

      • bvdet
        Recognized Expert Specialist
        • Oct 2006
        • 2851

        #4
        Try the following. It may not work on child windows spawned by the process.
        Code:
        import subprocess
        
        info = subprocess.STARTUPINFO()
        info.dwFlags = 1
        info.wShowWindow = 0
        subprocess.Popen("notepad.exe", startupinfo=info)

        Comment

        • wtzolt
          New Member
          • Feb 2010
          • 6

          #5
          Not working...
          Had no idea such a simple thing to do was so awkward.

          Comment

          • Glenton
            Recognized Expert Contributor
            • Nov 2008
            • 391

            #6
            Perhaps it can be done with threads?

            Comment

            • wtzolt
              New Member
              • Feb 2010
              • 6

              #7
              Never worked with threads so can't really imagine where to even begin to be honest.

              Comment

              Working...