Damein Posted June 7, 2016 Share Posted June 7, 2016 I know I've done this before but for the life of me I can't recall what I need to use the get the text of a menu item when it is clicked. expandcollapse popup#include <GuiComboBox.au3> #include <GuiMenu.au3> #include <GUIConstantsEx.au3> #include 'CommMG.au3' ;;; Thanks to Martin Gibson for the UDF Opt("GUIOnEventMode", 1) Dim $COMList[100] $portlist = _CommListPorts(0);find the available COM ports and write them into the ports combo If @error = 1 Then MsgBox(0, 'trouble getting portlist', 'Program will terminate!') Exit EndIf GUICreate("Test", 700, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Local $COMmenu = GUICtrlCreateMenu("COM List") For $pl = 1 To $portlist[0] $portnum = StringReplace($portlist[$pl], "COM", '') If StringLen($portnum) = 1 Then $portnum = ' ' & $portnum $portlist[$pl] = 'COM' & $portnum $COMList[$pl] = GUICtrlCreateMenuItem($portlist[$pl], $COMmenu) GUICtrlSetOnEvent(-1, "_SelectCOM") Next GUISetState() Func _SelectCOM() $Msg = @GUI_CtrlId MsgBox(0, "Test", $Msg) EndFunc ;==>_SelectCOM Func _Exit() _Commcloseport(True) Exit EndFunc ;==>_Exit While 1 Sleep(10) WEnd So I need to get the text of the menu item when it is clicked so I can Check/Uncheck the rest / use the text later in the script. Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Danyfirex Posted June 7, 2016 Share Posted June 7, 2016 Hello. You can do GUICtrlRead($Msg,1) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Damein Posted June 7, 2016 Author Share Posted June 7, 2016 Ah, lame! I was halfway there lol. Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
AutoBert Posted June 7, 2016 Share Posted June 7, 2016 1 hour ago, Danyfirex said: Hello. You can do GUICtrlRead($Msg,1) Saludos But he script's in GuiOnEvenMode. @Damein: please attach the #include 'CommMG.au3' ;;; Thanks to Martin Gibson for the UDF i'am sure: what's possible in GuiGeMsg.Mode is also possible in GuiOnEvenMode. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 7, 2016 Share Posted June 7, 2016 11 minutes ago, AutoBert said: But he script's in GuiOnEvenMode. And GUICtrlRead should be able to read from the ControlID returned by @GUI_CtrlId. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
AutoBert Posted June 7, 2016 Share Posted June 7, 2016 23 minutes ago, BrewManNH said: And GUICtrlRead should be able to read from the ControlID returned by @GUI_CtrlId Yes should but OP has troubles with using and i havn't CommMG.au3 so i asked in same post: 38 minutes ago, AutoBert said: @Damein: please attach the #include 'CommMG.au3' ;;; Thanks to Martin Gibson for the UDF Link to comment Share on other sites More sharing options...
BrewManNH Posted June 8, 2016 Share Posted June 8, 2016 Those two are unrelated to each other. He's in OnEvent mode and he can use GUICtrlRead with the variable $Msg which is populated by @GUI_CtrlID, so your statement mentioning that he was in OnEvent mode made no sense in the context of your quote. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
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