Axaptapedia is now maintained by AgileCadence For more information please click here.

Editor scripts

From Axaptapedia
Jump to: navigation, search


Editor scripts are the short programs for automating tasks in the Axapta code editor.

Scripts can be called via:

  • Pressing Alt+M and selecting scripts in menu
  • Calling context menu in the editor (Scripts submenu)
  • Pressing the Scripts button in the editor toolbar

Autohotkey macros can be used to assign hotkeys to Editor Scripts


The Scripts menu is constructed from the structure EditorScripts class using the following rules:

  • each method which takes a single argument with the type Editor class is an editor script
  • if the method name contains an underscore (_) it is placed under a submenu with the same name as the part of the method name before the underscore. For example, \Classes\EditorScripts\template_method_parm becomes menu item "parm" in "method" submenu under "template" submenu in the scripts menu.


This script adds item "context" to the Scripts menu. This item shows standard Add-ins menu. <xpp> void context(Editor _e) {

 SysContextMenuTreeNode toolsMenu=
 PopupMenu popupMenu = toolsMenu.buildMenu(InfoLog.hWnd());
 int x, y;
 [x, y] = WinAPI::getCursorPos();
 toolsMenu.runMenu(popupMenu.draw(x, y), toolsMenu, _e);

} </xpp>