minimize application automatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vamsioracle
    New Member
    • Jun 2007
    • 151

    minimize application automatically

    Hi all

    Is it possible to minimize an application using batch file. i mean is it possible to control the minimize or maximize or close button of an application in windows xp, without using the mouse or keyboard short cuts. I want a batch file that does this for me when i login.
  • Studlyami
    Recognized Expert Contributor
    • Sep 2007
    • 464

    #2
    I don't know about a batch file, but you can do this by creating a program which would use the win32API. You can get a handle to all windows that are open then you could send the the minimize command. the same should go for maximize and possibly close, but I think they have implemented some features which would help prevent a process from closing some programs.

    Comment

    • DonRayner
      Recognized Expert Contributor
      • Sep 2008
      • 489

      #3
      I'm not sure how to do it directly from a Batch file but you can use a vbs file to perform the task and call the vbs from the batch file. vbs(visual basic script). To create the vbs file just open notepad and create it like you would any other document. Save the file and then rename it. MyFile.txt would become MyFile.vbs

      In your batch file you would then just call up the vbs file just like you would any other executable file.

      Example of your batch file could be

      Code:
      Echo Test Batch File
      MyFile.vbs
      Echo vbs has been executed
      An example for the MyFile.vbs would be

      Code:
      set shell = createobject("wscript.shell") 
      appactive = shell.appactivate("notepad") 
      if appactive then shell.sendkeys "% n"
      set shell = nothing
      This example uses notepad but you could use any application name in place of it. Only stipulation for use would be that the minimize function be available through some sort of keyboard shortcut, then using the sendkey function you would sent the keys to the application as if you were typing them on the keyboard.

      Don

      Comment

      Working...