EmEditor Home - EmEditor Help - Plug-in Reference - Inline Functions


Runs a macro. You can use this inline function or explicitly send the EE_RUN_MACRO message.

Editor_RunMacro( HWND hwnd, UINT nFlags, UINT nDefMacroLang, LPCWSTR pszMacroFile, LPCWSTR pszText, POINT_PTR* pptOrgPos, POINT_PTR* pptCodePos, POINT_PTR* pptErrorPos, HGLOBAL* phstrResult );



Specifies the window handle of the view or frame of EmEditor.


Specifies one of the following values.

RUN_FILE pszMacroFile parameter is valid.
RUN_TEXT pszText parameter is valid.


Specifies one of the following values.

MACRO_LANG_JSCRIPT The macro is JavaScript.
MACRO_LANG_VBSCRIPT The macro is VBScript.
MACRO_LANG_UNKNOWN The macro language is unknown.


Specifies the path and file name of the macro file you want to run.


Specifies a macro text on memory that you want to run.


Specifies the original position of the macro.


Specifies the code position of the macro.


Receives the error position of the macro.


Receives the handle to the output string that the macro returns. The caller is responsible to free this handle by using the GlobalFree function.

Return Values

The return value is one of the following values.

S_OK Success.
S_FALSE A macro error like a syntax error occurred.
S_EDIT_TEMP A macro error occurred but could not open the source code to edit because the source code is not in a text file. The caller should open the source file with the cursor position set according to the information provided by the ptErrorPos parameter.
E_FAIL A fatal error occurred.


Supported on EmEditor Version 9.00 or later.

Copyright 2003-2016 by Emurasoft, Inc.