mr-es335 Posted 16 hours ago Posted 16 hours ago Good day, I would greatly appreciate it is someone would peruse the following script...to ensure that I am on the right track. • I "kind' fig'urd" this out myself - but only with the assistance of pixelsearch and ioa747!! Many thanks to you both!! Spoiler expandcollapse popup; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1, $sCol1Row2 Global $Form2, $sOption1Button Global $Form3, $sOption2Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate("Form 1", 120, 45, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") $sCol1Row1 = GUICtrlCreateButton("Enable [F10]", 10, 10, 100, 25) GUICtrlSetOnEvent($sCol1Row1, "EnableF10") ; ----------------- $Form2 = GUICreate("Form 2", 75, 15, -1, 400, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x3D3D3D) $sOption1Button = GUICtrlCreateLabel("[F10]", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") ; ----------------- $Form3 = GUICreate("Form 3", 75, 15, -1, 400, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x3D3D3D) $sOption2Button = GUICtrlCreateLabel("[F12]", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption2Button, "_ColRow") ; ----------------------------------------------- GUISwitch($Form1) GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func EnableF10() GUISetState(@SW_HIDE, $Form1) GUISwitch($Form2) MsgBox($MB_OK, "", "The [F10] label is now enabled...", 1) GUISetState(@SW_SHOW) EndFunc ;==>EnableF10 ; ----------------------------------------------- Func EnableF12() GUISetState(@SW_HIDE, $Form1) MsgBox($MB_OK, "", "The [F12] label is now enabled...", 1) GUISwitch($Form3) GUISetState(@SW_SHOW) EndFunc ;==>EnableF12 ; ----------------------------------------------- Func _ColRow() ;~ ConsoleWrite("@GUI_CtrlId=" & @GUI_CtrlId & @CRLF) Switch @GUI_CtrlId Case $sOption1Button GUISetState(@SW_HIDE, $Form2) EnableF12() GUISwitch($Form1) Case $sOption2Button GUISetState(@SW_HIDE, $Form3) GUISwitch($Form1) GUISetState(@SW_SHOW, $Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 MsgBox($MB_OK, "GUI Event", "Exiting...", 1) Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- ioa747 1 mr-es335 Sentinel Music Studios
ioa747 Posted 15 hours ago Posted 15 hours ago (edited) I find it okay, the only thing I found is an extra $sCol1Row2 in Global Edit: I found some other extra things too. here is a more organized version Spoiler expandcollapse popup; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1 ;, $sCol1Row2 Global $Form2, $sOption1Button Global $Form3, $sOption2Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate("Form 1", 120, 45, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") $sCol1Row1 = GUICtrlCreateButton("Enable [F10]", 10, 10, 100, 25) GUICtrlSetOnEvent($sCol1Row1, "_ColRow") ; ⚠ from "EnableF10" to ; ----------------- $Form2 = GUICreate("Form 2", 75, 15, -1, 400, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x3D3D3D) $sOption1Button = GUICtrlCreateLabel("[F10]", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") ; ----------------- $Form3 = GUICreate("Form 3", 75, 15, -1, 400, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x3D3D3D) $sOption2Button = GUICtrlCreateLabel("[F12]", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption2Button, "_ColRow") GUISetState(@SW_SHOW, $Form1) ; ----------------- While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func _ColRow() ;~ ConsoleWrite("@GUI_CtrlId=" & @GUI_CtrlId & @CRLF) Switch @GUI_CtrlId Case $sCol1Row1 ; Form1 -> Form2 [F10] GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) ; GUISwitch($Form2) ToolTip("The [F10] label is now enabled...", @DesktopWidth / 2, @DesktopHeight / 3) Sleep(1000) ToolTip("") Case $sOption1Button ; Form2 [F10] -> Form3 [F12] GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form3) ; GUISwitch($Form3) ToolTip("The [F12] label is now enabled...", @DesktopWidth / 2, @DesktopHeight / 3) Sleep(1000) ToolTip("") Case $sOption2Button ; Form3 [F12] -> Form 1 GUISetState(@SW_HIDE, $Form3) GUISetState(@SW_SHOW, $Form1) ; GUISwitch($Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 ToolTip("Exiting...", @DesktopWidth / 2, @DesktopHeight / 3) Sleep(1000) ToolTip("") Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- Edited 14 hours ago by ioa747 mr-es335 1 I know that I know nothing
mr-es335 Posted 14 hours ago Author Posted 14 hours ago ioa747, You stated, "I find it okay, the only thing I found is an extra $sCol1Row2 in Global..." "My bad!' I left that it by mistake!!! I am "inspecting" your offering!! mr-es335 Sentinel Music Studios
Solution ioa747 Posted 13 hours ago Solution Posted 13 hours ago (edited) I organized them this way so you can have a quick overview of what is visible and what is not. because in the EnableF12() function, when you call it, the first thing it does is GUISetState(@SW_HIDE, $Form1) while Form1 is already hidden Edit: GUISwitch() is needed if you are creating a new control, so that the control knows which form it will sit on. Edited 13 hours ago by ioa747 mr-es335 1 I know that I know nothing
mr-es335 Posted 13 hours ago Author Posted 13 hours ago (edited) ioa747, Man I wish that I could think the way you do!?! [Click_Me] As you know, I have three script that i employ...all three of which I have had to update as the result of employing OnEvent in my menu. • EnableP7HotKeyLabel, EnableF10Label and EnableP8HotKeyLabel. With your recent offering, I have been able to strip-down the EnableF10Label to accommodate the EnableP8HotKeyLabel script... Spoiler expandcollapse popup; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1 Global $Form2, $sOption1Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate("Form 1", 120, 45, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") $sCol1Row1 = GUICtrlCreateButton("Enable P8 HotKey", 10, 10, 100, 25) GUICtrlSetOnEvent($sCol1Row1, "_ColRow") ; ----------------- $Form2 = GUICreate("Form 2", 75, 15, -1, 400, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x3D3D3D) $sOption1Button = GUICtrlCreateLabel("P8 HotKey", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") GUISetState(@SW_SHOW, $Form1) ; ----------------- While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func _ColRow() Switch @GUI_CtrlId Case $sCol1Row1 GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) MsgBox($MB_OK, "", "The P8 HotKey label is now enabled...", 1) Case $sOption1Button GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 MsgBox($MB_OK, "GUI Event", "Exiting...", 1) Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- I DO HOPE your realize, ioa747, just how much I appreciate your efforts on my behalf! • Most of my scripts are predicated by "Update provided by ioa747, with sincere gratitude..." Credit due, where credit is - and must be, deserved... Edited 12 hours ago by mr-es335 ioa747 1 mr-es335 Sentinel Music Studios
mr-es335 Posted 1 hour ago Author Posted 1 hour ago Good day, The three samplings... Spoiler expandcollapse popup; EnableP8HotKeyLabel ; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1 Global $Form2, $sOption1Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate("Form 1", 100, 25, 1430, 20) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") ; ----------------- Local $mMenu = GUICtrlCreateMenu("title") $sCol1Row1 = GUICtrlCreateMenuItem("Enable P8 HotKey", $mMenu) GUICtrlSetOnEvent($sCol1Row1, "_ColRow") ; ----------------- $Form2 = GUICreate("Form 2", 75, 15, 230, 342, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x3D3D3D) GUISetFont(11, 800, 0, "Calibri") $sOption1Button = GUICtrlCreateLabel("P8 HotKey", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") GUISetState(@SW_SHOW, $Form1) ; ----------------- While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func _ColRow() Switch @GUI_CtrlId Case $sCol1Row1 GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) ;~ MsgBox($MB_OK, "", "The P8 HotKey label is now enabled...", 1) Case $sOption1Button GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 ;~ MsgBox($MB_OK, "GUI Event", "Exiting...", 1) Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- Spoiler expandcollapse popup; EnableP7HotKeyLabel ; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1 Global $Form2, $sOption1Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate(" ", 100, 25, 1430, 20) WinSetOnTop(" ", "", $WINDOWS_ONTOP) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") ; ----------------- Local $mMenu = GUICtrlCreateMenu("title") $sCol1Row1 = GUICtrlCreateMenuItem("Enable P7 HotKey", $mMenu) GUICtrlSetOnEvent($sCol1Row1, "_ColRow") ; ----------------- $Form2 = GUICreate("Form 2", 75, 15, 210, 90, $WS_POPUP, $WS_EX_TOPMOST) GUISetFont(11, 800, 0, "Calibri") GUISetBkColor(0x4A4A4A) $sOption1Button = GUICtrlCreateLabel("P7 HotKey", 0, 0, 75, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") GUISetState(@SW_SHOW, $Form1) ; ----------------- While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func _ColRow() Switch @GUI_CtrlId Case $sCol1Row1 GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) ;~ MsgBox($MB_OK, "", "The P7 HotKey label is now enabled...", 1) Case $sOption1Button GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 ;~ MsgBox($MB_OK, "GUI Event", "Exiting...", 1) Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- Spoiler expandcollapse popup; EnableF10Label ; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) ; ----------------------------------------------- Global $Form1, $sCol1Row1 Global $Form2, $sOption1Button Global $Form3, $sOption2Button ; ----------------------------------------------- Forms() ; ----------------------------------------------- Func Forms() $Form1 = GUICreate("Form 1", 100, 25, 1430, 20) WinSetOnTop("title", "", $WINDOWS_ONTOP) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") ; ----------------- Local $mMenu = GUICtrlCreateMenu("title") $sCol1Row1 = GUICtrlCreateMenuItem("Enable [F10]", $mMenu) GUICtrlSetOnEvent($sCol1Row1, "_ColRow") ; ⚠ from "EnableF10" to ; ----------------- $Form2 = GUICreate("Form 2", 75, 20, 620, 49, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x3D3D3D) GUISetFont(14, 800, 0, "Calibri") $sOption1Button = GUICtrlCreateLabel("[F10]", 0, 0, 75, 20, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption1Button, "_ColRow") ; ----------------- $Form3 = GUICreate("Form 3", 75, 20, 620, 49, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x3D3D3D) GUISetFont(14, 800, 0, "Calibri") $sOption2Button = GUICtrlCreateLabel("[F12]", 0, 0, 75, 20, $SS_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent($sOption2Button, "_ColRow") GUISetState(@SW_SHOW, $Form1) ; ----------------- While 1 Sleep(10) WEnd EndFunc ;==>Forms ; ----------------------------------------------- Func _ColRow() ;~ ConsoleWrite("@GUI_CtrlId=" & @GUI_CtrlId & @CRLF) Switch @GUI_CtrlId Case $sCol1Row1 ; Form1 -> Form2 [F10] GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) ;~ MsgBox($MB_OK, "", "The [F10] label is now enabled...", 1) Case $sOption1Button ; Form2 [F10] -> Form3 [F12] GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form3) ;~ MsgBox($MB_OK, "", "The [F12] label is now enabled...", 1) Case $sOption2Button ; Form3 [F12] -> Form 1 GUISetState(@SW_HIDE, $Form3) GUISetState(@SW_SHOW, $Form1) EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 ;~ MsgBox($MB_OK, "GUI Event", "Exiting...", 1) Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- Sample image of the end results [Click_Me] ioa747 1 mr-es335 Sentinel Music Studios
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now