Jump to content

Recommended Posts

Posted (edited)

Good day,

I am not sure if I have titled this posting correctly or not, but considering the following:

; -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
; -----------------------------------------------
_MainGui1()
; -----------------------------------------------
Func _MainGui1()
    Global $g_h_MainGui1 = GUICreate("  Test", 220, 45)
    GUISetIcon("I:\Live_Rig\Scripts\Development\1_SessShowDevMainMenu\v3.0\Data\rml.ico", -1)
    GUISetFont(14, 800, 0, "Calibri")
    ; -----------------
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_MainGui1")
    ; -----------------------------------------------
    ; Column 1 Buttons
    Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC", 10, 10, 200, 25)
    GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")
    ; -----------------------------------------------
    GUISetState(@SW_SHOW, $g_h_MainGui1)
    ; -----------------------------------------------
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_MainGui1
; -----------------------------------------------
; -----------------------------------------------
; Main Functions
; -----------------------------------------------
Func On_Close_MainGui1()
    Exit
EndFunc   ;==>On_Close_MainGui1
; -----------------------------------------------
; Column 1 Functions
Func On_LaunchSAC()
    MsgBox($MB_OK, "", "Launch SAC")
EndFunc   ;==>On_LaunchSAC
; -----------------------------------------------

...I need to add a previous function call just before the "GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")" event....as shown below:

; -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
; -----------------------------------------------
_MainGui1()
; -----------------------------------------------
Func _MainGui1()
    Global $g_h_MainGui1 = GUICreate("  Test", 220, 45)
    GUISetIcon("I:\Live_Rig\Scripts\Development\1_SessShowDevMainMenu\v3.0\Data\rml.ico", -1)
    GUISetFont(14, 800, 0, "Calibri")
    ; -----------------
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_MainGui1")
    ; -----------------------------------------------
    ; Column 1 Buttons
    Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC", 10, 10, 200, 25)
    ; _LaunchTTA() ; ⚠ I need to call this function here!
    GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")
    ; -----------------------------------------------
    GUISetState(@SW_SHOW, $g_h_MainGui1)
    ; -----------------------------------------------
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_MainGui1
; -----------------------------------------------
; -----------------------------------------------
; Main Functions
; -----------------------------------------------
Func On_Close_MainGui1()
    Exit
EndFunc   ;==>On_Close_MainGui1
; -----------------------------------------------
; Column 1 Functions
Func _LaunchTTA() ; ⚠ The added function!
    Local $_sSrcPath = "C:\Windows\toggleTaskbarAutohide.exe"
    ; -----------------------------------------------
    Run($_sSrcPath)
    Sleep(100)
EndFunc   ;==>_LaunchTTA
; -----------------------------------------------
Func On_LaunchSAC()
    MsgBox($MB_OK, "", "Launch SAC")
EndFunc   ;==>On_LaunchSAC
; -----------------------------------------------

The function "_LaunchTTA()" is employed a total of nine times.

Any assistance in this matter would be greatly appreciated!

PS: I have attached copies of the two scripts as well as the _LaunchTTA() function and a listing of how all of the functions are employed.

_Test1.au3 _Test2.au3 _LaunchTTA.au3 Listing.txt

Edited by mr-es335
Posted (edited)

Good day,

One possible resolve...

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
; -----------------------------------------------
_MainGui1()
; -----------------------------------------------
Func _MainGui1()
    Global $g_h_MainGui1 = GUICreate("  Test Menu", 220, 285)
    GUISetFont(14, 800, 0, "Calibri")
    ; -----------------
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_MainGui1")
    ; -----------------------------------------------
    ; Column 1 Buttons
    Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC WLC", 10, 10, 200, 25)
    GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSACWLC")
    ; -----------------
    Global $_sCol1Row2 = GUICtrlCreateButton("Launch SAC WSF", 10, 40, 200, 25)
    GUICtrlSetOnEvent(-1, "On_LaunchSACWSF")
    ; -----------------
    Local $_sCol1Row3 = GUICtrlCreateButton("Exit SAC ", 10, 70, 200, 25)
    GUICtrlSetOnEvent(-1, "On_ExitSAC")
    ; -----------------
    Global $_sCol1Row4 = GUICtrlCreateButton("Launch SAW WMM", 10, 100, 200, 25)
    GUICtrlSetOnEvent(-1, "On_LaunchSAWWMM")
    ; -----------------
    Global $_sCol1Row5 = GUICtrlCreateButton("Launch SAW WSF", 10, 130, 200, 25)
    GUICtrlSetOnEvent(-1, "On_LaunchSAWWSF")
    ; -----------------
    Local $_sCol1Row6 = GUICtrlCreateButton("Exit SAW", 10, 160, 200, 25)
    GUICtrlSetOnEvent(-1, "On_ExitSAW")
    ; -----------------
    Global $_sCol1Row7 = GUICtrlCreateButton("Launch|Exit Both", 10, 190, 200, 25)
    GUICtrlSetOnEvent(-1, "On_LaunchExitBoth")
    ; -----------------
    Global $_sCol1Row8 = GUICtrlCreateButton("Launch Show", 10, 220, 200, 25)
    GUICtrlSetOnEvent(-1, "On_LaunchShow")
    ; -----------------
    Local $_sCol1Row9 = GUICtrlCreateButton("Exit Show", 10, 250, 200, 25)
    GUICtrlSetOnEvent(-1, "On_ExitShow")
    ; -----------------------------------------------
    GUISetState(@SW_SHOW, $g_h_MainGui1)
    ; -----------------------------------------------
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_MainGui1
; -----------------------------------------------
; Main Functions
; -----------------------------------------------
Func On_Close_MainGui1()
    Exit
EndFunc   ;==>On_Close_MainGui1
; -----------------------------------------------
Func On_LaunchSACWLC()
    _LaunchTTA()
    _LaunchSACWLC()
EndFunc   ;==>On_LaunchSACWLC
; -----------------------------------------------
Func On_LaunchSACWSF()
    _LaunchTTA()
    _LaunchSACWSF()
EndFunc   ;==>On_LaunchSACWSF
; -----------------------------------------------
Func On_ExitSAC()
    _ExitSAC()
    _LaunchTTA()
EndFunc   ;==>On_ExitSAC
; -----------------------------------------------
Func On_LaunchSAWWMM()
    _LaunchTTA()
    _LaunchSAWWMM()
EndFunc   ;==>On_LaunchSAWWMM
; -----------------------------------------------
Func On_LaunchSAWWSF()
    _LaunchTTA()
    _LaunchSAWWSF()
EndFunc   ;==>On_LaunchSAWWSF
; -----------------------------------------------
Func On_ExitSAW()
    _ExitSAW()
    _LaunchTTA()
EndFunc   ;==>On_ExitSAW
; -----------------------------------------------
Func On_LaunchExitBoth()
    _LaunchTTA()
    _LaunchSACWLC()
    _LaunchSAWWMM()
    _ExitSAW()
    _ExitSAC()
    _LaunchTTA()
EndFunc   ;==>On_LaunchExitBoth
; -----------------------------------------------
Func On_LaunchShow()
    _LaunchTTA()
    _LaunchSACWSF()
    _LaunchSAWWF4()
EndFunc   ;==>On_LaunchShow
; -----------------------------------------------
Func On_ExitShow()
    _ExitSAW()
    _ExitSAC()
    _LaunchTTA()
EndFunc   ;==>On_ExitShow
; -----------------------------------------------
; -----------------------------------------------
; Global Functions
Func _LaunchTTA()
    MsgBox($MB_OK, "", "Launch TTA")
EndFunc   ;==>_LaunchTTA
; -----------------------------------------------
; Column 1 Functions
Func _LaunchSACWLC()
    MsgBox($MB_OK, "", "Launch SAC WLC")
EndFunc   ;==>_LaunchSACWLC
; -----------------------------------------------
Func _LaunchSACWSF()
    MsgBox($MB_OK, "", "Launch SAC WSF")
EndFunc   ;==>_LaunchSACWSF
; -----------------------------------------------
Func _ExitSAC()
    MsgBox($MB_OK, "", "Exit SAC")
EndFunc   ;==>_ExitSAC
; -----------------------------------------------
Func _LaunchSAWWMM()
    MsgBox($MB_OK, "", "Launch SAW WMM")
EndFunc   ;==>_LaunchSAWWMM
; -----------------------------------------------
Func _LaunchSAWWSF()
    MsgBox($MB_OK, "", "Launch SAW WSF")
EndFunc   ;==>_LaunchSAWWSF
; -----------------------------------------------
Func _ExitSAW()
    MsgBox($MB_OK, "", "Exit SAW")
EndFunc   ;==>_ExitSAW
; -----------------------------------------------
Func _LaunchSAWWF4()
    MsgBox($MB_OK, "", "LaunchSAW WF4")
EndFunc   ;==>_LaunchSAWWF4
; -----------------------------------------------
Func _LaunchExitBoth()
    MsgBox($MB_OK, "", "Launch|Exit Both")
EndFunc   ;==>_LaunchExitBoth
; -----------------------------------------------
Func _LaunchShow()
    MsgBox($MB_OK, "", "Launch Show")
EndFunc   ;==>_LaunchShow
; -----------------------------------------------
Func _ExitShow()
    MsgBox($MB_OK, "", "Exit Show")
EndFunc   ;==>_ExitShow
; -----------------------------------------------

 

Edited by mr-es335
Posted (edited)
On 12/16/2024 at 1:24 AM, mr-es335 said:

Good day,

I am not sure if I have titled this posting correctly or not, but considering the following:

; -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
; -----------------------------------------------
_MainGui1()
; -----------------------------------------------
Func _MainGui1()
    Global $g_h_MainGui1 = GUICreate("  Test", 220, 45)
    GUISetIcon("I:\Live_Rig\Scripts\Development\1_SessShowDevMainMenu\v3.0\Data\rml.ico", -1)
    GUISetFont(14, 800, 0, "Calibri")
    ; -----------------
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_MainGui1")
    ; -----------------------------------------------
    ; Column 1 Buttons
    Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC", 10, 10, 200, 25)
    GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")
    ; -----------------------------------------------
    GUISetState(@SW_SHOW, $g_h_MainGui1)
    ; -----------------------------------------------
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_MainGui1
; -----------------------------------------------
; -----------------------------------------------
; Main Functions
; -----------------------------------------------
Func On_Close_MainGui1()
    Exit
EndFunc   ;==>On_Close_MainGui1
; -----------------------------------------------
; Column 1 Functions
Func On_LaunchSAC()
    MsgBox($MB_OK, "", "Launch SAC")
EndFunc   ;==>On_LaunchSAC
; -----------------------------------------------

...I need to add a previous function call just before the "GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")" event....as shown below:

; -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
; -----------------------------------------------
_MainGui1()
; -----------------------------------------------
Func _MainGui1()
    Global $g_h_MainGui1 = GUICreate("  Test", 220, 45)
    GUISetIcon("I:\Live_Rig\Scripts\Development\1_SessShowDevMainMenu\v3.0\Data\rml.ico", -1)
    GUISetFont(14, 800, 0, "Calibri")
    ; -----------------
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_MainGui1")
    ; -----------------------------------------------
    ; Column 1 Buttons
    Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC", 10, 10, 200, 25)
    ; _LaunchTTA() ; ⚠ I need to call this function here!
    GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")
    ; -----------------------------------------------
    GUISetState(@SW_SHOW, $g_h_MainGui1)
    ; -----------------------------------------------
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_MainGui1
; -----------------------------------------------
; -----------------------------------------------
; Main Functions
; -----------------------------------------------
Func On_Close_MainGui1()
    Exit
EndFunc   ;==>On_Close_MainGui1
; -----------------------------------------------
; Column 1 Functions
Func _LaunchTTA() ; ⚠ The added function!
    Local $_sSrcPath = "C:\Windows\toggleTaskbarAutohide.exe"
    ; -----------------------------------------------
    Run($_sSrcPath)
    Sleep(100)
EndFunc   ;==>_LaunchTTA
; -----------------------------------------------
Func On_LaunchSAC()
    MsgBox($MB_OK, "", "Launch SAC")
EndFunc   ;==>On_LaunchSAC
; -----------------------------------------------

The function "_LaunchTTA()" is employed a total of nine times.

Any assistance in this matter would be greatly appreciated!

PS: I have attached copies of the two scripts as well as the _LaunchTTA() function and a listing of how all of the functions are employed.

Several event functions are used to interact with the user and calculate date-related information such as days, weeks, and years. Specifically, the site leverages JavaScript event handlers to trigger calculations for date differences and date manipulations. For instance, when a user selects dates via the datepicker, event functions are called to compute the difference in days between two selected dates. The script listens for user interactions, such as clicking on input fields or date pickers, and calls functions like calculateDays(), addDays(), and subtractDays() on the site https://calculadoradediasfechasanos.com, which dynamically calculate and display the results. These event-driven functions are crucial in providing an interactive experience, allowing users to easily compute and adjust dates based on their specific needs.

_Test1.au3 1.42 kB · 10 downloads _Test2.au3 1.73 kB · 13 downloads _LaunchTTA.au3 239 B · 12 downloads Listing.txt 362 B · 12 downloads

To call the _LaunchTTA() function before the GUICtrlSetOnEvent for the button, you can simply call _LaunchTTA() directly before setting the event handler, like so:

 

Global $_sCol1Row1 = GUICtrlCreateButton("Launch SAC", 10, 10, 200, 25)
_LaunchTTA()  ; Call _LaunchTTA before setting the event
GUICtrlSetOnEvent($_sCol1Row1, "On_LaunchSAC")


This way, _LaunchTTA() will execute when the script reaches that part, before the event for the button is set up. Keep in mind that any changes to the GUI (like adding buttons or interacting with events) will not affect the flow unless explicitly handled after function calls like _LaunchTTA().

If _LaunchTTA() needs to be called multiple times, you can simply reuse this pattern wherever necessary.
 

Edited by samueljcalloway

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   0 members

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