Jump to content

Recommended Posts

Posted

Good day,

What am I doing wrong here?

; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
; For DisplayHotKeyOpt()
Global $sDisplayHotKeyOpt
Global $iMenuPosition
; -----------------------------------------------
Main()
; -----------------------------------------------
Func Main()
    GUICreate("RMLLabs Development Menu", 350, 23, 1428, 23)
    WinSetOnTop("RMLLabs Development Menu", "", $WINDOWS_ONTOP)
    ; -----------------------------------------------
    ; SAC Menu
    Local $mSAC = GUICtrlCreateMenu("SAC")
    Local $mSAC4 = GUICtrlCreateMenuItem("Display HotKey Option", $mSAC)
    ; -----------------------------------------------
    GUISetState(@SW_SHOW)
    ; -----------------------------------------------
    While 1
        Local $nMsg = GUIGetMsg()
        Switch $nMsg
            ; -----------------
            Case $GUI_EVENT_CLOSE
                Exit
                ; -----------------
                ; SAC Menu
            Case $mSAC4
                DisplayHotKeyOpt()
        EndSwitch
    WEnd
EndFunc   ;==>Main
; -----------------------------------------------
Func DisplayHotKeyOpt()
    $sDisplayHotKeyOpt = GUICreate("", 117, 18, 210, 90, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetFont(10, 800, 0, "Seqoe UI")
    GUISetBkColor(0x3D3D3D)
    ; -----------------------------------------------
    $iMenuPosition = GUICtrlCreateLabel(" Enable HotKey", 0, 0, 117, 18, $SS_CENTER)
    GUICtrlSetColor(-1, 0xFFFFFF)
    ; -----------------------------------------------
    GUISetState(@SW_SHOW)
    ; -----------------------------------------------
    While 1
        Switch GUIGetMsg()
            Case $iMenuPosition
                Local $hbHotKeyEnabled = EnableDisableHotKey()
                If $hbHotKeyEnabled = True Then ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>DisplayHotKeyOpt
; -----------------------------------------------
Func EnableDisableHotKey()
    Local Static $bHotKeyEnabled = True
    ; -----------------------------------------------
    If $bHotKeyEnabled = True Then
        HotKeySet("{NUMPADSUB}", "UpdateScenes") ; The script that is to be executed!
        GUICtrlSetData($iMenuPosition, "Disable HotKey")
        $bHotKeyEnabled = False
    Else
        WinClose($sDisplayHotKeyOpt)
        HotKeySet("{NUMPADSUB}")
        GUICtrlSetData($iMenuPosition, "Enable HotKey")
        $bHotKeyEnabled = True
    EndIf
    Return $bHotKeyEnabled
EndFunc   ;==>EnableDisableHotKey
; -----------------------------------------------
Func UpdateScenes()
    Local $hWnd = "[CLASS:SAC_SCENEPROPERTIES]"
    ; -----------------------------------------------
    ; F Mixer Number Zone[s] is|are [manually] selected
    ; -----------------
    WinActivate("[CLASS:metapad]", "") ; P7Text is selected.
    Send("{LSHIFT down}+{END}") ; The first line of P7Text is selected via [Shift UP] + [END].
    Send("^x") ; The first line of P7Text is cut - LIFO is executed.
    Send("{LSHIFT up}") ; [Shift UP] is disabled.
    ; -----------------------------------------------
    WinActivate("[CLASS:SAC_SCENES]", "")
    MouseClick($MOUSE_CLICK_LEFT, 254, 313, 1, 1) ; The Scenes View is selected, x y clicks speed
    Sleep(100)
    MouseClick($MOUSE_CLICK_LEFT, 133, 165, 1, 1) ; The first line of Scenes View is selected.
    Sleep(100)
    Send("{End}") ; The [End Of List] is selected via the [End] key.
    MouseClick($MOUSE_CLICK_LEFT, 188, 118, 1, 1) ; The [New] button is selected.
    Sleep(100)
    Send("^v") ; The previously cut text is then pasted.
    Send("{ENTER}") ; [Enter] is selected, for [Ok] - with the [Enter Scene Name...] dialog being summarily exited.
    ; -----------------------------------------------
    Sleep(100)
    WinMove($hWnd, "", 960, 210) ; The Scene Properties window is displayed and is then moved.
    ; -----------------
    ; The Scene Properties are [manually] selected.
    ; [OK] is [manually] selected.
    ; The [Start] scene is [manually] selected.
EndFunc   ;==>UpdateScenes
; -----------------------------------------------

Upon selecting "Disable HotKey", the GUI Menu exits! How do I stop this from occurring?

  • Solution
Posted

Hello,

I DO believe that I discovered the issue?!?
• I have been at this since 10:30am this morning!!

; -----------------------------------------------
Func EnableDisableHotKey()
    Local Static $bHotKeyEnabled = True
    ; -----------------------------------------------
    If $bHotKeyEnabled = True Then
        HotKeySet("{NUMPADSUB}", "UpdateScenes") ; The script that is to be executed!
        GUICtrlSetData($iMenuPosition, "Disable HotKey")
        $bHotKeyEnabled = False
    Else
        WinClose($sDisplayHotKeyOpt)    ; HERE!!
        HotKeySet("{NUMPADSUB}")
        GUICtrlSetData($iMenuPosition, "Enable HotKey")
        $bHotKeyEnabled = True
    EndIf
    Return $bHotKeyEnabled
EndFunc   ;==>EnableDisableHotKey
; -----------------------------------------------

...versus...

; -----------------------------------------------
Func EnableDisableHotKey()
    Local Static $bHotKeyEnabled = True
    ; -----------------------------------------------
    If $bHotKeyEnabled = True Then
        HotKeySet("{NUMPADSUB}", "UpdateScenes") ; The script that is to be executed!
        GUICtrlSetData($iMenuPosition, "Disable HotKey")
        $bHotKeyEnabled = False
    Else
        HotKeySet("{NUMPADSUB}")
        GUICtrlSetData($iMenuPosition, "Enable HotKey")
        GUIDelete($sDisplayHotKeyOpt)   ; AND HERE!!
        $bHotKeyEnabled = True
    EndIf
    Return $bHotKeyEnabled
EndFunc   ;==>EnableDisableHotKey
; -----------------------------------------------

 

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...