Jump to content

How to send a command to close a window


WiorDi37
 Share

Recommended Posts

Hello, Everyone!

I want when clicking the exit button the window will close. If content changes upon exit the program will automatically choose not save.

Look forward to the help, thanks.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>

$GUI = GUICreate("Form1", 220, 119, 192, 124, $WS_SYSMENU)
GUISetFont(10, 400, 0, "Tahoma")
GUICtrlCreateGroup("Chuẩn bị trình chiếu", 16, 16, 185, 65)
$ok_Button = GUICtrlCreateButton("Ok", 32, 48, 75, 25)
$exit_Button = GUICtrlCreateButton("Exit", 112, 48, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $ok_Button
            ShellExecute(@MyDocumentsDir&'\Dich-thuat\Short-Document.pdf', "", "", Default, @SW_MAXIMIZE)
            WinWaitActive("Data and Computer Communications (Eighth Edition) - Google Chrome")
            ShellExecute(@MyDocumentsDir&'\Dich-thuat\Document.rtf', "", "", Default, @SW_MAXIMIZE)
            WinWaitActive("Document.rtf [Compatibility Mode] - Word")
            ShellExecute(@MyDocumentsDir&'\Dich-thuat\Presentation1.pptx', "", "", Default, @SW_MAXIMIZE)
            WinWaitActive("Presentation1.pptx - PowerPoint")
            MouseClick("left", 1381, 886, 1)
            Sleep(2000)
            MsgBox(64, "Thông báo", "Đã chuẩn bị xong")
        Case $exit_Button
            WinClose("Presentation1.pptx - PowerPoint")
            
            ;I need help handling this place
        
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

3.png

Link to comment
Share on other sites

Winwait for that window and controlclick the button you want.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

What about this?

WinWaitActive("Microsoft PowerPoint", "Save")
Send("!n")
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

×
×
  • Create New...