PhpMyCodeGenerator and PhpMyCellScript

Instructions

PhpMyCellScript::cmd_ARGVARGV

This instruction assigns argument values in $argv to the given variables. This instruction makes it more convenient to obtain arguments passed by the CALL instruction.

Syntax:

ARGV[argument_variable1][argument_variable2]...[argument_variablen]

Parameters:

  • argument_variable1..n: the variables for returning the arguments. (optional)

PhpMyCellScript\Addons\Example::cmd_ARRAY_MERGEARRAY_MERGE

This instruction collects cell values after the current row and the current column, and then merges them into an array variable.

Syntax:

ARRAY_MERGEvariable[keep_empty_row]

Parameters:

  • variable: an array variable for merging the cell values to.
  • keep_empty_row: Indicate whether to keep the empty rows. (optional)

PhpMyCellScript\Addons\Example::cmd_ARRAY_MERGE_STRINGARRAY_MERGE_STRING

This instruction collects cell values after the current row and the current column, then expands the variables in the cell values, and then merges them into an array variable.

Syntax:

ARRAY_MERGE_STRINGvariable[keep_empty_row]

Parameters:

  • variable: an array variable for merging the cell values (where variables will be parsed) to.
  • keep_empty_row: Indicate whether to keep the empty rows. (optional)

PhpMyCellScript\Addons\Example::cmd_ARRAY_MERGE_VALUEARRAY_MERGE_VALUE

This instruction collects cell values after the current row and the current column, then evaluates the expressions in the cell values, and then merges them into an array variable.

Syntax:

ARRAY_MERGE_VALUEvariable[keep_empty_row]

Parameters:

  • variable: an array variable for merging the cell values (where expressions will be evaluated) to.
  • keep_empty_row: Indicate whether to keep the empty rows. (optional)

PhpMyCellScript\Addons\Example::cmd_ASSERTASSERT

This instruction checks an assertion. If a sheet is supposed to be used by other sheets, then this instruction may be used to check whether parameters are provided.

Syntax:

ASSERTassertion

Parameters:

  • assertion: the assertion to check.

PhpMyCellScript\Addons\Example::cmd_ASSIGNASSIGN

This instruction assigns a string to a variable. This instruction may be used to save code snippet for output later.

Syntax:

ASSIGNvariablestring

Parameters:

  • variable: the variable.
  • string: the string to assign. Variables in the string will be parsed.

PhpMyCellScript\Addons\Example::cmd_ASSIGN_TEXTASSIGN_TEXT

This instruction assigns the text in a cell to a variable. This instruction differs from ASSIGN in that it will not expand variables.

Syntax:

ASSIGN_TEXTvariabletext

Parameters:

  • variable: the variable.
  • text: the cell text to assign.

PhpMyCellScript\Addons\Example::cmd_ASSIGN_VALUEASSIGN_VALUE

This instruction assigns a PHP value (obtained by evaluating a PHP expression) to a variable. This instruction provides a cell-based approach to do assignment, instead of using the PHP assignment operator.

Syntax:

ASSIGN_VALUEvariablevalue

Parameters:

  • variable: the variable.
  • value: a PHP expression, which will be evaluated to obtain a value.

PhpMyCellScript\Addons\Example::cmd_AUTOITAUTOIT

This instruction executes an AutoIt script, so that it is easier to take advantage of the functions provided by AutoIt. An alternative to this instruction is to use the AutoItX3.Control ActiveX object provided by AutoIt.

Syntax:

AUTOITscript[output_variable]

Parameters:

  • script: the AutoIt script, where variables will be parsed.
  • output_variable: a variable for returning the output of the AutoIt script. (optional)

PhpMyCellScript::cmd_BREAKBREAK

This instruction breaks a WHILE-like loop.

Syntax:

BREAK[num_of_loops_to_break]

Parameters:

  • num_of_loops_to_break: The number of loops to break. Default: 1. (optional)

PhpMyCellScript::cmd_CC

This instruction marks a comment. It should be clearer and more convenient to use a short instruction name to mark a comment.

Syntax:

C[comment]

PhpMyCellScript::cmd_CALLCALL

This instruction runs the instructions in a sheet in another variable scope.

Syntax:

CALLsheet_name[argument1argument2...argumentnoutput_variable]

Parameters:

  • sheet_name: the name of the sheet to call, where variables will be parsed.
  • argument1..n: the arguments of the sheet. (optional)
  • output_variable: a variable for returning the output of the sheet. This is in the last non-empty cell. Optional if no argument is given.

PhpMyCellScript::cmd_CATCHCATCH

This instruction tries to handle an exception.

Syntax:

CATCHexception_typeinner_exceptionsheet_nameinstruction_namerow_number
If the exception can be handled, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_CLIP_GETCLIP_GET

This instruction gets a string from the clipboard, using AutoIt.

Syntax:

CLIP_GEToutput_variable

Parameters:

  • output_variable: a variable for returning the string, in UTF8.

PhpMyCellScript\Addons\Example::cmd_CLIP_PUTCLIP_PUT

This instruction puts a string to the clipboard, using AutoIt.

Syntax:

CLIP_PUTstring

Parameters:

  • string: the string to put to the clipboard, where variables will be parsed.

PhpMyCellScript::cmd_COMMENTCOMMENT

This instruction marks a comment.

Syntax:

COMMENT[comment]

PhpMyCellScript\Addons\Example::cmd_CONCATCONCAT

This instruction concats a string to a variable. This instruction may be used to prepare code for output later.

Syntax:

CONCATvariablestring

Parameters:

  • variable: the variable.
  • string: the string to concat to the variable. Variables in the string will be parsed.

PhpMyCellScript::cmd_CONTINUECONTINUE

This instruction continues a WHILE-like loop.

Syntax:

CONTINUE[loop_index]

Parameters:

  • loop_index: identify which loop to continue (one-based). Default: 1. (optional)

PhpMyCellScript\Addons\Example::cmd_DIFFDIFF

This instruction compares two strings or two arrays of strings.

Syntax:

DIFFleftrightresult_variable[align_result]

Parameters:

  • left: the first string or the first array of strings.
  • right: the second string or the second array of strings.
  • result_variable: a variable for returning the comparison result.
  • align_result: indicate whether to align the result. (optional)

PhpMyCellScript\Addons\Example::cmd_DIR_COPYDIR_COPY

This instruction copies a directory recursively.

Syntax:

DIR_COPYsourcedest[preserve_timestamp]

Parameters:

  • source: the source directory, where variables will be parsed.
  • dest: the destination path, where variables will be parsed.
  • preserve_timestamp: indicate whether to preserve the timestamp of the file/directory. Default is false. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_DIR_NEW_ITERATORDIR_NEW_ITERATOR

This instruction creates an iterator for iterating a directory.

Syntax:

DIR_NEW_ITERATORiterator_variablepath[mode][regex]

Parameters:

  • iterator_variable: a variable for returning the created iterator. An Exception object will be returned on error.
  • path: the directory path, where variables will be parsed.
  • mode: the mode (either LEAVES_ONLY, SELF_FIRST or CHILD_FIRST in string) to pass to RecursiveIteratorIterator, where variables will be parsed. Default is LEAVES_ONLY. (optional)
  • regex: if given, a RegexIterator will be used to filter the files. Variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_DIR_TEMPDIR_TEMP

This instruction returns the name of a temporary directory.

Syntax:

DIR_TEMPdir_name_variable[prefix][suffix]

Parameters:

  • dir_name_variable: a variable for returning the name of the temporary directory.
  • prefix: the prefix of the temporary directory, where variables will be parsed. (optional)
  • suffix: the suffix of the temporary directory, where variables will be parsed. (optional)

PhpMyCellScript\Addons\Example::cmd_DOM_LOADDOM_LOAD

This instruction creates a DOMDocument object from a XML/HTML string, while the instructions XML_LOAD/HTML_LOAD will create a SimpleXML object.

Syntax:

DOM_LOADxml_stringxml_variable[is_html]

Parameters:

  • xml_string: the XML/HTML string to interpret, where variables will be parsed.
  • xml_variable: a variable for returning the DOMDocument object, or FALSE on failure.
  • is_html: Indicate whether xml_string is a HTML string. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ECHOECHO

This instruction echos a string to the console. This instruction may be used to output generated code to the console.

Syntax:

ECHOoutput_string

Parameters:

  • output_string: the string to output. Variables in the string will be parsed.

PhpMyCellScript\Addons\Example::cmd_ECHO_CELLECHO_CELL

This instruction quotes a string for use in a CSV field and echos it.

Syntax:

ECHO_CELLstring

Parameters:

  • string: the string to echo, where variables will be parsed.

PhpMyCellScript\Addons\Example::cmd_ECHO_ROWECHO_ROW

This instruction echos the strings in the following columns as a row, separating the values by tabs.

Syntax:

ECHO_ROW[string1][string2]...

Parameters:

  • stringX: the strings, where variables will be parsed.

PhpMyCellScript\Addons\Example::cmd_ECHO_SHEETECHO_SHEET

This instruction echos the strings in a two-dimensional array as rows, separating the cells by tabs, and the rows by newlines. This instruction may help to inspect the arrays created by ARRAY_MERGE/ARRAY_MERGE_STRING for debug purpose.

Syntax:

ECHO_SHEETarray

Parameters:

  • array: the array to echo.

PhpMyCellScript::cmd_ELSEELSE

This instruction supports an alternative branch for the IF and some other instructions.

Syntax:

ELSE
If no previous branch is executed, then the instructions in the next column will be processed.

PhpMyCellScript::cmd_ELSEIFELSEIF

This instruction supports alternative branches for the IF and some other instructions.

Syntax:

ELSEIFcondition

Parameters:

  • condition: The condition to evaluate.
If no previous branch is executed and the condition is evaluated to a true value, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ELSEIF_EELSEIF_E

This instruction supports alternative branches for IF-like instructions, and works similar to IF_E.

Syntax:

ELSEIF_Estring1string2

Parameters:

  • string1: the first string, where variables will be parsed.
  • string2: the second string, where variables will be parsed.
If no previous branch is executed, and two strings are equal, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ELSEIF_MELSEIF_M

This instruction supports alternative branches for IF-like instructions, and works similar to IF_M.

Syntax:

ELSEIF_Mpatternsource_string[match_result_variable]

Parameters:

  • pattern: a pattern, which will be passed to preg_match(), and where variables will be parsed.
  • source_string: the source string, where variables will be parsed.
  • match_result_variable: a variable for returning the match information, as returned by preg_match(). (optional)
If no previous branch is executed, and a match is found, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ESCAPE_STRINGESCAPE_STRING

This instruction escapes a string and saves the escaped string to a variable. The escaped string can be unescaped by parsing it as a heredoc string.

Syntax:

ESCAPE_STRINGoutput_variablestring[use_full_version]

Parameters:

  • output_variable: the variable for returning the escaped string.
  • string: the string to escape. Variables in the string will be parsed.
  • use_full_version: indicate whether to escape more characters. See {@link escapeCellHeredocString()}. (optional)

PhpMyCellScript::cmd_EVALEVAL

This instruction evaluates some PHP code, which makes it easier to run PHP code in the spreadsheet.

Syntax:

EVALphp_code

Parameters:

  • php_code: the PHP code to pass to the eval() function.

PhpMyCellScript\Addons\Example::cmd_EVAL_CELL_ARRAYEVAL_CELL_ARRAY

This instruction forms PHP code from strings in a cell array, and then evaluates the PHP code.

Syntax:

EVAL_CELL_ARRAY[cell_array][row_separator]

Parameters:

  • cell_array: a cell array with strings to form the PHP code to pass to the eval() function. If not given, cell values after the current row and the current column will be used instead. (optional)
  • row_separator: the separator to add between rows, where variables will be parsed. Default is \n. (optional)

PhpMyCellScript\Addons\Example::cmd_FILE_COPYFILE_COPY

This instruction copies a file, which may be used to download a file or extract a file from an archive too.

Syntax:

FILE_COPYsourcedest[preserve_timestamp]

Parameters:

  • source: the source file, where variables will be parsed.
  • dest: the destination path, where variables will be parsed.
  • preserve_timestamp: indicate whether to preserve the timestamp of the file. Default is false. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_FILE_DELETEFILE_DELETE

This instruction deletes a file.

Syntax:

FILE_DELETEfilename

Parameters:

  • filename: the path to the file to delete, where variables will be parsed.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_FILE_LOADFILE_LOAD

This instruction loads the content of a file to a variable, which makes it more convenient to work with files in the spreadsheet.

Syntax:

FILE_LOADfile_nameresult_variable

Parameters:

  • file_name: the file name, where variables will be parsed.
  • result_variable: a variable for returning the file content, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_FILE_MOVEFILE_MOVE

This instruction renames/moves a file/directory.

Syntax:

FILE_MOVEoldpathnewpath

Parameters:

  • oldpath: the path of the file/directory to rename/move, where variables will be parsed.
  • newpath: the new path of the file/directory, where variables will be parsed.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_FILE_SAVEFILE_SAVE

This instruction saves some content to a file, which makes it more convenient to work with files in the spreadsheet.

Syntax:

FILE_SAVEfile_namefile_content

Parameters:

  • file_name: the file name, where variables will be parsed.
  • file_content: the file content, where variables will be parsed.

PhpMyCellScript\Addons\Example::cmd_FILE_TEMPFILE_TEMP

This instruction returns the name of a temporary file.

Syntax:

FILE_TEMPfile_name_variable[prefix][suffix]

Parameters:

  • file_name_variable: a variable for returning the name of the temporary file.
  • prefix: the prefix of the temporary file, where variables will be parsed. (optional)
  • suffix: the suffix of the temporary file, where variables will be parsed. (optional)

PhpMyCellScript\Addons\Example::cmd_FILE_TOUCHFILE_TOUCH

This instruction sets the modification time of a file, based on the modification time of another file.

Syntax:

FILE_TOUCHtarget[source]

Parameters:

  • target: the target file, where variables will be parsed.
  • source: if given, the modification time of the target file will be set to the modification time of the source file. Variables will be parsed. (optional)

PhpMyCellScript\Addons\Example::cmd_FINDFIND

This instruction searches a source string for matches to a given regular expression, and iterates over the matches, which makes it easier to extract information from a string in the spreadsheet.

Syntax:

FINDpatternsource_string_variable[match_result_variable][selection_start_variable][selection_length_variable]

Parameters:

  • pattern: a pattern, which will be passed to preg_match(), and where variables will be parsed.
  • source_string_variable: a variable which contains the source string.
  • match_result_variable: a variable for returning the current match information, as returned by preg_match(). (optional)
  • selection_start_variable: a variable for returning the offset of the current match, which should be unset or initialized to 0. (optional)
  • selection_length_variable: a variable for returning the length of the current match, which should be unset or initialized to 0. (optional)
If a match is found, then the instructions in the next column will be processed. The offset and the length returned for the current match can be conceived as the current selection of the source string. In subsequent run of this instruction, search will be started from the end of the current selection.

PhpMyCellScript::cmd_FOREACHFOREACH

This instruction provides the PHP foreach construct to the spreadsheet.

Syntax:

FOREACHarray/iterator[value_variable][key_variable]

Parameters:

  • array/iterator: The array or object or Iterator to be iterated on.
  • value_variable: a variable for returning the current element in each iteration. (optional)
  • key_variable: a variable for returning the key of the current element in each iteration. (optional)
The instructions in the next column will be processed for each element.

PhpMyCellScript\Addons\Example::cmd_GRAMMAR_COMPILEGRAMMAR_COMPILE

This instruction uses the compileRegexGrammar() function to compile a regular-expression-based grammar, and then you can use the GRAMMAR_PARSE instruction to parse input strings.

Syntax:

GRAMMAR_COMPILEgrammarcompiled_grammar_variable

Parameters:

  • grammar: the grammar, see {@link compileRegexGrammar()}.
  • compiled_grammar_variable: a variable for returning the compiled grammar.

PhpMyCellScript\Addons\Example::cmd_GRAMMAR_LL_COMPILEGRAMMAR_LL_COMPILE

This instruction uses the compileLLGrammar() function to compile a LL grammar, and then you can use the GRAMMAR_LL_PARSE instruction to parse input strings.

Syntax:

GRAMMAR_LL_COMPILEgrammarcompiled_grammar_variable

Parameters:

  • grammar: the grammar.
  • compiled_grammar_variable: a variable for returning the compiled grammar.

PhpMyCellScript\Addons\Example::cmd_GRAMMAR_LL_PARSEGRAMMAR_LL_PARSE

This instruction uses the parseAgainstLLGrammar() function to parse an input string against a compiled LL grammar, a parse tree will be returned as a SimpleXML object for you to query against.

Syntax:

GRAMMAR_LL_PARSEcompiled_grammarinput_stringparse_tree_variable[start_symbol][max_depth]

Parameters:

  • compiled_grammar: the compiled grammar, returned by GRAMMAR_LL_COMPILE.
  • input_string: the input string to parse, where variables will be parsed. Should be in UTF-8.
  • parse_tree_variable: a variable for returning the parse tree, which is a SimpleXML object. An Exception object will be returned on error.
  • start_symbol: the start symbol of the grammar, where variables will be parsed. (optional)
  • max_depth: failed if the height of the result parse tree would exceed the maximum depth. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_GRAMMAR_PARSEGRAMMAR_PARSE

This instruction uses the parseAgainstRegexGrammar() function to parse an input string against a compiled regular-expression-based grammar, a parse tree will be returned as a SimpleXML object for you to query against.

Syntax:

GRAMMAR_PARSEcompiled_grammarinput_stringparse_tree_variable[start_symbol][encoding]

Parameters:

  • compiled_grammar: the compiled grammar, returned by GRAMMAR_COMPILE.
  • input_string: the input string to parse, where variables will be parsed.
  • parse_tree_variable: a variable for returning the parse tree, which is a SimpleXML object.
  • start_symbol: the start symbol of the grammar, where variables will be parsed. (optional)
  • encoding: the encoding of the input string, where variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_HTML_LOADHTML_LOAD

This instruction interprets a string of HTML into a SimpleXML object.

Syntax:

HTML_LOADhtml_stringxml_variable

Parameters:

  • html_string: the HTML string to interpret, where variables will be parsed.
  • xml_variable: a variable for returning the SimpleXMLIterator object, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_HTML_TO_STRINGHTML_TO_STRING

This instruction dumps a HTML string for a XML node.

Syntax:

HTML_TO_STRINGresult_variablexml_node[format_output_flag]

Parameters:

  • result_variable: a variable for returning the HTML string.
  • xml_node: the XML node to dump. A SimpleXMLElement or DOMNode object.
  • format_output_flag: indicate whether to format the HTML string. (optional)

PhpMyCellScript\Addons\Example::cmd_ICONVICONV

This instruction corresponds to the PHP iconv() function, which makes it more convenient to perform character set conversion on strings in the spreadsheet. As the encoding of the string returned by Cells()->Value depends on the system code page, but some PHP functions (like XML or Selenium ones) take or return UTF-8 strings, you may use this instruction to do conversion if needed.

Syntax:

ICONVin_charsetout_charsetinput_stringoutput_variable

Parameters:

  • in_charset: the charset of the input string, where variables will be parsed.
  • out_charset: the output charset, where variables will be parsed.
  • input_string: the string to be converted, where variables will be parsed.
  • output_variable: a variable for returning the converted string, or FALSE on failure.

PhpMyCellScript::cmd_IFIF

This instruction provides the IF construct to the spreadsheet.

Syntax:

IFcondition

Parameters:

  • condition: the condition to evaluate.
If the condition is evaluated to a true value, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_IF_EIF_E

This instruction checks whether two strings are equal.

Syntax:

IF_Estring1string2

Parameters:

  • string1: the first string, where variables will be parsed.
  • string2: the second string, where variables will be parsed.
If two strings are equal, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_IF_MIF_M

This instruction searches a source string for a match to a given regular expression, using the PHP function preg_match().

Syntax:

IF_Mpatternsource_string[match_result_variable]

Parameters:

  • pattern: a pattern, which will be passed to preg_match(), and where variables will be parsed.
  • source_string: the source string, where variables will be parsed.
  • match_result_variable: a variable for returning the match information, as returned by preg_match(). (optional)
If a match is found, then the instructions in the next column will be processed.

PhpMyCellScript::cmd_INCLUDEINCLUDE

This instruction enables the instructions in another sheet to be processed, which makes it possible to share instructions in the spreadsheet.

Syntax:

INCLUDEsheet_name

Parameters:

  • sheet_name: the name of the sheet to include, where variables will be parsed.

PhpMyCellScript\Addons\Example::cmd_INCLUDE_PHPINCLUDE_PHP

This instruction includes and evaluates a PHP script in a local function scope. It can optionally capture the script output.

Syntax:

INCLUDE_PHPpath[output_variable]

Parameters:

  • path: the path to the PHP script to include, where variables will be parsed.
  • output_variable: a variable for returning the script output, if given. Otherwise, the script output will not be captured. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_IS_CLIIS_CLI

This instruction checks whether CLI PHP is used.

Syntax:

IS_CLI
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_IS_ON_WINDOWSIS_ON_WINDOWS

This instruction checks whether the operating system is Windows.

Syntax:

IS_ON_WINDOWS
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_IS_WEBIS_WEB

This instruction checks whether PHP is used in the web context.

Syntax:

IS_WEB
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_JSON_LOADJSON_LOAD

This instruction decodes a JSON string.

Syntax:

JSON_LOADjson_stringresult_variable

Parameters:

  • json_string: the JSON string to decode, where variables will be parsed.
  • result_variable: a variable for returning the result PHP value.

PhpMyCellScript\Addons\Example::cmd_JSON_TO_STRINGJSON_TO_STRING

This instruction converts a PHP value to a JSON string.

Syntax:

JSON_TO_STRINGresult_variablevalue

Parameters:

  • result_variable: a variable for returning the JSON string.
  • value: the PHP value to convert.

PhpMyCellScript\Addons\Example::cmd_LISTLIST

This instruction assigns element values in an array to the given variables. This instruction provides an alternative way to assign a list of variables than using the PHP list() language construct.

Syntax:

LIST[variable1][variable2]...[variablen]array

Parameters:

  • variable1..n: the variables for returning the element values. (optional)
  • array: the array with the element values to assign. This is in the last non-empty cell.

PhpMyCellScript\Addons\Example::cmd_MERGEMERGE

This instruction saves/merges a string to a file. This instruction may be used to output generated code to a file.

Syntax:

MERGEfile_nameoutput_string

Parameters:

  • file_name: the file name, where variables will be parsed.
  • output_string: the string to output. Variables in the string will be parsed.

PhpMyCellScript\Addons\Example::cmd_MKDIRMKDIR

This instruction makes a directory.

Syntax:

MKDIRpath_name

Parameters:

  • path_name: the directory path, where variables will be parsed.

PhpMyCellScript\Addons\Example::cmd_MSWORD_FINDMSWORD_FIND

This instruction finds all instances of a given search text, and returns the ranges of the instances found.

Syntax:

MSWORD_FINDrange_objectsearch_textresult_variable[max_num_of_results]

Parameters:

  • range_object: the Range object, within which the text will be searched.
  • search_text: the text to find, where variables will be parsed.
  • result_variable: a variable for returning the ranges of the instances found.
  • max_num_of_results: the maximum number of results to return. No limit if <= 0. (optional)
If there are instances found, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_MSWORD_NEWMSWORD_NEW

This instruction adds a new, empty Microsoft Word document, which may be used to save some information (like images) extracted from other documents.

Syntax:

MSWORD_NEWdocument_variable

Parameters:

  • document_variable: a variable for returning a Word.Document object.

PhpMyCellScript\Addons\Example::cmd_MSWORD_OPENMSWORD_OPEN

This instruction opens a Microsoft Word document, which intends to use with other related instructions to make it easier to extract information from Microsoft Word documents.

Syntax:

MSWORD_OPENfile_namedocument_variable

Parameters:

  • file_name: the file name, where variables will be parsed.
  • document_variable: a variable for returning the Word.Document object, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_MSWORD_TO_ARRAYMSWORD_TO_ARRAY

This instruction copies the elements in a Collection object to a PHP array, so that you can iterate through the elements using the FOREACH instruction in the spreadsheet.

Syntax:

MSWORD_TO_ARRAYcollection_objectarray_variable

Parameters:

  • collection_object: the Collection object, like Documents, Paragraphs, Styles.
  • array_variable: a variable for returning the PHP array.

PhpMyCellScript\Addons\Example::cmd_ODBC_COLUMNSODBC_COLUMNS

This instruction corresponds to the PHP odbc_columns() function, which makes it easier to write database related scripts.

Syntax:

ODBC_COLUMNSqualifierschematable_namecolumn_nameresult_variable

Parameters:

  • qualifier: a parameter to odbc_columns(), where variables will be parsed.
  • schema: a parameter to odbc_columns(), where variables will be parsed.
  • table_name: a parameter to odbc_columns(), where variables will be parsed.
  • column_name: a parameter to odbc_columns(), where variables will be parsed.
  • result_variable: a variable for returning the result set, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ODBC_CONNECTODBC_CONNECT

This instruction corresponds to the PHP odbc_connect() function, which makes it easier to write database related scripts.

Syntax:

ODBC_CONNECTdsnuserpassword[connection_id_variable]

Parameters:

  • dsn: a parameter to odbc_connect(), where variables will be parsed.
  • user: a parameter to odbc_connect(), where variables will be parsed.
  • password: a parameter to odbc_connect(), where variables will be parsed.
  • connection_id_variable: a variable for returning the return value of odbc_connect(). (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ODBC_EXECODBC_EXEC

This instruction corresponds to the PHP odbc_exec() function, which makes it easier to write database related scripts.

Syntax:

ODBC_EXECquery_stringresult_variable[result_type]

Parameters:

  • query_string: a parameter to odbc_exec(), where variables will be parsed.
  • result_variable: a variable for returning the result set, or FALSE on failure.
  • result_type: indicate what type of result set array to return, either BOTH, ASSOC or NUM, where variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ODBC_PROCEDURESODBC_PROCEDURES

This instruction corresponds to the PHP odbc_procedures() function, which makes it easier to write database related scripts.

Syntax:

ODBC_PROCEDURESqualifierownernameresult_variable

Parameters:

  • qualifier: a parameter to odbc_procedures(), where variables will be parsed.
  • owner: a parameter to odbc_procedures(), where variables will be parsed.
  • name: a parameter to odbc_procedures(), where variables will be parsed.
  • result_variable: a variable for returning the result set, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_ODBC_TABLESODBC_TABLES

This instruction corresponds to the PHP odbc_tables() function, which makes it easier to write database related scripts.

Syntax:

ODBC_TABLESqualifierownernameresult_variable

Parameters:

  • qualifier: a parameter to odbc_tables(), where variables will be parsed.
  • owner: a parameter to odbc_tables(), where variables will be parsed.
  • name: a parameter to odbc_tables(), where variables will be parsed.
  • result_variable: a variable for returning the result set, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_PASSTHRUPASSTHRU

This instruction uses the PHP function passthru() to execute an external program, which can handle interactive program better.

Syntax:

PASSTHRUcommand[argument1argument2...argumentnreturn_status_variable]

Parameters:

  • command: the name of the command, where variables will be parsed. Command string will not be escaped.
  • argument1..n: the arguments of the command, where variables will be parsed. Argument strings will be escaped. (optional)
  • return_status_variable: a variable for returning the status of the executed command. This is in the last non-empty cell. Optional if no argument is given.

PhpMyCellScript\Addons\Example::cmd_PHPPHP

This instruction evaluates a PHP template, and returns the evaluation result, which makes it possible to write code template using PHP in the spreadsheet.

Syntax:

PHPphp_template[output_variable]

Parameters:

  • php_template: the PHP template.
  • output_variable: a variable for returning the output. (optional)

PhpMyCellScript\Addons\Example::cmd_PROC_CLOSEPROC_CLOSE

This instruction closes a process started by PROC_OPEN.

Syntax:

PROC_CLOSE[exit_code_variable]

Parameters:

  • exit_code_variable: a variable for returning the exit code. (optional)

PhpMyCellScript\Addons\Example::cmd_PROC_OPENPROC_OPEN

This instruction executes a command using the PHP function proc_open(), which provides a much greater degree of control over the program execution.

Syntax:

PROC_OPENcommand[cwd][process_variable]

Parameters:

  • command: the command to execute, where variables will be parsed.
  • cwd: the initial working dir for the command, where variables will be parsed. (optional)
  • process_variable: a variable for returning the return value of proc_open(), or false on error. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_PROC_STDERRPROC_STDERR

This instruction receives a string from the stderr of a process, started by PROC_OPEN.

Syntax:

PROC_STDERR[output_variable][is_read_line][length][echo_flag]

Parameters:

  • output_variable: a variable for returning the error string. (optional)
  • is_read_line: indicate whether to read a line. (optional)
  • length: The number of bytes to read. Default is 8192, but no default if to read a line. (optional)
  • echo_flag: indicate whether to echo the string received from the process. (optional)

PhpMyCellScript\Addons\Example::cmd_PROC_STDINPROC_STDIN

This instruction sends a string to the stdin of a process, started by PROC_OPEN.

Syntax:

PROC_STDINinput_string[result_variable][echo_flag]

Parameters:

  • input_string: the input string to send to the stdin of the process, where variables will be parsed.
  • result_variable: a variable for returning the return value of fwrite(), i.e. the number of bytes written, or false on error. (optional)
  • echo_flag: indicate whether to echo the input string sent to the process. (optional)

PhpMyCellScript\Addons\Example::cmd_PROC_STDOUTPROC_STDOUT

This instruction receives a string from the stdout of a process, started by PROC_OPEN.

Syntax:

PROC_STDOUT[output_variable][is_read_line][length][echo_flag]

Parameters:

  • output_variable: a variable for returning the output string. (optional)
  • is_read_line: indicate whether to read a line. (optional)
  • length: The number of bytes to read. Default is 8192, but no default if to read a line. (optional)
  • echo_flag: indicate whether to echo the string received from the process. (optional)

PhpMyCellScript\Addons\Example::cmd_PROMPTPROMPT

This instruction echos a prompt string, then gets and returns the user input, which helps to get user input in the spreadsheet.

Syntax:

PROMPTprompt_string[output_variable]

Parameters:

  • prompt_string: the prompt string, where variables will be parsed.
  • output_variable: a variable for returning the user input. (optional)

PhpMyCellScript\Addons\Example::cmd_PROMPT_PWDPROMPT_PWD

This instruction echos a prompt string, and then gets a password from the user.

Syntax:

PROMPT_PWDprompt_string[output_variable]

Parameters:

  • prompt_string: the prompt string, where variables will be parsed.
  • output_variable: a variable for returning the password. (optional)

PhpMyCellScript\Addons\Example::cmd_REPLACEREPLACE

This instruction just replaces the current selection marked by the FIND instruction with a given string, and update the current selection, which makes it easier to modify a string in the spreadsheet.

Syntax:

REPLACEreplacement_string

Parameters:

  • replacement_string: the replacement string, where variables will be parsed.

PhpMyCellScript::cmd_RETURNRETURN

This instruction ends the process of the current sheet.

Syntax:

RETURN[return_value]

Parameters:

  • return_value: the value to return. (optional)

PhpMyCellScript\Addons\Example::cmd_RMDIRRMDIR

This instruction removes a directory.

Syntax:

RMDIRdirname[recursive]

Parameters:

  • dirname: the path to the directory to remove, where variables will be parsed.
  • recursive: indicate whether to remove sub-directories recursively. Default is false. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_RUN_ASYNCRUN_ASYNC

This instruction executes a command asynchronously.

Syntax:

RUN_ASYNCcommand[window_style]

Parameters:

  • command: the command and its arguments, where variables will be parsed.
  • window_style: the window style, which will be passed to the Run method of the WScript.Shell object. (optional)

PhpMyCellScript\Addons\Example::cmd_SELECT_DIRSELECT_DIR

This instruction opens a dialog for selecting a directory.

Syntax:

SELECT_DIRdirectory_path_variableprompt_string[root_folder]

Parameters:

  • directory_path_variable: a variable for returning the path of the selected directory.
  • prompt_string: the prompt string, where variables will be parsed.
  • root_folder: the root folder to use in the dialog box. Variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_SELECT_OPTIONSELECT_OPTION

This instruction shows a list of options, and asks the user to select one of them.

Syntax:

SELECT_OPTIONprompt_stringoptionsoutput_variable

Parameters:

  • prompt_string: the prompt string, where variables will be parsed.
  • options: an array of options.
  • output_variable: a variable for returning the index of the selected option. The variable may be initialized with the index of the default option.

PhpMyCellScript\Addons\Example::cmd_SELENIUM_DOSELENIUM_DO

This instruction executes a Selenium command.

Syntax:

SELENIUM_DOcommand[target][value][result_variable][encoding]

Parameters:

  • command: the Selenium command, where variables will be parsed.
  • target: the first parameter of the command, where variables will be parsed. (optional)
  • value: the second parameter of the command, where variables will be parsed. (optional)
  • result_variable: a variable for returning the command result. (optional)
  • encoding: the encoding of the target string and the value string (after parsed variables), where variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_SELENIUM_STARTSELENIUM_START

This instruction starts a browser using Selenium Remote Control, so that you can script a browser. You need to install the Selenium PHP client driver in order to use this instruction.

Syntax:

SELENIUM_STARTbrowserbrowser_url[selenium_variable][host][port]

Parameters:

  • browser: the browser to start, which will be passed to the constructor of Testing_Selenium, and where variables will be parsed.
  • browser_url: a URL, which will be passed to the constructor of Testing_Selenium, and where variables will be parsed.
  • selenium_variable: a variable for returning the Testing_Selenium object. (optional)
  • host: the host of the RC server, where variables will be parsed. (optional)
  • port: the port of the RC server, where variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_SELENIUM_STOPSELENIUM_STOP

This instruction stops the browser started by SELENIUM_START.

Syntax:

SELENIUM_STOP

PhpMyCellScript\Addons\Example::cmd_SHELL_EXECSHELL_EXEC

This instruction uses the PHP function shell_exec() to execute a command.

Syntax:

SHELL_EXECcommand[argument1argument2...argumentnoutput_variable]

Parameters:

  • command: the name of the command, where variables will be parsed. Command string will not be escaped.
  • argument1..n: the arguments of the command, where variables will be parsed. Argument strings will be escaped. (optional)
  • output_variable: a variable for returning the output of the executed command. This is in the last non-empty cell. Optional if no argument is given.

PhpMyCellScript\Addons\Example::cmd_STRINGSTRING

This instruction evaluates and returns a string, which makes it possible to write code template using PHP heredoc string in the spreadsheet.

Syntax:

STRINGstring[output_variable]

Parameters:

  • string: the string, where variables will be parsed.
  • output_variable: a variable for returning the expanded string. (optional)

PhpMyCellScript\Addons\Example::cmd_STRING_ARRAYSTRING_ARRAY

This instruction creates an array of strings.

Syntax:

STRING_ARRAY[string1][string2]...[stringn]array_variable

Parameters:

  • string1..n: the strings, where variables will be parsed. (optional)
  • array_variable: a variable for returning the array created. This is in the last non-empty cell.

PhpMyCellScript\Addons\Example::cmd_STRING_FROM_CELL_ARRAYSTRING_FROM_CELL_ARRAY

This instruction helps to form a string from strings in a cell array. Trailing empty cells in each row will be ignored.

Syntax:

STRING_FROM_CELL_ARRAYstring_variable[cell_array][row_separator][cell_separator][prefix][suffix]

Parameters:

  • string_variable: the string formed will be appended to this variable.
  • cell_array: a cell array with strings. If not given, cell values after the current row and the current column will be used instead. (optional)
  • row_separator: the separator to add between rows, like \n, where variables will be parsed. (optional)
  • cell_separator: the separator to add between cells, like \t, where variables will be parsed. (optional)
  • prefix: the prefix string to add before the first row, where variables will be parsed. (optional)
  • suffix: the suffix string to add after the last row, where variables will be parsed. (optional)

PhpMyCellScript\Addons\Example::cmd_SYSTEMSYSTEM

This instruction uses the PHP function system() to execute an external program.

Syntax:

SYSTEMcommand[argument1argument2...argumentnreturn_status_variable]

Parameters:

  • command: the name of the command, where variables will be parsed. Command string will not be escaped.
  • argument1..n: the arguments of the command, where variables will be parsed. Argument strings will be escaped. (optional)
  • return_status_variable: a variable for returning the status of the executed command. This is in the last non-empty cell. Optional if no argument is given.

PhpMyCellScript::cmd_THROWTHROW

This instruction throws an exception.

Syntax:

THROWexception

Parameters:

  • exception: the exception to throw.

PhpMyCellScript::cmd_TRACE_STARTTRACE_START

This instruction injects some PHP code to the interpreter to evaluate, before each instruction is interpreted. This instruction may be used for program trace/debug purpose.

Syntax:

TRACE_START[code_to_eval_on_start][code_to_eval_per_instruction]

Parameters:

  • code_to_eval_on_start: the PHP code to evaluate on trace start. May be used to initialize some variables. (optional)
  • code_to_eval_per_instruction: the PHP code to inject to the interpreter. The interpreter state will be printed by default. (optional)

PhpMyCellScript::cmd_TRACE_STOPTRACE_STOP

This instruction removes the code injected by TRACE_START.

Syntax:

TRACE_STOP[code_to_eval_on_stop]

Parameters:

  • code_to_eval_on_stop: the PHP code to evaluate on trace stop. May be used to summarize the trace result. (optional)

PhpMyCellScript::cmd_TRYTRY

This instruction indicates that the following code in the next column may throw exceptions.

Syntax:

TRY

PhpMyCellScript\Addons\Example::cmd_UNSETUNSET

This instruction unsets some variables.

Syntax:

UNSETvariable1[variable2]...

Parameters:

  • variableX: the variables to unset.

PhpMyCellScript\Addons\Example::cmd_VALUE_ARRAYVALUE_ARRAY

This instruction creates an array of values.

Syntax:

VALUE_ARRAY[expression1][expression2]...[expressionn]array_variable

Parameters:

  • expression1..n: the expressions to evaluate. (optional)
  • array_variable: a variable for returning the array created. This is in the last non-empty cell.

PhpMyCellScript::cmd_WHILEWHILE

This instruction provides WHILE loop support to the spreadsheet.

Syntax:

WHILEcondition

Parameters:

  • condition: the condition to evaluate.
If the condition is evaluated to a true value, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_XML_FROM_CELL_ARRAYXML_FROM_CELL_ARRAY

This instruction uses the createXmlNodesFromCellArrayData() function to create XML nodes, then insert them to a given XML node, or create a SimpleXML object for accessing them if a XML node is not given.

Syntax:

XML_FROM_CELL_ARRAYxml_variable[cell_array]

Parameters:

  • xml_variable: a XML node where new nodes will be inserted, or a variable for returning a new SimpleXMLIterator object.
  • cell_array: a cell array with node information. If not given, cell values after the current row and the current column will be used instead. (optional)

PhpMyCellScript\Addons\Example::cmd_XML_FROM_VALUEXML_FROM_VALUE

This instruction uses the convertValueToXmlObject() function to convert a value into a SimpleXML object, against which you can run XPath queries.

Syntax:

XML_FROM_VALUEvaluexml_variable[encoding]

Parameters:

  • value: an array, object or simply a scalar value.
  • xml_variable: a variable for returning the SimpleXMLIterator object.
  • encoding: the encoding of the value, where variables will be parsed. (optional)

PhpMyCellScript\Addons\Example::cmd_XML_LOADXML_LOAD

This instruction uses the simplexml_load_string() function to interpret a string of XML into an object, which makes it more convenient to work with XML in the spreadsheet.

Syntax:

XML_LOADxml_stringxml_variable

Parameters:

  • xml_string: the XML string to interpret, where variables will be parsed.
  • xml_variable: a variable for returning the SimpleXMLIterator object, or FALSE on failure.
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_XML_TO_STRINGXML_TO_STRING

This instruction dumps a XML string for a XML node.

Syntax:

XML_TO_STRINGresult_variablexml_node[format_output_flag][remove_xml_declaration_flag]

Parameters:

  • result_variable: a variable for returning the XML string.
  • xml_node: the XML node to dump. A SimpleXMLElement or DOMNode object.
  • format_output_flag: indicate whether to format the XML string. (optional)
  • remove_xml_declaration_flag: indicate whether to remove the XML declaration from the XML string. (optional)

PhpMyCellScript\Addons\Example::cmd_XML_XPATHXML_XPATH

This instruction runs a XPath query against a SimpleXML/DOMNode node.

Syntax:

XML_XPATHxml_nodexpath_expressionresult_variable[prefix1namespace_uri1prefix2namespace_uri2...prefixnnamespace_urin]

Parameters:

  • xml_node: the SimpleXML/DOMNode node to query on.
  • xpath_expression: the XPath expression, where variables will be parsed.
  • result_variable: a variable for returning the XPath query results. For a DOMNode node, an array will be returned instead of DOMNodeList.
  • prefix1..n: the namespace prefixes to use in the XPath query, where variables will be parsed. (optional)
  • namespace_uri1..n: the URIs of the corresponding namespaces, where variables will be parsed. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_XSLT_NEWXSLT_NEW

This instruction creates an XSLTProcessor object, and imports a stylesheet for transformations using the XSLT_TRANSFORM instruction.

Syntax:

XSLT_NEW[stylesheet][xslt_variable]

Parameters:

  • stylesheet: the stylesheet to import, as a DOMDocument or SimpleXMLElement object. (optional)
  • xslt_variable: a variable for returning the new XSLTProcessor object. (optional)
If success, then the instructions in the next column will be processed.

PhpMyCellScript\Addons\Example::cmd_XSLT_TRANSFORMXSLT_TRANSFORM

This instruction transforms an XML node, using the XSLTProcessor object created by the XSLT_NEW instruction.

Syntax:

XSLT_TRANSFORMdocresult_variable

Parameters:

  • doc: the XML node to transform.
  • result_variable: a variable for returning the resulting DOMDocument object, or false on error.
If success, then the instructions in the next column will be processed.