var nItemID = 4158; //IDM_EDIT_FIND
var sItemID = nItemID.toString();

while (true)
{
  sItemID = AkelPad.InputBox(AkelPad.GetMainWnd(), WScript.ScriptName, "Menu item ID:", sItemID);

  if (! sItemID)
    break;

  nItemID = parseInt(sItemID);
  WScript.Echo(GetMenuItemFromResource(nItemID));
}

function GetMenuItemFromResource(nItemID)
{
  var oSys     = AkelPad.SystemFunction();
  var nLangID  = AkelPad.GetLangId();
  var lpBuffer = AkelPad.MemAlloc(260 * 2); //sizeof(MAX_PATH)
  var sString  = "";
  var hLangLib;

  if (AkelPad.SendMessage(AkelPad.GetMainWnd(), 1222 /*AKD_GETMAININFO*/, 52 /*MI_LANGMODULEW*/, lpBuffer))
    hLangLib = oSys.Call("Kernel32::GetModuleHandleW", AkelPad.GetAkelDir(3 /*ADTYPE_LANGS*/) + "\\" + AkelPad.MemRead(lpBuffer, 1 /*DT_UNICODE*/));
  else //internal language
    hLangLib = AkelPad.GetInstanceExe();

  AkelPad.MemFree(lpBuffer);

  var hRes      = oSys.Call("Kernel32::FindResourceExW", hLangLib, 4 /*RT_MENU*/, 4001 /*IDM_MENU_MAIN*/, nLangID);
  var hResData  = oSys.Call("Kernel32::LoadResource", hLangLib, hRes);
  var lpPointer = oSys.Call("Kernel32::LockResource", hResData);
  var nSize     = oSys.Call("Kernel32::SizeofResource", hLangLib, hRes);

  if (nSize)
  {
    var nPos = AkelPad.MemRead(lpPointer, 1 /*DT_UNICODE*/, nSize / 2).indexOf("\0" + String.fromCharCode(nItemID));

    if (nPos >= 0)
      sString = AkelPad.MemRead(lpPointer + (nPos + 2) * 2, 1 /*DT_UNICODE*/);
  }

  return sString;
}
