Jump to content

Help with some things in _GuiCtrl, executing actions on an element through $WM_COMMAND, plugins...

Recommended Posts

I am making a kind of plugin in AutoIt for a software that is also made in AutoIt by me and what I want is to add a new menu, submenus and elements in a text editor.
Yes, this software has a built-in text editor. Although this unfortunately is closed source recently, a friend made a fork long before this happened and I will pass it on to you, although it is an outdated version that does not have the text editor... but if you want I can pass the code of this editor .
I want some menu items to be created through _GuiCtrl and the window handle, and when executing that new item with _GuiCtrl it does a certain action, it's similar to GuiCtrl and the switch guiGetMsg(), but in this case it's an independent GUI . I have done this code, the items are created, but the problem is that when I click on each of the items it does not do what I want to do...
I don't know what I'm doing wrong, if someone locates me I'm grateful:

#include <GUIConstants.au3>
#include <GuiMenu.au3>
#include <WinAPIConv.au3>
#include <WindowsConstants.au3>
Local Enum $e_idSyms = 1000, $e_idSyms2, $e_idDicts, $e_idDicts2
Local $hWnd, $hMain
HotKeySet("{escape}", "_Exit")
Opt("WinDetectHiddenText", 1)
Opt("WinTextMatchMode", 2)
Func main()
while 1
if WinActive("Blind text editor - ") then
$hWnd = WinGetHandle("Blind text editor - ")
beep(2000, 60)
$hMenu = _GUICtrlMenu_CreateMenu()
$hSyms = _GUICtrlMenu_CreateMenu()
$hDict = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_AddMenuItem($hMenu, "synonyms", 1, $hSyms)
_GUICtrlMenu_AddMenuItem($hSyms, "synonym converter", $e_idSyms2)
_GUICtrlMenu_AddMenuItem($hMenu, "dictionary", 1, $hDict)
_GUICtrlMenu_AddMenuItem($hDict, "apply dictionary", $e_idDicts2)
$hMain = _GUICtrlMenu_GetMenu($hWnd)
_GUICtrlMenu_InsertMenuItem($hMain, 3, "&dictionaries", 0, $hMenu)
GUIRegisterMsg($WM_COMMAND, "actions")
while WinActive("Blind text editor - ")
Func actions($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $lParam
Switch _WinAPI_LoWord($wParam)
Case $e_idSyms2
msgbox(0, "Info", "Seleccionaste la opción de sinonímos.")
Case $e_idDicts2
msgbox(0, "Info", "Seleccionaste la opción de diccionarios.")
case else
MsgBox(0, "Error", "Algo falló. Comprueba. " &_WinAPI_LoWord($wParam))
func _exit()
beep(1000, 50)


Fork: rayo-alcantar/Blind-Text: Utility with various functions of writing, reading text and more. (github.com)

Edited by Mateocedillo
Link to comment
Share on other sites

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