+Macros supports the FoxScript language to create new macros. FoxScript is a FoxPro-like language, which uses the same syntax as FoxPro and supports all features of FoxPro except for classes and functions.
In addition, FoxScript has a number of functions, which provide full access to the source code in Visual FoxPro editor. By using these functions you can place the current text to the editor, modify or replace it.
Here you will find descriptions of all FoxScript functions, which provide access to source code in Visual FoxPro Editor and additional service functionality.
| Function name | A brief description |
|---|---|
| po_edgetsel | Returns the selected text to the FoxPro editor. |
| po_edgettext | Returns all text to the editor. |
| po_edgetword | Returns the current word to the editor. |
| po_edinsert | Inserts the new text into the current cursor position. |
| po_edits | Creates and shows dialogs by using the initialization string. |
| po_edputsel | Replaces the selected text in the editor with the new one. |
| po_edselword | Selects the current word in the Visual FoxPro editor. |
| po_mrkexec | Executes the specified macro. |
| po_normalize | Normalizes the text according to the FoxPro syntax rules. |
| po_popup | Shows the POPUP menu. |
| Description | Returns the selected text in the FoxPro editor. | |
|---|---|---|
| Syntax | [cText =] po_edgetsel() | |
| Return value | cText | Selected text. |
| Notes | If the current active window in Visual FoxPro is not the code editor window, the function returns an empty string. | |
| Description | Returns all text in the editor. | |
|---|---|---|
| Syntax | [cText =] po_edgettext(@aEditSel) | |
| aEditSel (Array) |
Returns an array with the following structure: 1 - File name 2 - Text length in bytes 3 - Maximum available text length (0 if it is not set) 4 - Modified file (yes/no) 5 - AutoIndent (yes/no) 6 - .bak file creation (yes/no) 7 - Add line feeds before saving (yes/no) 8 - Compile the text before saving (yes/no) 9 - Add Ctrl-Z as end-of-file (yes/no) 10 - Autosave the file settings (yes/no) 11 - Drag&Drop support (yes/no) 12 - File attributes (0 = not r/o, 1 = file is r/o, 2 = file is r/w, opened r/o, 3 = file is r/o, opened r/o). 13 - Display the status bar (yes/no) 14 - Allow modifying the file settings (yes/no) 15 - InsertMode (yes/no) 16 - (reserved) 17 - Start position of the selected text 18 - End position of the selected text 19 - Point in selection 20 - Alignment (0 = left, 1 = right, 2 = center). 21 - Tab size 22 - Font name 23 - Font size 24 - Font style (0 = plain, 1 = bold, 2 = italic, 3 = bold italic) 25 - (reserved) |
|
| Return value | cText | Text in the editor. |
| Notes | If the current active window in Visual FoxPro is not the code editor window, the function returns an empty string and the aEditSel array is not filled. | |
| Description | Returns the current word in the editor. | |
|---|---|---|
| Syntax | [cText =] po_edgetword() | |
| Return value | cText | The current word. |
| Notes | If the current active window in Visual FoxPro is not the code editor window, the function returns an empty string. | |
| Description | Inserts the new text into the current cursor position. | |
|---|---|---|
| Syntax | [nReturn =] po_edinsert(cText) | |
| cText (String) | Text to insert | |
| Return value | nReturn |
= 0 - function successful. < 0 - Error code. |
| Notes | If the current active window in Visual FoxPro is not the code editor window, the function returns zero. An error may occur if you insert text into the ReadOnly file. | |
| Description | Creates and shows dialogs by using the initialization string. | |
|---|---|---|
| Syntax | [ nReturn =] po_edits( cInitR, [cInit] ) | |
| cInitR (String) |
Initialisation string, which defines elements in the dialog: cInitR="<Element1;[Element2]...>" Element1 = <Name> [\Class=<Class>] \Type=<Type> \Len=<Length> [\Dec=<Precision>] [\NameR=<Title>] \Source=<Source> [\Init=<DefaultValue>] [\When=<PriorCondition>] [\Valid=<PostCondition>] [\PropertySet={<Properties>}] [\Domain={<Domain>}] [\Left=<Column>] [\Top=<Row>] [\Width=<Width>] [\Height=<Height>] [\LbWidth=<LabelWidth>] <Name> - Element name <Class> - Element class (po_edtb - TextBox, po_edeb - EditBox, po_edcmd - CommandButton, po_edcb - ComboBox, po_edlb - ListBox) <Type> - Element type ("N","C","D","L") <Length> - Element length <Precision> - Element precision <Title> - Element title <Source> - Value source <DefaultValue> - Default value <PriorCondition> - Initial condition in the FoxScript language <PostCondition> - Final condition in the FoxScript language <Properties> - Additional properties <Domain> - List of possible values used in ComboBox and ListBox <Column> - Left position <Row> - Top position <Width> - Element width <Height> - Element height <LabelWidth> - Width of title label |
|
| Return value | nReturn |
Execution result: 0 - press the "Cancel" button, 1 - press the "OK" button, <0 - Error code |
| Notes |
Not to use po_edits in a macro (example):
private cMyString, nMyNumeric, lMyLogic, nMyEnumerate, cInitR |
|
| Description | Replaces the selected text in the editor with the new one. | |
|---|---|---|
| Syntax | [nReturn =] po_edputsel(cText) | |
| cText (String) | New text | |
| Return value | nReturn |
= 0 - function successful. < 0 - Error code. |
| Notes |
Any text selected in the editor will be removed and replaced with the new one. If editor doesn't contain selected text, po_edputsel acts like the po_edinsert function. If the current active window in Visual FoxPro is not the code editor window, the function returns zero. An error may occur if you insert text into the ReadOnly file. |
|
| Description | Selects the current word in the Visual FoxPro editor. | |
|---|---|---|
| Syntax | [cText =] po_edselword() | |
| Return value | cText | The selected word. |
| Notes |
If the function could not select a word, it returns an empty string. If the current active window in Visual FoxPro is not the code editor window, the function returns an empty string. |
|
| Description | Executes the specified macro. | |
|---|---|---|
| Syntax | [uReturn =] po_mrkexec(cMacros,@nError, [uP1],[uP2],[uP3],[uP4],[uP5],[uP6],[uP7],[uP8],[uP9],[uP10]) | |
| cMacros (String) | Unique macro identifier. | |
| @nError (Number) |
Result of macro execution: =0 if the function succeeds <0 if the macro does not exist or its execution fails |
|
| uP1-//-uP10 (Any) | Parameters are passed by value or by reference to the called macro. The called macro must specify the list of parameters by using the parameters keyword. | |
| Return value | uReturn | The macro return value (set by the RETURN keyword). |
| Description | Normalizes the text according to the FoxPro syntax rules. | |
|---|---|---|
| Syntax | [cText =] po_normalize( cTextNorm, cInit ) | |
| cTextNorm (String) | Text for normalization | |
| cInit (String) |
Contains normalizaton rules. \KeyWords={<TableName>} TableName - full path to the table with keywords. This table must have the same structure as the standard fdkeywrd.dbf Visual FoxPro table. \Normalize=<NormalizeType> NormalizeType - Type of normalization ("Normal" - all keywords will be taken from the table without any transformation, "Upper" - all keywords will be set to uppercase, "Lower" - all keywords will be set to lowercase) \MultiSel - Toggles the display of the POPUP menu for keyword selection if several variants exist. Example: "\Normalize=Lower\MultiSel" |
|
| Return value | Normalized text. | |
| Notes | The text in string literals is not normalized. | |
| Description | Shows the POPUP menu. | |
|---|---|---|
| Syntax | [nSelected =] po_popup( @aPopup, [cInit] ) | |
| aPopup (Array) | One-dimensional array of strings. Each string will be shown as a separate menu item. | |
| cInit (String) |
Additional settings: cInit="\Row=<Row> \Col=<Column> \Cur=<Current> \Title=<Title>" <Row> - Specifies the Y coordinate of the menu top left corner <Column> - Specifies the X coordinate of the menu top left corner <Current> - The currently selected menu item <Title> - Menu title. |
|
| Return value | nSelected | Specifies the selected menu command in the popup menu. |
| Notes | The function returns 0 if the ESC key is pressed. | |