Editor scripts

Use
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

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

Example
This script adds item "context" to the Scripts menu. This item shows standard Add-ins menu. void context(Editor _e) { SysContextMenuTreeNode toolsMenu= SysContextMenuTreeNode::newPath(_e.path); PopupMenu popupMenu = toolsMenu.buildMenu(InfoLog.hWnd); int x, y; ;

[x, y] = WinAPI::getCursorPos; toolsMenu.runMenu(popupMenu.draw(x, y), toolsMenu, _e); }

Links

 * Editor_scripts_OpenInAOT - a good script that is added into the addIns submenu. Opens the selected object and its properties
 * AxGoToDeclaration - a script that navigates to the declaration of the currently selected variable (does not work in later AX versions)
 * Editor_scripts_OpenOverriddenMethodDef - a script that allows navigating to the implementation of the overridden method in one of the descendent classes
 * Editor_scripts_FormatToColumnLayout - a script that is added into the addIns submenu that allows you to select a block of variable declarations or assignments and format them into column layout.
 * Editor_scripts_FindAllOccurrencesInNode - a script that allows to find all occurrences of the selected text in the parent node (class/form).