Editor_RunMacro

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, const POINT_PTR* pptOrgPos, POINT_PTR* pptCodePos, POINT_PTR* pptErrorPos, HGLOBAL* phstrResult );

Parameters

hwnd

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

nFlags

Specifies one of the following values.

RUN_FILE

pszMacroFile parameter is valid.

RUN_TEXT

pszText parameter is valid.

nDefMacroLang

Specifies a combination of the following values.

MACRO_LANG_JSCRIPT

The macro is JScript.

MACRO_LANG_V8

The macro is V8.

MACRO_LANG_VBSCRIPT

The macro is VBScript.

MACRO_LANG_UNKNOWN

The macro language is unknown.

MACRO_SYNC_ONLY

Executes the macro synchronously.

pszMacroFile

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

pszText

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

pptOrgPos

Specifies the original position of the macro.

pptCodePos

Specifies the code position of the macro.

pptErrorPos

Receives the error position of the macro.

phstrResult

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.

Version

Supported on EmEditor Version 9.00 or later.