mr-es335 Posted yesterday at 03:43 AM Posted yesterday at 03:43 AM Good day, Is the following..."possible"? ; ----------------------------------------------- #include <GUIConstantsEx.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Main() ; ----------------------------------------------- Func Main() Local $MainGuiTitle = " Session|Show Development" GUICreate($MainGuiTitle, 554, 20, 1260, 22) ;----------------- Local $mEnableDisableLIVE = GUICtrlCreateMenu("E&nable|Disable [LIVE]") ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ; ----------------- ; Enable|Disable [LIVE] Options Case $mEnableDisableLIVE EnableDisableLIVE() ; ----------------- EndSwitch WEnd EndFunc ;==>Main ; ----------------------------------------------- ; ----------------------------------------------- ; Enable|Disable [LIVE] Options Func EnableDisableLIVE() ConsoleWrite("$EnableDisableLIVE=" & EnableDisableLIVE & @CRLF) EndFunc ;==>EnableDisableLIVE ; ----------------------------------------------- I need to be able to execute the script from the "root" Menubar item. mr-es335 Sentinel Music Studios
ioa747 Posted yesterday at 05:26 AM Posted yesterday at 05:26 AM Good day expandcollapse popup; https://www.autoitscript.com/forum/topic/212611-launch-a-root-menubar-item/#findComment-1540100 ; ----------------------------------------------- #include <GUIConstantsEx.au3> #include <StaticConstants.au3> ; *** ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Main() ; ----------------------------------------------- Func Main() Local $MainGuiTitle = " Session|Show Development" GUICreate($MainGuiTitle, 554, 20, 1260, 22) ;----------------- Local $idFilemenu = GUICtrlCreateMenu("&Menu") Local $mEnableDisableLIVE = GUICtrlCreateMenuItem("E&nable|Disable [LIVE]", $idFilemenu) ;~ or ;~ Local $mEnableDisableLIVE = GUICtrlCreateLabel("E&nable|Disable [LIVE]", 3, 3, 150, 15, $SS_NOTIFY) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ; ----------------- ; Enable|Disable [LIVE] Options Case $mEnableDisableLIVE EnableDisableLIVE() ; ----------------- EndSwitch WEnd EndFunc ;==>Main ; ----------------------------------------------- ; ----------------------------------------------- ; Enable|Disable [LIVE] Options Func EnableDisableLIVE() ConsoleWrite("$EnableDisableLIVE" & @CRLF) EndFunc ;==>EnableDisableLIVE ; ----------------------------------------------- I know that I know nothing
mr-es335 Posted yesterday at 11:44 AM Author Posted yesterday at 11:44 AM ioa747, Thanks. However , I am looking for something more akin to this: [Click_Me] mr-es335 Sentinel Music Studios
Solution Nine Posted yesterday at 12:51 PM Solution Posted yesterday at 12:51 PM (edited) #include <Constants.au3> #include <GUIConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hGUI = GUICreate("Example", 300, 200) Local $idDummy = GUICtrlCreateMenu("dummy") Local $idMenu = GUICtrlCreateMenuItem("click me", -1) GUICtrlDelete($idDummy) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idMenu MsgBox($MB_OK, "Test", "Working") EndSwitch WEnd EndFunc Edited yesterday at 12:52 PM by Nine mr-es335 and ioa747 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Moderators Melba23 Posted yesterday at 12:52 PM Moderators Posted yesterday at 12:52 PM mr-es335, A number of solutions in this thread: M23 ioa747 and mr-es335 1 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nine Posted yesterday at 12:56 PM Posted yesterday at 12:56 PM Ah this is where I got the code, did not remember where... mr-es335 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
ioa747 Posted 17 hours ago Posted 17 hours ago interesting approach however, it created a question for me #include <Constants.au3> #include <GUIConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hGUI = GUICreate("Example", 300, 200) Local $idDummy = GUICtrlCreateMenu("dummy") Local $idMenu = GUICtrlCreateMenuItem("click me", -1) ; this working but ;~ Local $idMenu = GUICtrlCreateMenuItem("click me", $idDummy) ; this not working ?? 😕 GUICtrlDelete($idDummy) ; *** GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idMenu MsgBox($MB_OK, "Test", "Working") EndSwitch WEnd EndFunc ;==>Example argumentum 1 I know that I know nothing
argumentum Posted 14 hours ago Posted 14 hours ago ...this, is Sparta ! AutoIt ! ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
argumentum Posted 14 hours ago Posted 14 hours ago (edited) expandcollapse popup#include <GuiMenu.au3> #include <GUIConstants.au3> Global Enum $e_idNew = 1000, $e_idOpen, $e_idSave Example2() Func Example2() Local $hGUI, $hFile, $hEdit, $hHelp, $hMain $hGUI = GUICreate("Menu", 400, 300) $hMain = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_AddMenuItem($hMain, "&New", $e_idNew) _GUICtrlMenu_AddMenuItem($hMain, "&Open", $e_idOpen) _GUICtrlMenu_AddMenuItem($hMain, "&Save", $e_idSave) _GUICtrlMenu_SetMenu($hGUI, $hMain) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIRegisterMsg($WM_COMMAND, "") EndFunc ;==>Example2 ; Handle menu commands Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch _WinAPI_LoWord($wParam) Case $e_idNew MemoWrite("New") Case $e_idOpen MemoWrite("Open") Case $e_idSave MemoWrite("Save") EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND ; Write message to memo Func MemoWrite($sMessage) ConsoleWrite($sMessage & @CRLF) EndFunc ;==>MemoWrite ..this works too Edit: in neither case ( this or prior examples ) the alt + letter works Edited 14 hours ago by argumentum ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted 9 hours ago Posted 9 hours ago (edited) @ioa747 The -1 do not refer to the last created control (like it means for all the other GUI functions) but it refers to the first level menu. By putting $idDummy, you simply create an item menu under Dummy which you delete after... Edited 9 hours ago by Nine ioa747 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
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