Jump to content

GUIDelete()


Go to solution Solved by argumentum,

Recommended Posts

Posted

Good day,
I hope that the day finds each of you very well!

I need to ensure that the GUI is properly exited!  Here is my current script:
 

; -----------------------------------------------
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $ExitSACGui
; -----------------------------------------------
LiveGui()
; -----------------------------------------------
Func LiveGui()
    $ExitSACGui = GUICreate("", 75, 23, 630, 50, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetFont(14, 800, 0, "Calibri")
    GUISetBkColor(0x3D3D3D)
    ; -----------------------------------------------
    Local $sColRow = GUICtrlCreateLabel(" Exit SAC", 0, 0, 75, 23, $SS_CENTER)
    GUICtrlSetColor(-1, 0xFFFFFF)
    ; -----------------------------------------------
    GUISetState(@SW_SHOW)
    ; -----------------------------------------------
    While 1
        Switch GUIGetMsg()
            Case $sColRow
                ExitSACTTA()
                GUIDelete($ExitSACGui)
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>LiveGui
; -----------------------------------------------
Func ExitSACTTA()
    ExitSAC()
    LaunchTTA()
EndFunc   ;==>ExitSACTTA
; -----------------------------------------------
Func ExitSAC()
    Local $sSrcPath1a = "C:\RML\SAC\SAC64.exe"
    Local $sSrcPath1b = "SAC64.exe"
    Local $PID = 0
    ; -----------------------------------------------
    ProcessClose($sSrcPath1a)
    $PID = ProcessExists($sSrcPath1b)
    If $PID Then ProcessClose($PID)
EndFunc   ;==>ExitSAC
; -----------------------------------------------
Func LaunchTTA()
    Local $sSrcPath = "C:\Windows\toggleTaskbarAutohide.exe"
    ; -----------------------------------------------
    Run($sSrcPath)
    Sleep(100)
EndFunc   ;==>LaunchTTA
; -----------------------------------------------

As always...any assistance in this matter would be greatly appreciated! Thank you!

  • Solution
Posted
1 hour ago, mr-es335 said:

Good day,
I hope that the day finds each of you very well!

I need to ensure that the GUI is properly exited!  Here is my current script:
 

; -----------------------------------------------
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $ExitSACGui
; -----------------------------------------------
LiveGui()
; -----------------------------------------------
Func LiveGui()
    $ExitSACGui = GUICreate("", 75, 23, 630, 50, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetFont(14, 800, 0, "Calibri")
    GUISetBkColor(0x3D3D3D)
    ; -----------------------------------------------
    Local $sColRow = GUICtrlCreateLabel(" Exit SAC", 0, 0, 75, 23, $SS_CENTER)
    GUICtrlSetColor(-1, 0xFFFFFF)
    ; -----------------------------------------------
    GUISetState(@SW_SHOW)
    ; -----------------------------------------------
    While 1
        Switch GUIGetMsg()
            Case $sColRow
                ExitSACTTA()
                GUIDelete($ExitSACGui)
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>LiveGui
; -----------------------------------------------
Func ExitSACTTA()
    ExitSAC()
    LaunchTTA()
EndFunc   ;==>ExitSACTTA
; -----------------------------------------------
Func ExitSAC()
    Local $sSrcPath1a = "C:\RML\SAC\SAC64.exe"
    Local $sSrcPath1b = "SAC64.exe"
    Local $PID = 0
    ; -----------------------------------------------
    ProcessClose($sSrcPath1a)
    $PID = ProcessExists($sSrcPath1b)
    If $PID Then ProcessClose($PID)
EndFunc   ;==>ExitSAC
; -----------------------------------------------
Func LaunchTTA()
    Local $sSrcPath = "C:\Windows\toggleTaskbarAutohide.exe"
    ; -----------------------------------------------
    Run($sSrcPath)
    Sleep(100)
EndFunc   ;==>LaunchTTA
; -----------------------------------------------

As always...any assistance in this matter would be greatly appreciated! Thank you!

Yes it is. Why are you asking ?

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

@SmileFace123 Could you please post full sentences?
I see you are new on this forum. The goal of this forum is to help other users with their problems. Two word sentences do not help very much ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

When you learn to ride a bike, you don't ask your parents every 100 metres whether you're doing it right.
As long as you don't fall, you're doing it right.

It's the same with programming.
If it works, then you've done a lot of things right. Maybe not efficiently or according to all the rules of programming, but it works.

You've been working with AutoIt long enough that you should have this confidence in your own abilities and not have to ask after every 5 lines of code.
Have more confidence! If it works, then it's good. If you get wrong results or error messages, that's the time to ask.

Just my 2 cents worth!

Written with the help of DeepL.com translator ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

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
  • Recently Browsing   1 member

×
×
  • Create New...