Jump to content

Minimize Windows Executing APP


 Share

Recommended Posts

Hi to All

I have something to ask

I have an Wrote an example App that will open CMD.exe the menu will open and you click on Enable

How do i get the App Menu minimized after CMD.exe is open .?

Exmaple

#include <GUIConstantsEx.au3>

opt("MustDeclareVars", 1)

_MAIN()

Func _MAIN()

Local $YESID, $NOID, $EXITID, $MSG

GUICreate("CMD OPEN", 320, 100)

GUICtrlCreateLabel("CMD OPEn", 10, 10)

$YESID = GUICtrlCreateButton("Notepad.exe", 10, 50, 50, 20)

$NOID = GUICtrlCreateButton("CMD", 80, 50, 50, 20)

$EXITID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)

GUISetState()

Do

$MSG = GUIGetMsg()

Select

Case $MSG = $YESID

Run("notepad.exe")

Sleep(1000)

;RunWait("net stop fcsam")

;Sleep(1000)

Case $MSG = $NOID

Run("cmd.exe")

Sleep(1000)

Case $MSG = $EXITID

Case $MSG = $GUI_EVENT_CLOSE

MsgBox(0, "Application Will Exit", "Close")

EndSelect

Until $MSG = $GUI_EVENT_CLOSE Or $MSG = $EXITID Or $MSG = $YESID Or $MSG = $NOID

EndFunc

Sleep("1000")

Exit

#include <GUIConstantsEx.au3>
opt("MustDeclareVars", 1)
_MAIN()

Func _MAIN()
    Local $YESID, $NOID, $EXITID, $MSG
    GUICreate("CMD OPEN", 320, 100)
    GUICtrlCreateLabel("CMD OPEn", 10, 10)
    $YESID = GUICtrlCreateButton("Notepad.exe", 10, 50, 50, 20)
    $NOID = GUICtrlCreateButton("CMD", 80, 50, 50, 20)
    $EXITID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
    GUISetState()
    Do
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $YESID
                Run("notepad.exe")
                Sleep(1000)
                ;RunWait("net stop fcsam")
                ;Sleep(1000)
            Case $MSG = $NOID
                Run("cmd.exe")
                Sleep(1000)
            Case $MSG = $EXITID
            Case $MSG = $GUI_EVENT_CLOSE
                MsgBox(0, "Application Will Exit", "Close")
        EndSelect
    Until $MSG = $GUI_EVENT_CLOSE Or $MSG = $EXITID Or $MSG = $YESID Or $MSG = $NOID
EndFunc

Sleep("1000")
Exit

How can i change the code that if you open an App like CMD.exe from the Option Menu that the main

Windows can just Minimize to my system tray so if im finished with the App Example opening the CMD.exe in my script i can

Only click on the main menu to choose the new App i wanne open.

CMD Example.au3

Link to comment
Share on other sites

Use

GUISetState(@SW_MINIMIZE)
to minimize the GUI.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Use

GUISetState(@SW_MINIMIZE)
to minimize the GUI.

Thanx Its working fine now

#include <GUIConstantsEx.au3>
opt("MustDeclareVars", 1)
_MAIN()

Func _MAIN()
    Local $YESID, $NOID, $EXITID, $MSG
    GUICreate("CMD OPEN", 320, 100)
    GUICtrlCreateLabel("CMD OPEn", 10, 10)
    $YESID = GUICtrlCreateButton("Notepad.exe", 10, 50, 50, 20)
    $NOID = GUICtrlCreateButton("CMD", 80, 50, 50, 20)
    $EXITID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
    GUISetState()
    Do
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $YESID
                Run("notepad.exe")
                Sleep(1000)
                ;RunWait("net stop fcsam")
                ;Sleep(1000)
                GUISetState(@SW_MINIMIZE)
            Case $MSG = $NOID
                Run("cmd.exe")
                Sleep(1000)
                GUISetState(@SW_MINIMIZE)
            Case $MSG = $EXITID
            Case $MSG = $GUI_EVENT_CLOSE

                MsgBox(0, "Application Will Exit", "Close")
        EndSelect
    Until $MSG = $GUI_EVENT_CLOSE or $MSG = $EXITID
EndFunc

Sleep("1000")
Exit

I did it like this and it seems to work after i lick on the open it minimizes

Thanx for the Help

:-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...