- Filerx -
Windows - SciTE Projects & Macros

Laurent LE TYNEVEZ
with contribution of
Ralf Wagner

updated : 3/04/2004

What is Filerx ?

Filerx is a SciTE companion program, waiting in the background, that helps navigating in frequently used folders.

Related files may be grouped in projects, displayed as trees.

Using SciTE's communication protocol , it is possible to exchange informations.

The properties Tree shows how SciTE has loaded and interpreted its .properties files

Filerx records, plays and edits macros. Filerx can be used as a stand-alone program to develop and test macros, with its integrated Scintilla control, or it may use macros to command SciTE.

Lua scripts can be edited, saved and sent to SciTE to be executed.

The Type Library Tree allows Type Libraries browsing.


Filerx_ini

Filerx.ini

If filerx.ini exists in the same directory as filerx.exe, it will be read, to change appearance and behaviour of Filerx.

Filerx.ini appears as a subtree of the Property Tree, and may be edited from there

[window]
hideonminimize=0
;hides window when minimizing. Default :0
logpath=c:\_wscite\filerx.log
log file path : Default : filerx.log in filerx folder
savewindow=1
If savewindow1, current window settings will be written to filerx.ini.
autosplit=1
If autosplit=1 and viewslider=1, window resizing automatically changes split mode :a tall narrow window will be splitted horizontally, and a flat long window, vertically.
splitfactor=3
Used if autosplit=1; tells when a window is narrow or flat. When set to 3, as here, a window will be considered as flat if width>3*height, and narrow, if height>3*width.
vsplit=0
Horizontal splitting, if 0, vertical if 1.
tree=70
The tree will have 70 percent of tree+list space.
x=782
Horizontal position.
y=1
Vertical position.
w=243
Window width.
h=637
Window height.
splash=1
Display splash window..
[work]
logging=1
enable/disable copydata messages logging. Default : 0
askbeforedelete=0
will prompt user before closing a project/macro file or deleting an item
askifsaveproject=0
will prompt user before saving a project file
checkdirtyproject=1
will check for dirty projects before exiting
askifsavemacros=0
will prompt user before saving a macro file
checkdirtymacros=1
will check for dirty macros before exiting
saveworkdir=1
If saveworkdir=1, the last directory shown in File Browser Tree will be reopened next time Filerx is launched alone.
workdir=C:\_wscite\filerx\work
workdir is last used directory.
scitepath=c:\_wscite\scite.exe
If a file must be opened by SciTE, Filerx first looks here to find SciTE's path. If not found here, Filerx will try in its own directory.
ifacepath=c:\_wscite\scintilla.iface
Filerx needs this file to know everything about Scintilla. Filerx looks here first, then tries in its own directory. If not found, macros won't work.

sciteparams=""-import c:\_wscite\macros""
When Filerx launches SciTE, this will be added to the command line.Double double quotes seem to be necessary in some cases ...

macrobar=macrobar_ini_path
 Set macrobar_ini_path to a valid path to enable and load the Macro Bar at startup.
auto_insertclosing=1
If non-zero, a ) ] } " ' is automatically added when a ( [ { " ' char is typed in the Macro editor.
auto_autocomplete=4
If non-zero, an autocomplete box automatically opens after the indicated number of characters, if these characters match with the beginning of a keyword.
[filters]
CPP sources=.cpp .h .cxx
- The left side of equal sign will appear in a Popup Menu
- The right side is a list of space separated suffixes
[macros]
testfile=c:\_wscite\macrotest.txt
Scintilla built-in editor will use this file to test macros.
=c:\_wscite\filerx\scite.macros
=c:\_wscite\filerx\html.macros
=c:\_wscite\filerx\last.macros
These macro files will automatically be loaded when Filerx starts
[projects]
=c:\_wscite\filerx\@scite.project
=c:\_wscite\filerx\@scilexer.project
=c:\_wscite\filerx\@filerx.project
=c:\_wscite\filerx\@upload.project
=c:\_wscite\filerx\@patch.project
These projects will automatically be loaded when Filerx starts
[filelistmenu]
Hello=OnMenuHello
Open with Notepad=OnMenuNotepad
To customize the file list contextual menu : the left side of "=" appears in the menu, and the right side is the name of an existing macro. The macro must exist and be declared as : Macro void xxxxxx(string yyyyy). The yyyyyy parameter will receive the path of the right-clicked file.
[projectmenu]
Hello=OnMenuHello
Open with Notepad=OnMenuNotepad
 To customize the Project Tree menu.
[filetreemenu]
Hello=OnMenuHello
Open with Notepad=OnMenuNotepad
 To customize the File Tree menu.
[tlbmenu]
List Type Libraries=OnListLibraries,1
List Type Libraries=OnListLibraries,2
List All Enums=OnListEnums,13
Insert HTML CLSID=OnInsertHTMLObject,23
Insert Script Object=OnInsertScriptObject,24
Insert Method=OnInsertFunction,5
Insert PropertyGet=OnInsertFunction,6
Insert PropertyPut=OnInsertFunction,7
Insert PropertyPutRef=OnInsertFunction,8
 To customize the TypeLib Tree menu. When a number is specified after the macro name, the menu item will appear only if the item type is the same as the specified number.
[tlbfavorites]
Microsoft Common Dialog Control 6.0 (SP3) 1.2
Microsoft DHTML Page Runtime Library 1.0 1.0
Microsoft Excel 8.0 Object Library 1.2
Microsoft HTML Object Library 4.0
Microsoft Internet Controls 1.1
Microsoft MAPI Controls 6.0 1.1
Microsoft Script Control 1.0 1.0
Microsoft Scripting Runtime 1.0
Microsoft Shell Controls And Automation 1.0
Microsoft VBScript Global 0.0
Microsoft Word 8.0 Object Library 8.0
Windows API (ANSI) 1.1
Windows Script Host Object Model 1.0
 List of favorite Typelibs, automatically saved.
[shortcuts]
Dump_commands=68,2,Ctrl + D
Random=75,7,Ctrl + Shift + Alt + K
Space=83,2,Ctrl + S
Insert_Char=73,6,Ctrl + Alt + I
Date_Time=97,6,Ctrl + Alt + 1 pavé numérique
char=122,0,F11
formac=70,2,Ctrl + F
getinfos=115,4,Alt + F4
trystruct=84,2,Ctrl + T
vieweol=86,6,Ctrl + Alt + V
List_Shortcuts=83,7,Ctrl + Shift + Alt + S
_global_shortcut_=83,2,Ctrl + S
 Macro shortcuts.
macro_name=virtual_key_code , modifiers , plain_text
if _global_shortcut_ is defined, then this shortcut opens a dialog where you can type any macro shortcut.
[macrobarmenu]
Default=c:\_wscite\filerx\default_macrobar.ini
Dialogs=c:\_wscite\filerx\dialogs_macrobar.ini
Html=c:\_wscite\filerx\html_macrobar.ini
To customize the Macro Bar contextual menu : the left side of "=" appears in the menu, and the right side is the path of an existing macro bar initialization file.

macrobar_example.ini

Any number of macro bars may be used by Filerx.
Each Macro Bar is described by an initialization file containing one section.

[macrobar]
_x_=130
_y_=68
Position of Macro Bar. Automatically saved when closing.
_ontop_=1
If not 0, Macro Bar stays on top of other windows.
_have_icons_=1
If 1 : show icons on the bar. If 0, show text buttons.
_buttonh_=23
_buttonw_=23
Size of Icon buttons.
_buttoncolumns_=28
Columns of Icon buttons
_textbuttonh_=30
_textbuttonw_=100
Size of text buttons
_textbuttoncolumns_=6
Columns of text buttons.
Dump_commands=C:\Icons\NOTE06.ICO
Date_Time=C:\Icons\CLOCK02.ICO
char=
Macros appearing in the Macro Bar, with an optional Icon path.
run_arg!SciTE=C:\_wscite\SciTE.ico ,

"C:\_wscite\SciTE.exe"
Macro appearing in the Macro Bar with :
- its name : run_arg
- a subname : SciTE
- an Icon path : C:\_wscite\SciTE.ico
- a list of parameters : "C:\_wscite\SciTE.exe","newfile.cxx"
Clicking on the corresponding button will execute the Macro run_arg with the supplied list of parameters:
run_arg ( "C:\_wscite\SciTE.exe" , "newfile.cxx" ) .
A Macro accepting parameters may be associated with more than one button. The subname appears in the button tooltip.


installation

- Filerx.exe may be installed in any directory (see : Filerx.ini)
- Filerx doesn't write to Windows Registry ...
- It writes only to .project files,.macros files, log files and to filerx.ini file.

Needed files:

Filerx.: http://llt.chez.tiscali.fr/
- Filerx.exe
- macro.dll
- filerx.ini
- filerx.chm

Scintilla : http://www.scintilla.org
- scilexer.dll
- scintilla.iface

Scripts:
- msscript.ocx to call VBScript/JScript from macros

Launching from SciTE:

Add these lines to SciTEGlobal.properties to launch Filerx from SciTE's Tools Menu :

command.name.0.*=Project Editor
command.0.*="C:\_wscite\filerx\filerx.exe" "C:\_wscite\Work"  "id:$(WindowID)"
command.subsystem.0.*=2
the first argument may be a project file "C:\_wscite\work\myproj.project". In this case, myproj.project is opened, and its tree displayed.

Launching directly:

Filerx.exe can be run independently, too, and then call SciTE to edit a file.
But, for this to work properly:
-Filerx.exe MUST be in the same directory as SciTE executable, and SciTE executable's name MUST be "scite.exe".
OR
-SciTE's path must be given in filerx.ini.

File association:

.project files may be associated with Filerx.exe in Explorer : double clicking Myproj.project in Explorer launches Filerx.exe and shows Myproj.project tree. BUT : Registry key :

HKEY_CLASSES_ROOT\project_auto_file\shell\open\command
must be changed from :
"C:\_wscite\filerx\Filerx.exe" %1
to :
"C:\_wscite\filerx\Filerx.exe" "%1"
to correctly handle pathnames containing spaces ...


item_types

Internal types:

In the Trees, the items have a type. The types may be used to customize menus, and are defined as follows :
Desktop Tree
All items have a 0 type
Project Tree
#define TYPE_ROOT 1
#define TYPE_PROJECT 2
#define TYPE_FOLDER 4
#define TYPE_FILE 8
Macro Tree
#define TYPE_ROOT 1
#define TYPE_MACROFILE 2
#define TYPE_MACRO 4
#define TYPE_FILE 8
Property Tree
#define TYPE_PROPROOT 0
#define TYPE_PROPGROUPFILERX 1
#define TYPE_PROPGROUPSCITE 2
#define TYPE_PROPSECTIONFILERX 3
#define TYPE_PROPSECTIONSCITE 4
#define TYPE_PROPKEY 5
TypeLib Tree
#define TYPE_TLBROOT 0
#define TYPE_REGFAV 1
#define TYPE_REG 2
#define TYPE_FILES 3

#define TYPE_TLB 4

#define TYPE_METHOD 5
#define TYPE_PROPERTYGET 6
#define TYPE_PROPERTYPUT 7
#define TYPE_PROPERTYPUTREF 8
#define TYPE_EVENT 9

#define TYPE_CONSTANT 10
#define TYPE_GROUPFOLDER 11

#define TYPE_EVENTINTERFACE 12
#define TYPE_ENUM 13
#define TYPE_STRUCT 14
#define TYPE_MODULE 15
#define TYPE_INTERFACE 16
#define TYPE_DISPINTERFACE 17
#define TYPE_COCLASS 18
#define TYPE_TYPEDEF 19
#define TYPE_UNION 20
#define TYPE_WHAT 21

#define TYPE_HELP 22
#define TYPE_CLSID 23
#define TYPE_OBJ 24
#define TYPE_TLBFILE 25


Window Top

Under the Title bar, there is :
- the shortcut button :
* when in Macros mode, clicking this button opens a dialog to edit the selected macro's shortcut.
* In combination with Control key : Show/Hide the Macro Bar
- the shortcut box : shows the shortcut associated with the selected macro.
- the path combo box : remembers last visited files/folders

And two tabs sets :
- the main mode tabs : to select the Tree in the left/top pane.
- the secondary tabs : to view files, macro text, macro output, typelib output or Lua scripts.


The two panes

The left/top pane contains the Trees, and the right/bottom one may show the File list, macro text, macro output, information about the selected Type Library or Lua scripts.

The separator between those two panes may be dragged to adjust the panes sizes.
If the separator is dragged beyond the right or bottom limit, the splitting mode changes.


Window bottom

Four Buttons :
- Toggle test mode : to send Macro output to Scite or to Filerx (test mode).
- Play macro : to run selected macro.
- Record macro : to record a new macro
- Stop recording macro : to stop recording...

And a Status Bar containing four parts:
- SciTE : if Filerx is connected to SciTE, SciTE's icon appears here.
- Running macro : a blue triangle appears while a macro is running.
- Recording macro : when recording macros, a red disk appears here.
- Message area : to display miscellaneous informations.

Examples:

Macros will run in test mode. SciTE is connected.
A macro is being recorded.
The macro 'Insert_Char' is running. Its output is sent to Filerx.
The macro 'Insert_Char' is running. Its output is sent to SciTE.


Scintilla

Filerx uses the Scintilla Control to display text under the Source, Output, Typelib and Lua Tabs.
Among all the possibilities of this editing control, Filerx uses only a few :
- Syntax coloring
- Tooltips appearing when a '(' is typed
- Auto-completion list...

When editing Filerx macros, you may use following keys :

- F9 : Play Macro (send it to SciTE)

- F10 : Test Macro

- F11 : Show auto-completion list

When editing Lua scripts, under the Lua Tab, the contextual menu offers special commands to save and execute scripts.

- F5 : send selected text to SciTE as a Lua script.

- F9 : send the whole file to SciTE as a Lua script.

- F11 : Show auto-completion list

Everything can be reconfigured through Macros :

 Macro void Scintilla_Style
 StyleClearAll;
 SetLexer(SCLEX_CPP);
 StyleSetFore(SCE_C_STRING, 0x7f007f);
 StyleSetFore(SCE_C_CHARACTER, 0x7f007f);
 //Filerx keywords
 StyleSetFore(SCE_C_WORD, 0x007f7f);
 //SciTE/Scintilla keywords
 StyleSetFore(SCE_C_WORD2, 0x808000);
 StyleSetBold(SCE_C_WORD2, false);
 StyleSetFore(SCE_C_COMMENTLINE, 0x7f0000);
 StyleSetFore(SCE_C_PREPROCESSOR, 0x0000c0);
 SetIndentationGuides(true);
 SetTabWidth(4);
 SetIndent(4);
 SetCaretPeriod(400);
 CallTipSetBack(0xffffa0);
 SetCaretLineBack(0xff80ff);
 //BreakPoint
 MarkerDefine(2, 1);
 MarkerSetBack(2, 0x0000ff);
 //Instruction pointer
 MarkerDefine(3, 4);
 MarkerSetBack(3, 0x00ffff);


File Browsing mode

The Tree : acts like a normal browsing tree.Expand/Collapse/Select Folders ...

The List : shows the contents of the current selected folder.

When a file is double-clicked in the List:

-if it is a .project file : the Dialog switches to Project Browsing mode.

-if it is a .macros file : the Dialog switches to Macros Browsing mode.

-if not : SciTE opens the file.


Project mode

The Tree

- allows label editing.

- allows drag'n'drop : if Control or Shift key is pressed when the item is dropped, the dragged item won't be erased.

- Double-Clicking on a file or on a Project name opens the corresponding file in SciTE.

- Double-Clicking on a .macros file adds this file to the Macros Tree.

The List : acts like in File Browsing Mode; but items may be dragged to the project tree. Multiselection is allowed.


Properties Mode

To see which properties have been read by SciTE, and Filerx initialization file :

Filerx.ini items are shown in the "Filerx.ini" subtree and may be edited.
- To modify a line : edit the line.
- To suppress a line : edit and empty the line.
- To add a line : edit the <new> item appearing in each section.

CAUTION :
- Each line is sent to Filerx.ini just after it has been modified.
- No checking is done.
- Some changes will have an immediate effect : [filelistmenu] and [projectmenu].
- Some will take effect next time Filerx is run : [projects] , [macros], [filters] ...
- Some will have no effect : for example, if savewindow=1, x,y,w and h will be overwritten when Filerx exits.


Macros Mode

When loaded, manually, by double-clicking in the Files list, or automatically, if the name is found in Filerx.ini, a Macros file is added to the Macros Tree, and each macro appear as a child of this file.

You may, then, edit, record, save, play or debug macros.All possible actions are found in a contextual menu , when right-clicking in the tree.

Icons give some indication about the Macro :

If specified in filerx.ini, a text file may be used to test macros in Filerx.

[macros]
testfile=c:\_wscite\macrotest.txt

Contextual menus propose all available actions:

For Macro files : or for Macros :


Type Libraries Browsing mode

The Tree : has three subfolders :

- Favorites : containing your favorite typelibs.

- Registry : automatically filled with registered typelibs.

- Files : The File List contextual menu allows loading of ocx,oca,olb,tlb,dll and exe files as Type Libraries. These files will appear in this Folder.

Scintilla Editor : shows some information..

When an item is double-clicked in the Tree:

- TypeLib : jumps from the Registry to Favorites folder and vice-versa.

-Help : The specified Help File is opened

-Enum : The enum subitems are sent to SciTE.(*)(**)

-Dispinterface, Interface or Module : The subitems are sent to the integrated Scintilla Editor.(**)

-Method or Property: the item is sent to SciTE, and a tooltip is displayed.(*)

- ClsID or Object Name (CoClass subitems) : the text is inserted in SciTE.(*)

(*) SciTE must be running.

(**) The item must have been expanded at least once before.


Macro Bars

Any number of Macro Bars can be created. Each Macro Bar can contain any number of buttons associated with existing macros.

Enable :
Write macrobar = macrobar_ini_path in the [work] section of Filerx.ini. macrobar_ini_path is the path of a .ini file describing the macro bar to load at startup.

View/Hide :
Click the Shortcut button while pressing Control key.

Toggle Icons/Text :
Right-Click the title bar of the macro bar.

Toggle on top/not on top :
Right-Click the title bar of the macro bar.

(*) Add buttons :
Right-click on a Macro in the Macro Tree and select "Add to MacroBar" in the menu.

(*) Remove buttons :
Edit the macro bar ini file and remove the corresponding lines in the [macrobar] section.

(*) Change icons :
Drag an ".ico" file from the File List and drop it on a button.

(*) Change size of buttons :
Edit the macro bar ini file.

(*) Change order of buttons :
The order of the buttons is the order of the lines in the Macro Bar .ini file.
Use drag and drop in [macrobar] section of Filerx.ini, or edit the Macro Bar ini file.

Create a new Macro Bar :
- Create a new .ini file to describe the macro bar.
- Add a line : macrobar_name = macrobar_ini_path in the [macrobarmenu] section of Filerx.ini.

Change Macro Bar:
Right-Click or Double-click the title bar of the macro bar.

Edit Macro Bar:
Right-Click the title bar, and select "Edit Macro Bar". The Macro Bar Editor will appear.
Above changes marked with (*) can be done within this Editor.

See the [macrobar] section of macrobar.ini for more details .


Macro Bar Editor

The Macro Bar Editor allows modifications of existing Macro Bars.

the Bar List :
Lists the Macro Buttons of the Bar.

the Macro List :
Lists loaded Macros.

The "Add" Button :
Adds selected Macro to the Bar List. If a Macro already has a button on the Bar, a new button will be created with a new subname.

The "Remove" Button :
Removes selected Macro from the Bar List.

The "Up" and "Down" Buttons :
Moves the selected Macro up or down in the Bar List.

The "Subname" and "Args" Edit Controls :
Allow changing the subname and the argument list of the currently selected Macro in the Bar List.

The buttons sizes :
An icon button and a text button are displayed . The slider changes the sizes of these buttons.
To choose which dimension to change, click the button under the slider.

The Icon List :
When a Macro is selected in the Bar List, that has an icon, all icons of the current directory are displayed.
To change the icon, double-click in the List.
As this list is connected to Filerx File Tree and List, select another directory in Filerx Tree and its icons will be displayed.

The "Exit and save" and "Cancel" Buttons :
Close the Editor and show the Macro Bar.


Project syntax

Project syntax: A .project file is a text file with a simple syntax :

- If the first non-blank character on a line is '[', the line is a Project Folder name.
- If the first non-blank character on a line is ']' : it's the end of a folder.The end of the line is ignored.
- Any other non-empty line will be considered as a file name.

The file names will be shown whether they exist or not. In fact, you may write anything ...
When the tree is built, the file is searched in the system.
If it doesn't exist, a default icon is shown.
If the file exists, the tree shows only the file name, and some information is added to the tree (full path, size, dates and times ...).


Project sample

[My Project
    [Source Files
        C:\PProjects\Filer\Dll\FileListCtrl.cpp
        C:\PProjects\Filer\Dll\FILER.cpp
        C:\PProjects\Filer\Dll\FilerDlg.cpp
        C:\PProjects\Filer\Dll\FileTreeCtrl.cpp
        C:\PProjects\Filer\Dll\StdAfx.cpp
        C:\PProjects\Filer\Dll\TreeNode.cpp
        [Related
            C:\PProjects\Scite\src\filer.h
        ]
    ]
    [Header Files
        C:\PProjects\Filer\Dll\FileListCtrl.h
        C:\PProjects\Filer\Dll\FilerDlg.h
        C:\PProjects\Filer\Dll\FileTreeCtrl.h
        C:\PProjects\Filer\Dll\StdAfx.h
        C:\PProjects\Filer\Dll\TreeNode.h
    ]
    [Resource Files
        C:\PProjects\Filer\Dll\Filer.rc
    ]
    [Misc
        C:\PProjects\Filer\Dll\Filer.def
        C:\PProjects\Filer\Dll\readme.txt
    ]
]


MSVC .dsp files

When double-clicked in the list, a Microsoft Visual C++ .dsp file will be opened as a project. A tree will be built, containing all the source file names found in the .dsp , dispatched in four folders : source ,header, resource and misc.


macros

With macros, Commands can be sent to :

- SciTE : Open, Close, SaveAs, ExportAsHTML ...

- Scintilla : macros know all Scintilla functions and properties.

- Filerx : to work with trees and filelist.

- The whole system : using existing script engines like JScript and VBScript


macros_debug

Macros Debugging :

To debug a Macro, right-click on a macro in the Tree, and select "Debug Macro" .

Then , with the keyboard :

- "S" : steps over current line
- "G" : Go ...
- "B" : Toggle breakpoint.
- "O" : Show Output.
- "H" : Halt debug mode.
- Up/Down/Left/Right : Move Cursor
- Tab : Find next variable in text.

Or with the mouse :

- Click on a variable to see its value.
- Select any valid expression to display its value.
- Double-click on a line to toggle a breakpoint.

Ten breakpoints may be set in each macro.


Macros Shortcuts

A macro may be executed simply by typing any user defined key combination.
To define a Shortcut :
- Select a macro in the Macro Tree
- Click the Shortcut button.
- Type any key combination in the Dialog
- Validate.

To use the Shortcut :
- Type the key combination FROM ANY APPLICATION, and the macro will execute.
The output will be sent either to the internal editor or to SciTE.

But this method may consume a lot of shortcuts used by other applications, or by Windows itself.
To avoid this, you may define a single system-wide shortcut by adding to the [shortcuts] section of Filerx.ini a line like this:

_global_shortcut_=83,2,Ctrl + S

Then, typing Ctrl + S will open a small dialog where you can type the real Macro Shortcut.

- The last used shortcut is stored. If you want to use the same Macro again, you only need to type:

<Ctrl + S><ENTER>
- When you press some modifier keys combination, a tooltip window appears, showing the available shortcuts, and the corresponding Macro names.


Macros and SciTE

If you choose "Play Macro" in the contextual menu, and if SciTE is listening, the Macro commands will be sent to SciTE.
But, from SciTE, it is possible to play and record Macros, too (if Filerx is running).

From the Menu or ToolBar, or with the associated shortcut key, you may :
- Play Current Macro : current macro will be executed.
- Record Macro : A new Macro will be created, and the commands recorded.
- Stop Recording : ... stops recording.
- Play Macro ... : a list of available macros is created and shown : the user selects one to execute.

The current macro is the last recorded or executed Macro.
You may stop Macro execution with the Ctrl-Shift Key combination.


Macros and Macro Files

Macro files are saved as independent text files; but, once loaded, macros are kept in memory as a unique linked list of structures. The text itself is forgotten: if a macro is edited in the internal editor, its text is not what you typed, but the result of a decompilation.
Each macro added to the list appears at the list head.
During compilation, a called macro will be searched by name in the list, but, once compiled, names are resolved, and execution will use a pointer to the called macro.

Loading a file :

When loaded, a macro file is appended to the tree; the contained macros are compiled and kept in the list, the last compiled macro being the first in the list.
If a loaded macro has the same name than a macro already present in the list, a number is appended to its name. As macros are found by name in the list, this ensures every existing macro can be reached
But if a called macro is renamed, the calling macro won't find it : you need to reedit and recompile the calling macro.
If a called macro appears after the calling macro, the first compilation will give an error ( macro not found), but a second compilation will find the macro in the list.

Closing a file :

When a macro file is closed, it disappears from the tree; compiled macros stay in the list, but their erased_macro flag is set. An erased macro can't be run alone, but will run if called by another macro already present and compiled in another file.
The calling macro may be decompiled, but when recompiled, it won't find the erased_macro.

Saving a file :

When a macro file is saved, it contains exactly the macros appearing in the tree, and each macro contains exactly what you see in the editor.


Customizing Filerx menus

New items may be added to Filerx contextual menus.

To create a new item :

- Add a line to Filerx.ini in the desired [xxxxxmenu] section. This can be done within Filerx, in the properties Tree.

new_menu_item_text=macro_to_execute[,item_type]

- Write a void macro whose name is "macro_to_execute" accepting one string parameter.

 Macro void macro_to_execute(string passed_parameter)

Now, when you right click in a tree, or in the list corresponding to the [xxxxxmenu], if the tree/list item has the corresponding item_type , the macro_to_execute will be executed.

The passed_parameter will be the tree/list item name or path.


Macros syntax

Globally the same as C ...(a small subset of ...)

Variables :

All variables declared in a macro are local
Two types of variables : integer and string.
Variable and macro names : beginning with alpha character, and containing alphanum or underscore.
Single quoted chars ('a') are treated as integers.
You have access to individual chars in a string :

 x=mystring[10]
returns the eleventh char in mystring.
 mystring[0]='A'
sets the first char in mystring to 'A'

Variables must be declared before usage :

int n
string s
Arrays may be declared, too :
int number_array[1000]
int dim=10
string words_array[3*dim+15]

Constants :

Integers : may be written in decimal or hexadecimal (0x....) form.
Strings : Double quoted . Use reverse slash to insert special chars (\n \r \t \" \' \\ ...)
Chars : Single quoted chars may be used.where integers are expected 'A'=0x41=65

Parameter passing :

Integer or String parameters may be passed to called macros.
They are passed by value.
Arrays may be passed, by reference :

 Macro void AcceptArray(string myarray[])
This Macro will be called by :
call AcceptArray(myarray)

Operators :

Arithmetic : + - * / % << >>
Logical : && || ! (return 0 for false or 1 for true)
Bitwise: & | ^
Comparisons : == != > >= <= (work also for strings)

Precisions :

* Ending ';' is optional at end of line, but must be written inside for instructions
* If omitted, true while test will be added :
while { becomes while(1) {
* if omitted, braces'{ ... }' will be added :
while(i<10) i++ becomes while(i<10) { i++; }
* forgotten '()' may be automatically added :
while i<1 { becomes while (i<1) {
* for( ; ; ) gives an error :
write : for ( ;1; ) for an endless loop.
* The word Macro marks the start of a macro, and may not be used in the body of the Macro
* There are no execution errors mid("aaa",-1,-1) gives "" , 1/0 gives 0 ...

Limitations :

These limitations are not all checked, during compilation...

*Macro parameter number is limited to 16.
*Compiler is limited to 10 levels of blocks of each kind (while, for, if, else)
*Expression evaluation stack is limited to 20 operands
*Macro and variables names are limited to 100 chars.
*A string in an expression is limited to 500 chars.
*A tokenized expression is limited to 2000 bytes.


Base instructions

Macro type name(ptype p1,ptype p2 ...)
Macro begin

type=int|string|void

ptype=int|string

int name
integer variable declaration
string name
string variable declaration
name=expr
Variable affectation
name++
Variable incrementation
name--
Variable decrementation
while (test){
 instruction_list
}
While loop
for (instr;test;instr){
 instruction_list
}
For loop
break
Breaks while/for loop
continue
Continues while/for loop
if (test){
 instruction_list
}else if (test) {
 instruction_list
} else {
 instruction_list
}
If/else if /else
call macroname(p1,p2 ...)
Macro calling
return (expr)
Returns
message (string message_text,string window_title)
Shows a message box.
execute(string command)
Executes a valid macro command
wait(int duration)
Waits duration milliseconds
DumpCommands(int kind,int withnumbers)
Dumps Scintilla Constants, Commands and functions and macros(kind=1|2|4|8 or ORing of thes values) with numbering if withnumbers!=0
setinputseparator(string sep)
Sets the inputbox default string separator to the first char of sep.
sortstrings(string arrayname,int start,int end)
Sorts a string array between start and end indexes.
execute() allows to execute commands from SciTE.

Create a macro containing a single line :

execute(GetCurLine) Enter a valid command, or commands separated by ',', on an empty line, in SciTE; call the macro : the command(s) will be executed


Base Functions

int strlen(string)
length of string
int atoi(string)
string to int conversion
int asc(string)
char to int conversion
int isalpha(string)
true if first char of string is alpha
int isdigit(string)
true if first char of string is digit
int isspace(string)
true if first char of string is space
int instr(string1,string2)
position of string2 in string1 (-1 if not found)
int ieval(string)
Evaluates a string containing an arithmetic expression
int rand(int)
Generates pseudo random number x 0<=x<=int
string itoa(int)
int to string conversion
string itoax(int)
int to hex string conversion
string chr(int)
int to char conversion
string strcat(string1,string2)
concatenates string1 and string2 (operator "&" does the same)
string left(string,int)
left ...
string right(string,int)
right ...
string mid(string,int,int)
mid ...
string lcase(string)
convert string to lowercase
string ucase(string)
convert string to uppercase
string replace(string src,string fnd, string rpl)
replaces all occurences of fnd in src by rpl
string chars(int code,int number)
builds a string of number chars code
int messagebox(string message,string title,int flags)
Message box with return value.
Calls Windows MessageBox(NULL,message_text,window_title,flags);
string inputbox(string title,string default)
Allows user input. Returns an empty string if "Cancel" is hit.
The default string may be a list of options separated with a character defined by setinputseparator() that will be displayed in a combo box.


Filerx/script related Commands

showtree(int treeindex)
Shows the tree treeindex
showtab2(int tabindex)
Shows the tab tabindex
expanditem(int treeindex,int item)
Expands an item in the tree treeindex
collapseitem(int treeindex,int item)
Collapses an item in the tree treeindex
selectitem(int treeindex,int item)
Selects an item in the tree treeindex
sortchildren(int treeindex,int item)
Sorts item children in the tree treeindex
windowsize(int width,int height)
Sets Filerx window size
windowpos(int x,int y)
Sets Filerx window position
windowarrange(int vsplit,int treespace)
Arranges Filerx subwindows
status(string text)
Displays text in the status bar.
splash(string text1,string text2)
Displays two short texts in a window. splash("") closes the window..
viewmacrobar(int view)
Shows the Macro Bar if view=1, hides it if view=0..
scriptinit(string language)
Initializes scripting engine. Language="VBScript" or "JScript"
scriptexit()
Closes scripting engine.
scriptaddcode(string code)
Adds code to the script engine
scriptexecute(string statements)
Executes statements with the current script engine.
SCRIPTSTART name
Lines between SCRIPTSTART and SCRIPTEND
may be sent to the script engine by : scriptaddcode(name)
SCRIPTEND
End of script code.


Filerx related Functions

int getrootitem(int treeindex)
Returns the root item; then you can navigate in the tree
treeindex is the zero based index of the tree : 0=desktop; 1=projects ... 5=typelibs
int getselecteditem(int treeindex)
Returns the selected item in the treeindex tree.
int getchilditem(int treeindex, int item)
Gets the first child of item in the tree treeindex
int getnextsiblingitem(int treeindex,int item)
Gets next sibling of an item in the tree treeindex
int getparentitem(int treeindex,int item)
Gets the parent item ...
string getitemtext(int treeindex,int item)
Gets the text of an item
string getitempath(int treeindex,int item)
When the item represents a path
int getitemtype(int treeindex,int item)
Gets the internal type of an item
int finditem(int tree,int itm,string fnd, int rec)
Scans children of itm to find specified string, recursively if rec is not 0.
int getlistcount()
Returns the number of files in the File List
string getlistitemtext(int index)
Returns the List item text corresponding to the zero based index.
int getimiscinfo(int type)
Returns integer information. See macro get_misc_info for type values.
string getsmiscinfo(int type)
Returns string information. See macro get_misc_info for type values.
string scripteval(string expression)
Evaluates expression with the current script engine.


SciTE commands

These are commands directly executed by SciTE.

Open(string filename)
Tells SciTE to open/switch to the file
SaveAs(string filename)
Tells SciTE to save edited file
ExportAsHTML(string filename)
Tells SciTE to save edited file to HTML format
ExportAsPDF(string filename)
Tells SciTE to save edited file to PDF format
ExportAsRTF(string filename)
Tells SciTE to save edited file to RTF format
Close()
Tells SciTE to close edited file
Quit()
Tells SciTE to quit
Find(string text_to_find)
Finds text
ReplaceAll(string original , string replacement)
Replaces text
Output(string text_to_show)
Sends text to SciTE's output pane.Does nothing when Filerx runs alone.
MinimizeSciTE()
Minimize SciTE Window
RestoreSciTE()
Restores SciTE Window
LoadScript(string filepath)
SciTE loads and executes lua script filepath
Extender(string command)
Sends command to SciTE extender


SciTE functions

These are functions whose value is returned by SciTE.

string scite_filename
current SciTE edited file name
string scite_property (string name)
Returns property value.


Scintilla commands

As Filerx reads all available scintilla commands from scintilla.iface, the following list may change.

void AddText(string text) | void InsertText(int pos,string text)
void ClearAll() | void ClearDocumentStyle()
void Redo() | void SetUndoCollection(int collectUndo)
void SelectAll() | void SetSavePoint()
void MarkerDeleteHandle(int handle) | void SetViewWS(int viewWS)
void GotoLine(int line) | void GotoPos(int pos)
void SetAnchor(int posAnchor) | void ConvertEOLs(int eolMode)
void SetEOLMode(int eolMode) | void StartStyling(int pos,int mask)
void SetStyling(int length,int style) | void SetBufferedDraw(int buffered)
void SetTabWidth(int tabWidth) | void SetCodePage(int codePage)
void SetUsePalette(int usePalette) | void MarkerDefine(int markerNumber,int markerSymbol)
void MarkerSetFore(int markerNumber,int fore) | void MarkerSetBack(int markerNumber,int back)
void MarkerDelete(int line,int markerNumber) | void MarkerDeleteAll(int markerNumber)
void SetMarginTypeN(int margin,int marginType) | void SetMarginWidthN(int margin,int pixelWidth)
void SetMarginMaskN(int margin,int mask) | void SetMarginSensitiveN(int margin,int sensitive)
void StyleClearAll() | void StyleSetFore(int style,int fore)
void StyleSetBack(int style,int back) | void StyleSetBold(int style,int bold)
void StyleSetItalic(int style,int italic) | void StyleSetSize(int style,int sizePoints)
void StyleSetFont(int style,string fontName) | void StyleSetEOLFilled(int style,int filled)
void StyleResetDefault() | void StyleSetUnderline(int style,int underline)
void StyleSetCase(int style,int caseForce) | void StyleSetCharacterSet(int style,int characterSet)
void SetSelFore(int useSetting,int fore) | void SetSelBack(int useSetting,int back)
void SetCaretFore(int fore) | void AssignCmdKey(int km,int msg)
void ClearCmdKey(int km) | void ClearAllCmdKeys()
void SetStylingEx(int length,string styles) | void StyleSetVisible(int style,int visible)
void SetCaretPeriod(int periodMilliseconds) | void SetWordChars(string characters)
void BeginUndoAction() | void EndUndoAction()
void IndicSetStyle(int indic,int style) | void IndicSetFore(int indic,int fore)
void SetStyleBits(int bits) | void SetLineState(int line,int state)
void SetCaretLineVisible(int show) | void SetCaretLineBack(int back)
void StyleSetChangeable(int style,int changeable) | void AutoCShow(int lenEntered,string itemList)
void AutoCCancel() | void AutoCComplete()
void AutoCStops(string characterSet) | void AutoCSetSeparator(int separatorCharacter)
void AutoCSelect(string text) | void AutoCSetCancelAtStart(int cancel)
void AutoCSetFillUps(string characterSet) | void AutoCSetChooseSingle(int chooseSingle)
void AutoCSetIgnoreCase(int ignoreCase) | void UserListShow(int listType,string itemList)
void AutoCSetAutoHide(int autoHide) | void AutoCSetDropRestOfWord(int dropRestOfWord)
void SetIndent(int indentSize) | void SetUseTabs(int useTabs)
void SetLineIndentation(int line,int indentSize) | void SetHScrollBar(int show)
void SetIndentationGuides(int show) | void SetHighlightGuide(int column)
void SetCurrentPos(int pos) | void SetSelectionStart(int pos)
void SetSelectionEnd(int pos) | void SetPrintMagnification(int magnification)
void SetPrintColourMode(int mode) | void SetMarginLeft(int pixelWidth)
void SetMarginRight(int pixelWidth) | void SetSel(int start,int end)
void HideSelection(int normal) | void LineScroll(int columns,int lines)
void ScrollCaret() | void ReplaceSel(string text)
void SetReadOnly(int readOnly) | void Null()
void EmptyUndoBuffer() | void Undo()
void Cut() | void Copy()
void Paste() | void Clear()
void SetText(string text) | void SetOvertype(int overtype)
void SetCaretWidth(int pixelWidth) | void SetTargetStart(int pos)
void SetTargetEnd(int pos) | void SetSearchFlags(int flags)
void CallTipShow(int pos,string definition) | void CallTipCancel()
void CallTipSetHlt(int start,int end) | void CallTipSetBack(int back)
void SetFoldLevel(int line,int level) | void ShowLines(int lineStart,int lineEnd)
void HideLines(int lineStart,int lineEnd) | void SetFoldExpanded(int line,int expanded)
void ToggleFold(int line) | void EnsureVisible(int line)
void SetFoldFlags(int flags) | void EnsureVisibleEnforcePolicy(int line)
void SetTabIndents(int tabIndents) | void SetBackSpaceUnIndents(int bsUnIndents)
void SetMouseDwellTime(int periodMilliseconds) | void SetWrapMode(int mode)
void SetLayoutCache(int mode) | void SetScrollWidth(int pixelWidth)
void SetEndAtLastLine(int endAtLastLine) | void LineDown()
void LineDownExtend() | void LineUp()
void LineUpExtend() | void CharLeft()
void CharLeftExtend() | void CharRight()
void CharRightExtend() | void WordLeft()
void WordLeftExtend() | void WordRight()
void WordRightExtend() | void Home()
void HomeExtend() | void LineEnd()
void LineEndExtend() | void DocumentStart()
void DocumentStartExtend() | void DocumentEnd()
void DocumentEndExtend() | void PageUp()
void PageUpExtend() | void PageDown()
void PageDownExtend() | void EditToggleOvertype()
void Cancel() | void DeleteBack()
void Tab() | void BackTab()
void NewLine() | void FormFeed()
void VCHome() | void VCHomeExtend()
void ZoomIn() | void ZoomOut()
void DelWordLeft() | void DelWordRight()
void LineCut() | void LineDelete()
void LineTranspose() | void LowerCase()
void UpperCase() | void LineScrollDown()
void LineScrollUp() | void DeleteBackNotLine()
void MoveCaretInsideView() | void BraceHighlight(int pos1,int pos2)
void BraceBadLight(int pos) | void SetViewEOL(int visible)
void SetDocPointer(int pointer) | void SetModEventMask(int mask)
void SetEdgeColumn(int column) | void SetEdgeMode(int mode)
void SetEdgeColour(int edgeColour) | void SearchAnchor()
void SetCaretPolicy(int caretPolicy,int caretSlop) | void UsePopUp(int allowPopUp)
void SetZoom(int zoom) | void AddRefDocument(int doc)
void ReleaseDocument(int doc) | void SetFocus(int focus)
void SetStatus(int statusCode) | void SetMouseDownCaptures(int captures)
void SetCursor(int cursorType) | void SetControlCharSymbol(int symbol)
void WordPartLeft() | void WordPartLeftExtend()
void WordPartRight() | void WordPartRightExtend()
void SetVisiblePolicy(int visiblePolicy,int visibleSlop) | void DelLineLeft()
void DelLineRight() | void SetXOffset(int newOffset)
void GrabFocus() | void StartRecord()
void StopRecord() | void SetLexer(int lexer)
void Colourise(int start,int end) | void SetProperty(string key,string value)
void SetKeyWords(int keywordSet,string keyWords) | void SetLexerLanguage(string language)


Scintilla Functions

As Filerx reads all available scintilla functions from scintilla.iface, the following list may change.

Note that this table has been built with a macro ...(Constants_to_html)

int GetLength() | int GetCharAt(int pos)
int GetCurrentPos() | int GetAnchor()
int GetStyleAt(int pos) | int CanRedo()
int MarkerLineFromHandle(int handle) | int GetUndoCollection()
int GetViewWS() | int PositionFromPoint(int x,int y)
int PositionFromPointClose(int x,int y) | string GetCurLine()
int GetEndStyled() | int GetEOLMode()
int GetBufferedDraw() | int GetTabWidth()
int MarkerAdd(int line,int markerNumber) | int MarkerGet(int line)
int MarkerNext(int lineStart,int markerMask) | int MarkerPrevious(int lineStart,int markerMask)
int GetMarginTypeN(int margin) | int GetMarginWidthN(int margin)
int GetMarginMaskN(int margin) | int GetMarginSensitiveN(int margin)
int GetCaretPeriod() | int IndicGetStyle(int indic)
int IndicGetFore(int indic) | int GetStyleBits()
int GetLineState(int line) | int GetMaxLineState()
int GetCaretLineVisible() | int GetCaretLineBack()
int AutoCActive() | int AutoCPosStart()
int AutoCGetSeparator() | int AutoCGetCancelAtStart()
int AutoCGetChooseSingle() | int AutoCGetIgnoreCase()
int AutoCGetAutoHide() | int AutoCGetDropRestOfWord()
int GetIndent() | int GetUseTabs()
int GetLineIndentation(int line) | int GetLineIndentPosition(int line)
int GetColumn(int pos) | int GetHScrollBar()
int GetIndentationGuides() | int GetHighlightGuide()
int GetLineEndPosition(int line) | int GetCodePage()
int GetCaretFore() | int GetUsePalette()
int GetReadOnly() | int GetSelectionStart()
int GetSelectionEnd() | int GetPrintMagnification()
int GetPrintColourMode() | int GetFirstVisibleLine()
string GetLine(int line) | int GetLineCount()
int GetMarginLeft() | int GetMarginRight()
int GetModify() | string GetSelText()
int PointXFromPosition(int pos) | int PointYFromPosition(int pos)
int LineFromPosition(int pos) | int PositionFromLine(int line)
int CanPaste() | int CanUndo()
string GetText() | int GetTextLength()
int GetDirectFunction() | int GetDirectPointer()
int GetOvertype() | int GetCaretWidth()
int GetTargetStart() | int GetTargetEnd()
int ReplaceTarget(int length,string text) | int ReplaceTargetRE(int length,string text)
int SearchInTarget(int length,string text) | int GetSearchFlags()
int CallTipActive() | int CallTipPosStart()
int VisibleFromDocLine(int line) | int DocLineFromVisible(int lineDisplay)
int GetFoldLevel(int line) | int GetLastChild(int line,int level)
int GetFoldParent(int line) | int GetLineVisible(int line)
int GetFoldExpanded(int line) | int GetTabIndents()
int GetBackSpaceUnIndents() | int GetMouseDwellTime()
int WordStartPosition(int pos,int onlyWordCharacters) | int WordEndPosition(int pos,int onlyWordCharacters)
int GetWrapMode() | int GetLayoutCache()
int GetScrollWidth() | int TextWidth(int style,string text)
int GetEndAtLastLine() | int TextHeight(int line)
int LineLength(int line) | int BraceMatch(int pos)
int GetViewEOL() | int GetDocPointer()
int GetEdgeColumn() | int GetEdgeMode()
int GetEdgeColour() | int SearchNext(int flags,string text)
int SearchPrev(int flags,string text) | int LinesOnScreen()
int SelectionIsRectangle() | int GetZoom()
int CreateDocument() | int GetModEventMask()
int GetFocus() | int GetStatus()
int GetMouseDownCaptures() | int GetCursor()
int GetControlCharSymbol() | int GetXOffset()
int GetLexer()


Scintilla Constants

As Filerx reads all available scintilla constants from scintilla.iface, the following list may change.

INVALID_POSITION=-1 | SCI_START=2000
SCI_OPTIONAL_START=3000 | SCI_LEXER_START=4000
SCWS_INVISIBLE=0 | SCWS_VISIBLEALWAYS=1
SCWS_VISIBLEAFTERINDENT=2 | SC_EOL_CRLF=0
SC_EOL_CR=1 | SC_EOL_LF=2
SC_CP_UTF8=65001 | MARKER_MAX=31
SC_MARK_CIRCLE=0 | SC_MARK_ROUNDRECT=1
SC_MARK_ARROW=2 | SC_MARK_SMALLRECT=3
SC_MARK_SHORTARROW=4 | SC_MARK_EMPTY=5
SC_MARK_ARROWDOWN=6 | SC_MARK_MINUS=7
SC_MARK_PLUS=8 | SC_MARK_VLINE=9
SC_MARK_LCORNER=10 | SC_MARK_TCORNER=11
SC_MARK_BOXPLUS=12 | SC_MARK_BOXPLUSCONNECTED=13
SC_MARK_BOXMINUS=14 | SC_MARK_BOXMINUSCONNECTED=15
SC_MARK_LCORNERCURVE=16 | SC_MARK_TCORNERCURVE=17
SC_MARK_CIRCLEPLUS=18 | SC_MARK_CIRCLEPLUSCONNECTED=19
SC_MARK_CIRCLEMINUS=20 | SC_MARK_CIRCLEMINUSCONNECTED=21
SC_MARK_BACKGROUND=22 | SC_MARK_CHARACTER=10000
SC_MARKNUM_FOLDEREND=25 | SC_MARKNUM_FOLDEROPENMID=26
SC_MARKNUM_FOLDERMIDTAIL=27 | SC_MARKNUM_FOLDERTAIL=28
SC_MARKNUM_FOLDERSUB=29 | SC_MARKNUM_FOLDER=30
SC_MARKNUM_FOLDEROPEN=31 | SC_MASK_FOLDERS=0xFE000000
SC_MARGIN_SYMBOL=0 | SC_MARGIN_NUMBER=1
STYLE_DEFAULT=32 | STYLE_LINENUMBER=33
STYLE_BRACELIGHT=34 | STYLE_BRACEBAD=35
STYLE_CONTROLCHAR=36 | STYLE_INDENTGUIDE=37
STYLE_LASTPREDEFINED=39 | STYLE_MAX=127
SC_CHARSET_ANSI=0 | SC_CHARSET_DEFAULT=1
SC_CHARSET_BALTIC=186 | SC_CHARSET_CHINESEBIG5=136
SC_CHARSET_EASTEUROPE=238 | SC_CHARSET_GB2312=134
SC_CHARSET_GREEK=161 | SC_CHARSET_HANGUL=129
SC_CHARSET_MAC=77 | SC_CHARSET_OEM=255
SC_CHARSET_RUSSIAN=204 | SC_CHARSET_SHIFTJIS=128
SC_CHARSET_SYMBOL=2 | SC_CHARSET_TURKISH=162
SC_CHARSET_JOHAB=130 | SC_CHARSET_HEBREW=177
SC_CHARSET_ARABIC=178 | SC_CHARSET_VIETNAMESE=163
SC_CHARSET_THAI=222 | SC_CASE_MIXED=0
SC_CASE_UPPER=1 | SC_CASE_LOWER=2
INDIC_MAX=7 | INDIC_PLAIN=0
INDIC_SQUIGGLE=1 | INDIC_TT=2
INDIC_DIAGONAL=3 | INDIC_STRIKE=4
INDIC0_MASK=0x20 | INDIC1_MASK=0x40
INDIC2_MASK=0x80 | INDICS_MASK=0xE0
SC_PRINT_NORMAL=0 | SC_PRINT_INVERTLIGHT=1
SC_PRINT_BLACKONWHITE=2 | SC_PRINT_COLOURONWHITE=3
SC_PRINT_COLOURONWHITEDEFAULTBG=4 | SCFIND_WHOLEWORD=2
SCFIND_MATCHCASE=4 | SCFIND_WORDSTART=0x00100000
SCFIND_REGEXP=0x00200000 | SC_FOLDLEVELBASE=0x400
SC_FOLDLEVELWHITEFLAG=0x1000 | SC_FOLDLEVELHEADERFLAG=0x2000
SC_FOLDLEVELNUMBERMASK=0x0FFF | SC_TIME_FOREVER=10000000
SC_WRAP_NONE=0 | SC_WRAP_WORD=1
SC_CACHE_NONE=0 | SC_CACHE_CARET=1
SC_CACHE_PAGE=2 | SC_CACHE_DOCUMENT=3
EDGE_NONE=0 | EDGE_LINE=1
EDGE_BACKGROUND=2 | CARET_SLOP=0x01
CARET_CENTER=0x02 | CARET_STRICT=0x04
CARET_XEVEN=0x08 | CARET_XJUMPS=0x10
SC_CURSORNORMAL=-1 | SC_CURSORWAIT=3
VISIBLE_SLOP=0x01 | VISIBLE_STRICT=0x04
SC_MOD_INSERTTEXT=0x1 | SC_MOD_DELETETEXT=0x2
SC_MOD_CHANGESTYLE=0x4 | SC_MOD_CHANGEFOLD=0x8
SC_PERFORMED_USER=0x10 | SC_PERFORMED_UNDO=0x20
SC_PERFORMED_REDO=0x40 | SC_LASTSTEPINUNDOREDO=0x100
SC_MOD_CHANGEMARKER=0x200 | SC_MOD_BEFOREINSERT=0x400
SC_MOD_BEFOREDELETE=0x800 | SC_MODEVENTMASKALL=0xF77
SCEN_CHANGE=768 | SCEN_SETFOCUS=512
SCEN_KILLFOCUS=256 | SCK_DOWN=300
SCK_UP=301 | SCK_LEFT=302
SCK_RIGHT=303 | SCK_HOME=304
SCK_END=305 | SCK_PRIOR=306
SCK_NEXT=307 | SCK_DELETE=308
SCK_INSERT=309 | SCK_ESCAPE=7
SCK_BACK=8 | SCK_TAB=9
SCK_RETURN=13 | SCK_ADD=310
SCK_SUBTRACT=311 | SCK_DIVIDE=312
SCMOD_SHIFT=1 | SCMOD_CTRL=2
SCMOD_ALT=4 | SCLEX_CONTAINER=0
SCLEX_NULL=1 | SCLEX_PYTHON=2
SCLEX_CPP=3 | SCLEX_HTML=4
SCLEX_XML=5 | SCLEX_PERL=6
SCLEX_SQL=7 | SCLEX_VB=8
SCLEX_PROPERTIES=9 | SCLEX_ERRORLIST=10
SCLEX_MAKEFILE=11 | SCLEX_BATCH=12
SCLEX_XCODE=13 | SCLEX_LATEX=14
SCLEX_LUA=15 | SCLEX_DIFF=16
SCLEX_CONF=17 | SCLEX_PASCAL=18
SCLEX_AVE=19 | SCLEX_ADA=20
SCLEX_LISP=21 | SCLEX_RUBY=22
SCLEX_EIFFEL=23 | SCLEX_EIFFELKW=24
SCLEX_TCL=25 | SCLEX_NNCRONTAB=26
SCLEX_BULLANT=27 | SCLEX_VBSCRIPT=28
SCLEX_ASP=29 | SCLEX_PHP=30
SCLEX_BAAN=31 | SCLEX_MATLAB=32
SCLEX_AUTOMATIC=1000 | SCE_P_DEFAULT=0
SCE_P_COMMENTLINE=1 | SCE_P_NUMBER=2
SCE_P_STRING=3 | SCE_P_CHARACTER=4
SCE_P_WORD=5 | SCE_P_TRIPLE=6
SCE_P_TRIPLEDOUBLE=7 | SCE_P_CLASSNAME=8
SCE_P_DEFNAME=9 | SCE_P_OPERATOR=10
SCE_P_IDENTIFIER=11 | SCE_P_COMMENTBLOCK=12
SCE_P_STRINGEOL=13 | SCE_C_DEFAULT=0
SCE_C_COMMENT=1 | SCE_C_COMMENTLINE=2
SCE_C_COMMENTDOC=3 | SCE_C_NUMBER=4
SCE_C_WORD=5 | SCE_C_STRING=6
SCE_C_CHARACTER=7 | SCE_C_UUID=8
SCE_C_PREPROCESSOR=9 | SCE_C_OPERATOR=10
SCE_C_IDENTIFIER=11 | SCE_C_STRINGEOL=12
SCE_C_VERBATIM=13 | SCE_C_REGEX=14
SCE_C_COMMENTLINEDOC=15 | SCE_C_WORD2=16
SCE_C_COMMENTDOCKEYWORD=17 | SCE_C_COMMENTDOCKEYWORDERROR=18
SCE_H_DEFAULT=0 | SCE_H_TAG=1
SCE_H_TAGUNKNOWN=2 | SCE_H_ATTRIBUTE=3
SCE_H_ATTRIBUTEUNKNOWN=4 | SCE_H_NUMBER=5
SCE_H_DOUBLESTRING=6 | SCE_H_SINGLESTRING=7
SCE_H_OTHER=8 | SCE_H_COMMENT=9
SCE_H_ENTITY=10 | SCE_H_TAGEND=11
SCE_H_XMLSTART=12 | SCE_H_XMLEND=13
SCE_H_SCRIPT=14 | SCE_H_ASP=15
SCE_H_ASPAT=16 | SCE_H_CDATA=17
SCE_H_QUESTION=18 | SCE_H_VALUE=19
SCE_H_XCCOMMENT=20 | SCE_H_SGML_DEFAULT=21
SCE_H_SGML_COMMAND=22 | SCE_H_SGML_1ST_PARAM=23
SCE_H_SGML_DOUBLESTRING=24 | SCE_H_SGML_SIMPLESTRING=25
SCE_H_SGML_ERROR=26 | SCE_H_SGML_SPECIAL=27
SCE_H_SGML_ENTITY=28 | SCE_H_SGML_COMMENT=29
SCE_H_SGML_1ST_PARAM_COMMENT=30 | SCE_H_SGML_BLOCK_DEFAULT=31
SCE_HJ_START=40 | SCE_HJ_DEFAULT=41
SCE_HJ_COMMENT=42 | SCE_HJ_COMMENTLINE=43
SCE_HJ_COMMENTDOC=44 | SCE_HJ_NUMBER=45
SCE_HJ_WORD=46 | SCE_HJ_KEYWORD=47
SCE_HJ_DOUBLESTRING=48 | SCE_HJ_SINGLESTRING=49
SCE_HJ_SYMBOLS=50 | SCE_HJ_STRINGEOL=51
SCE_HJ_REGEX=52 | SCE_HJA_START=55
SCE_HJA_DEFAULT=56 | SCE_HJA_COMMENT=57
SCE_HJA_COMMENTLINE=58 | SCE_HJA_COMMENTDOC=59
SCE_HJA_NUMBER=60 | SCE_HJA_WORD=61
SCE_HJA_KEYWORD=62 | SCE_HJA_DOUBLESTRING=63
SCE_HJA_SINGLESTRING=64 | SCE_HJA_SYMBOLS=65
SCE_HJA_STRINGEOL=66 | SCE_HJA_REGEX=67
SCE_HB_START=70 | SCE_HB_DEFAULT=71
SCE_HB_COMMENTLINE=72 | SCE_HB_NUMBER=73
SCE_HB_WORD=74 | SCE_HB_STRING=75
SCE_HB_IDENTIFIER=76 | SCE_HB_STRINGEOL=77
SCE_HBA_START=80 | SCE_HBA_DEFAULT=81
SCE_HBA_COMMENTLINE=82 | SCE_HBA_NUMBER=83
SCE_HBA_WORD=84 | SCE_HBA_STRING=85
SCE_HBA_IDENTIFIER=86 | SCE_HBA_STRINGEOL=87
SCE_HP_START=90 | SCE_HP_DEFAULT=91
SCE_HP_COMMENTLINE=92 | SCE_HP_NUMBER=93
SCE_HP_STRING=94 | SCE_HP_CHARACTER=95
SCE_HP_WORD=96 | SCE_HP_TRIPLE=97
SCE_HP_TRIPLEDOUBLE=98 | SCE_HP_CLASSNAME=99
SCE_HP_DEFNAME=100 | SCE_HP_OPERATOR=101
SCE_HP_IDENTIFIER=102 | SCE_HPA_START=105
SCE_HPA_DEFAULT=106 | SCE_HPA_COMMENTLINE=107
SCE_HPA_NUMBER=108 | SCE_HPA_STRING=109
SCE_HPA_CHARACTER=110 | SCE_HPA_WORD=111
SCE_HPA_TRIPLE=112 | SCE_HPA_TRIPLEDOUBLE=113
SCE_HPA_CLASSNAME=114 | SCE_HPA_DEFNAME=115
SCE_HPA_OPERATOR=116 | SCE_HPA_IDENTIFIER=117
SCE_HPHP_DEFAULT=118 | SCE_HPHP_HSTRING=119
SCE_HPHP_SIMPLESTRING=120 | SCE_HPHP_WORD=121
SCE_HPHP_NUMBER=122 | SCE_HPHP_VARIABLE=123
SCE_HPHP_COMMENT=124 | SCE_HPHP_COMMENTLINE=125
SCE_HPHP_HSTRING_VARIABLE=126 | SCE_HPHP_OPERATOR=127
SCE_PL_DEFAULT=0 | SCE_PL_ERROR=1
SCE_PL_COMMENTLINE=2 | SCE_PL_POD=3
SCE_PL_NUMBER=4 | SCE_PL_WORD=5
SCE_PL_STRING=6 | SCE_PL_CHARACTER=7
SCE_PL_PUNCTUATION=8 | SCE_PL_PREPROCESSOR=9
SCE_PL_OPERATOR=10 | SCE_PL_IDENTIFIER=11
SCE_PL_SCALAR=12 | SCE_PL_ARRAY=13
SCE_PL_HASH=14 | SCE_PL_SYMBOLTABLE=15
SCE_PL_REGEX=17 | SCE_PL_REGSUBST=18
SCE_PL_LONGQUOTE=19 | SCE_PL_BACKTICKS=20
SCE_PL_DATASECTION=21 | SCE_PL_HERE_DELIM=22
SCE_PL_HERE_Q=23 | SCE_PL_HERE_QQ=24
SCE_PL_HERE_QX=25 | SCE_PL_STRING_Q=26
SCE_PL_STRING_QQ=27 | SCE_PL_STRING_QX=28
SCE_PL_STRING_QR=29 | SCE_PL_STRING_QW=30
SCE_B_DEFAULT=0 | SCE_B_COMMENT=1
SCE_B_NUMBER=2 | SCE_B_KEYWORD=3
SCE_B_STRING=4 | SCE_B_PREPROCESSOR=5
SCE_B_OPERATOR=6 | SCE_B_IDENTIFIER=7
SCE_B_DATE=8 | SCE_PROPS_DEFAULT=0
SCE_PROPS_COMMENT=1 | SCE_PROPS_SECTION=2
SCE_PROPS_ASSIGNMENT=3 | SCE_PROPS_DEFVAL=4
SCE_L_DEFAULT=0 | SCE_L_COMMAND=1
SCE_L_TAG=2 | SCE_L_MATH=3
SCE_L_COMMENT=4 | SCE_LUA_DEFAULT=0
SCE_LUA_COMMENT=1 | SCE_LUA_COMMENTLINE=2
SCE_LUA_COMMENTDOC=3 | SCE_LUA_NUMBER=4
SCE_LUA_WORD=5 | SCE_LUA_STRING=6
SCE_LUA_CHARACTER=7 | SCE_LUA_LITERALSTRING=8
SCE_LUA_PREPROCESSOR=9 | SCE_LUA_OPERATOR=10
SCE_LUA_IDENTIFIER=11 | SCE_LUA_STRINGEOL=12
SCE_LUA_WORD2=13 | SCE_LUA_WORD3=14
SCE_LUA_WORD4=15 | SCE_LUA_WORD5=16
SCE_LUA_WORD6=17 | SCE_ERR_DEFAULT=0
SCE_ERR_PYTHON=1 | SCE_ERR_GCC=2
SCE_ERR_MS=3 | SCE_ERR_CMD=4
SCE_ERR_BORLAND=5 | SCE_ERR_PERL=6
SCE_ERR_NET=7 | SCE_ERR_LUA=8
SCE_ERR_CTAG=9 | SCE_ERR_DIFF_CHANGED=10
SCE_ERR_DIFF_ADDITION=11 | SCE_ERR_DIFF_DELETION=12
SCE_ERR_DIFF_MESSAGE=13 | SCE_BAT_DEFAULT=0
SCE_BAT_COMMENT=1 | SCE_BAT_WORD=2
SCE_BAT_LABEL=3 | SCE_BAT_HIDE=4
SCE_BAT_COMMAND=5 | SCE_BAT_IDENTIFIER=6
SCE_BAT_OPERATOR=7 | SCE_MAKE_DEFAULT=0
SCE_MAKE_COMMENT=1 | SCE_MAKE_PREPROCESSOR=2
SCE_MAKE_IDENTIFIER=3 | SCE_MAKE_OPERATOR=4
SCE_MAKE_TARGET=5 | SCE_MAKE_IDEOL=9
SCE_DIFF_DEFAULT=0 | SCE_DIFF_COMMENT=1
SCE_DIFF_COMMAND=2 | SCE_DIFF_HEADER=3
SCE_DIFF_POSITION=4 | SCE_DIFF_DELETED=5
SCE_DIFF_ADDED=6 | SCE_CONF_DEFAULT=0
SCE_CONF_COMMENT=1 | SCE_CONF_NUMBER=2
SCE_CONF_IDENTIFIER=3 | SCE_CONF_EXTENSION=4
SCE_CONF_PARAMETER=5 | SCE_CONF_STRING=6
SCE_CONF_OPERATOR=7 | SCE_CONF_IP=8
SCE_CONF_DIRECTIVE=9 | SCE_AVE_DEFAULT=0
SCE_AVE_COMMENT=1 | SCE_AVE_NUMBER=2
SCE_AVE_WORD=3 | SCE_AVE_KEYWORD=4
SCE_AVE_STATEMENT=5 | SCE_AVE_STRING=6
SCE_AVE_ENUM=7 | SCE_AVE_STRINGEOL=8
SCE_AVE_IDENTIFIER=9 | SCE_AVE_OPERATOR=10
SCE_ADA_DEFAULT=0 | SCE_ADA_COMMENT=1
SCE_ADA_NUMBER=2 | SCE_ADA_WORD=3
SCE_ADA_STRING=4 | SCE_ADA_CHARACTER=5
SCE_ADA_OPERATOR=6 | SCE_ADA_IDENTIFIER=7
SCE_ADA_STRINGEOL=8 | SCE_BAAN_DEFAULT=0
SCE_BAAN_COMMENT=1 | SCE_BAAN_COMMENTDOC=2
SCE_BAAN_NUMBER=3 | SCE_BAAN_WORD=4
SCE_BAAN_STRING=5 | SCE_BAAN_PREPROCESSOR=6
SCE_BAAN_OPERATOR=7 | SCE_BAAN_IDENTIFIER=8
SCE_BAAN_STRINGEOL=9 | SCE_BAAN_WORD2=10
SCE_LISP_DEFAULT=0 | SCE_LISP_COMMENT=1
SCE_LISP_NUMBER=2 | SCE_LISP_KEYWORD=3
SCE_LISP_STRING=6 | SCE_LISP_STRINGEOL=8
SCE_LISP_IDENTIFIER=9 | SCE_LISP_OPERATOR=10
SCE_EIFFEL_DEFAULT=0 | SCE_EIFFEL_COMMENTLINE=1
SCE_EIFFEL_NUMBER=2 | SCE_EIFFEL_WORD=3
SCE_EIFFEL_STRING=4 | SCE_EIFFEL_CHARACTER=5
SCE_EIFFEL_OPERATOR=6 | SCE_EIFFEL_IDENTIFIER=7
SCE_EIFFEL_STRINGEOL=8 | SCE_NNCRONTAB_DEFAULT=0
SCE_NNCRONTAB_COMMENT=1 | SCE_NNCRONTAB_TASK=2
SCE_NNCRONTAB_SECTION=3 | SCE_NNCRONTAB_KEYWORD=4
SCE_NNCRONTAB_MODIFIER=5 | SCE_NNCRONTAB_ASTERISK=6
SCE_NNCRONTAB_NUMBER=7 | SCE_NNCRONTAB_STRING=8
SCE_NNCRONTAB_ENVIRONMENT=9 | SCE_NNCRONTAB_IDENTIFIER=10
SCE_MATLAB_DEFAULT=0 | SCE_MATLAB_COMMENT=1
SCE_MATLAB_COMMAND=2 | SCE_MATLAB_NUMBER=3
SCE_MATLAB_KEYWORD=4 | SCE_MATLAB_STRING=5
SCE_MATLAB_OPERATOR=6 | SCE_MATLAB_IDENTIFIER=7
SCN_CHECKBRACE=2007


System instructions

shellexecute(string file,string parameters, int hide)
Will execute ShellExecute(null,"open",file,parameters,null,flag)
if hide=0, flag=SW_SHOWDEFAULT, else flag=SW_HIDE
shellexecutewait(string file,string parameters,int hide)
Same as shellexecute but waits till the launched process terminates.
savestringas(string text,string filepath)
Saves contents of text variable to filepath. CAUTION : if already existing, filepath will be overwritten.


System functions

int year
4 digit year number
int month
month 1 ... 12
int day
day in month 1 ... 31
int hour
hour 0 ... 23
int minute
minute 0 ... 59
int second
second 0 ... 59
int pathexists(string path)
Return 1 if the specified path exists; 0 if not.
int enumfiles(string spec,bool dirs,string result)
Enumerates the files (or directories if dirs is not 0) corresponding to spec. Found names are stored in the array result.Returns the number of files(dirs) found..
int lasterror()
Returns last file operation error code.
string loadstringfrom(string filepath)
Loads contents of a text into a string variable.


internal_dll

macro.dll internals :

 //*******************************
 //macro.dll exported functions :
 //*******************************
__declspec( dllexport ) void SetCommunicator(CMacroCommunicator * maccom);
 __declspec( dllexport ) bool LoadIface(char * ifacename);
 __declspec( dllexport ) macro * CreateMacro();
 __declspec( dllexport ) void DeleteMacro(macro * m);
 __declspec( dllexport ) int GetCommandCode(char * command);
 __declspec( dllexport ) char * GetMacroKeyWords();
 __declspec( dllexport ) char * GetToolTip(char * fname);
 __declspec( dllexport ) void Compile(macro * m, macro * ms,char * macbeg,char ** macend);
 __declspec( dllexport ) void Play(macro * m, macro * ms);
 __declspec( dllexport ) void Debug(macro * m);
 __declspec( dllexport ) char * GetValueOf(macro * m,char * varname);
 __declspec( dllexport ) char * GetValueOfExpr(macro * m,char * expr);
 __declspec( dllexport ) void Record(macro * m,int message,int wParam,int lParam);
 __declspec( dllexport ) char * Decompile(macro * m, macro * ms);
 __declspec( dllexport ) char * Dumpcode(macro * m);
bool LoadIface(char * ifacename);
 //--------------------------------
 //Loads scintilla iface file (scintilla.iface)
 //returns true if loading succeeded.
void SetCommunicator(CMacroCommunicator * maccom);
 //-------------------------------------------------
 //Tells macro.dll to send calls to class *maccom derived from CMacroCommunicator.
macro * CreateMacro();
 //---------------------
 //To create a new macro
void DeleteMacro(macro * m);
 //---------------------------
 //To delete an existing macro
int GetCommandCode(char * command);
 //----------------------------------
 //Given an existing command of scintilla.iface, returns the integer code of command.
char * GetMacroKeyWords();
 //---------------------------
 //Called when initializing internal Scintilla control, to have a list of space separated keywords for syntax coloring.
char * GetToolTip(char * fname);
 //-------------------------------
 //Given an existing command of scintilla.iface,returns complete syntax.
void Compile(macro * m, macro * ms,char * macbeg,char ** macend);
 //-----------------------------------------------------
 //Call this function to compile a text into macro code.
 //macbeg points to the first character of macro text.
 //macend returns the last macro character +1 : next macro first character if the buffer contains more than one macro.
char * Decompile(macro * m, macro * ms);
 //-----------------------------------
 //Decompiles a macro's code. Returns a pointer to the text.
void Play(macro * m);
 //--------------------
 //Plays a macro.
void Record(macro * m,int message,int wParam,int lParam);
 //--------------------------------------------------------
 //Records a message in macro pointed to by m.

/******************
 How to use the dll ?
 ******************/
//One or more classes must be derived from CMacroCommunicator (macro.h) :
class CFilerDlg : public CDialog, public CMacroCommunicator
 {
 public:
 ....
 void ToSendMessage(int typ,const char * arg=NULL,const char * arg2=NULL); //Send Message to caller
 void ToSendMacroCommand(int cmd,int p1,char * t,char * params);
 int GetInfo(int code,char * params,int arg,int arg2);
 bool FilerxDebug(macro * m,int line);
 ....
 //Four functions declared as pure virtual in CMacroCommunicator must be declared and implemented in this class.

// Load scintilla.iface
 bool b=LoadIface("c:\???\scintilla.iface")
 if (!b) {
 // No scintilla functions/methods available
 }
// Initialize communication routines :
 SetCommunicator(CMacroCommunicator * CFilerDlg);
// Now, macros may be created
#define MAX_WORDLEN 100
 //macro flags
 #define empty_macro 0
 #define bad_macro 1
 #define good_macro 2
 #define good_called_macro 3
 #define good_returning_macro 4
 #define good_called_returning_macro 5
 #define good_recorded_macro 6
 #define calling_macro 256
// What a program may see in a macro :
class macro {
 public:
 char name[MAX_WORDLEN]; //macro name
 int flags; //state flags
 int shortcut;
 int breakpoints[10];
 macro * prev; //link to previous
 macro * next; //link to next
 };
//Creation + execution
 char * macroend;
 macro * m=CreateMacro();
 Compile(m, NULL, "Macro void Hello\nAddText(\"Hello\")\n");
 if ((m->flags & 255)==good_macro || (m->flags & 255)==good_returning_macro)
 Play(m);
 DeleteMacro(m);
//Record + execution + decompilation
 m=CreateMacro();
 Record(m,command1,wParam1,lParam1);
 Record(m,command2,wParam2,lParam2);
 .....
 Record(m,0,0,0);
 if (m->flags != empty_macro)
 Play(m);
 char * text=Decompile(m,NULL);
 if (text){
 // do what you want with the text
 delete[]text;
 }
 DeleteMacro(m);
// If you intend to create macros that call other macros ,you must put the macros in a linked list.
 // The macro Class has two pointers (next and prev) that allow you to do that easily.
 // The second parameter of Compile()/Decompile() is a pointer to the first macro of the list.
 macro * mymacrolist;
macro * m1=CreateMacro();
m1->prev=NULL;
macro * m2=CreateMacro();
m2->prev=m1;
m1->next=m2;
macro * m3=CreateMacro();
m3->prev=m2;
m2->next=m3;
m3->next=NULL;
mymacrolist=m1;
Compile(m3,mymacrolist,text_to_compile);
// If m3 calls m1 or m2, the compiler will find them in the list...


internal_scite_listening

Currently understood SciTE messages :

 static receive_comm to_receive[]={
 {SCD_IDENTIFY,"identity",0},
 {SCD_CLOSING,"closing",0},
 {SCD_OPENED,"opened",0},
 {SCD_FILENAME,"filename",0},
 {SCD_SAVED,"saved",0},
 {SCD_SWITCHED,"switched",0},
 {SCD_PROPERTY,"property",0},
 {SCD_MACRO,"macro",1},
 {SCD_MACRO_RUN,"run",0},
 {SCD_MACRO_GETLIST,"getlist",0},
 {SCD_MACRO_RECORD,"record",0},
 {SCD_MACRO_STOPRECORD,"stoprecord",0},
 {SCD_MACRO_INTINFO,"intinfo",0},
 {SCD_MACRO_STRINGINFO,"stringinfo",0},
 {0,""},
 };

Received messages details :

identity:<integer> | SciTE gives his WindowID.
closing: | SciTE is closing.
opened:<file_path> | SciTE opened a file.
filename:<file_path> | SciTE returns the currently edited file path.
saved:<file_path> | SciTE saved a file.
switched:<file_path> | SciTE switched to another file.
property:<property_name>=<property_value> | SciTE returns one of his properties.
macro:run:<macro_name> | SciTE wants to run a Macro.
macro:getlist: | SciTE wants to have the list of available Macros.
macro:record:<command>:<wParam>:<lParam> | SciTE wants to record a Macro-instruction.
macro:stoprecord: | SciTE wants to stop recording a Macro.
macro:intinfo:<integer> | SciTE answers to an integer Macro function.
macro:intinfo:<string> | SciTE answers to a string Macro function.


internal_scite_sending

Messages sent to SciTE :

static send_comm to_send[]={
{SCD_IDENTIFY,"identity:"},
{SCD_OPEN,"open:"},
{SCD_CLOSE,"close:"},
{SCD_QUIT,"quit:"},
{SCD_SAVEAS,"saveas:"},
{SCD_EXPORTASHTML,"exportashtml:"},
{SCD_EXPORTASPDF,"exportaspdf:"},
{SCD_EXPORTASRTF,"exportasrtf:"},
{SCD_MENUCOMMAND,"menucommand:"},
{SCD_CLOSING,"closing:"},
{SCD_ENUMPROPERTIES,"enumproperties:"},
{SCD_SETPROPERTY,"property:"},
{SCD_MACROLIST,"macrolist:"},
{SCD_CURRENTMACRO,"currentmacro:"},
{SCD_ASKFILENAME,"askfilename:"},
{SCD_ASKPROPERTY,"askproperty:"},
{SCD_REPLACEALL,"replaceall:"},
{SCD_FIND,"find:"},
{SCD_MACROENABLE,"macroenable:"},
{SCD_MACROCOMMAND,"macrocommand:"},
{SCD_OUTPUT,"output:"},
{0,""},
};

Sent messages details :

identity:<integer> | Filerx sends his WindowID.
open:<file_path> | Ask SciTE to open a file.
close: | Ask SciTE to close current file.
quit: | Ask SciTE to quit.
saveas:<file_path> | Ask SciTE to save a file.
exportashtml:<file_path> | Ask SciTE to save a file as a HTML file.
exportaspdf:<file_path> | Ask SciTE to save a file as a PDF file.
exportasrtf:<file_path> | Ask SciTE to save a file as a RTF file.
menucommand:<menu_text> | Ask SciTE to run the menu command whose text begins with <menu_text>.
closing: | Filerx is closing.
enumproperties:<category> | Ask SciTE to enumerate properties. <category> is one of "base", "dyn", "local", "user", "abbrev", "embed".
property:<property_name>=<property_value> | Ask SciTE to change one of his properties.
currentmacro:<macro_name> | Gives SciTE the name of the current Macro.
askfilename: | Ask SciTE to give the currently edited file path.
askproperty:<property_name> | Ask SciTE the value of property <property_name> .
replaceall:<string>\0<replacement_string> | Ask SciTE to replace all occurences of <string> by <replacement_string>.
find:<string> | Ask SciTE to find next occurence of <string>.
macroenable:<value> | Tells SciTE that Macros are available if <value>!=0.
macrocommand:<command>;<params>;<arg1>;<arg2> | Ask SciTE to execute a Macro-instruction.
output:<string> | Ask SciTE to write <string> in the Output pane.


internal_dumping

Dumping a Macro :

For debugging purposes, or to have an idea of the internal organization of macros, Macro code can be dumped.

Example:

The Macro text:

Macro void open_close
    string file = "c:\\_wscite\\macrotest.txt";
    string file1 = "c:\\_wscite\\macrotest1.txt";
    Open(file);
    while (lcase(scite_filename)!=lcase(file)) {
    }
    ReplaceAll("This", "That");
    DocumentEnd;
    AddText("Done ...");
    SaveAs(file1);
    Open(file1);
    Close;
Dumped code:
0 : string 		12 2 104 0x79c680 0x79dd10
c : string 		12 2 104 0x79e950 0x79e910
18 : Open 		12 2 300 0x1000e890 0x79e840
24 : while 		8 1 112 0x79e7f0
2c : !jmp 		8 1 120 0x44
34 : !{ 		4 0 110
38 : !} 		4 0 111
3c : !jmp 		8 1 120 0x24
44 : ReplaceAll 	16 3 302 0x1000e878 0x79e770 0x79e710
54 : DocumentEnd 	8 1 2318 0x6842b4
5c : AddText 		12 2 2001 0x683e51 0x79e6b0
68 : SaveAs 		12 2 305 0x1000e890 0x79e610
74 : Close 		8 1 303 0x1000e86c
7c : Open 		12 2 300 0x1000e890 0x79e5c0
88 : !end
Comments:

The first line:

0 : string 		12 2 104 0x79c680 0x79dd10
- 0: offset relative to macro code start.
- string : string affectation.
- 12 : Total length of instruction (bytes).
- 2 : Number of parameters.
- 104 : Instruction internal code.
- 0x79c680: adress of first parameter : in this case, the 'file' variable.
- 0x79dd10: adress of second parameter: here, the string "c:\_wscite\macrotest.txt"

In the line:

24 : while 		8 1 112 0x79e7f0
The parameter is the tested expression : lcase(scite_filename)!=lcase(file). And in next line :

2c : !jmp 		8 1 120 0x44
The parameter is the offset of the Jump when the test is false.

Dumped variables:
(no name) : 0x79e5c0 :
    expr="file1"
    RPN=svar
    str=""
(no name) : 0x79e610 :
    expr="file1"
    RPN=svar
    str=""
(no name) : 0x79e6b0 :
    expr=""Done ...""
    str="Done ..."
(no name) : 0x79e710 :
    expr=""That""
    str="That"
(no name) : 0x79e770 :
    expr=""This""
    str="This"
(no name) : 0x79e7f0 :
    expr="lcase(scite_filename)!=lcase(file)"
    RPN=scite_filename lcase svar lcase !=
    int=0
(no name) : 0x79e840 :
    expr="file"
    RPN=svar
    str=""
(no name) : 0x79e910 :
    expr=""c:\\_wscite\\macrotest1.txt""
    str="c:\_wscite\macrotest1.txt"
file1 : 0x79e950 :
    str=""
(no name) : 0x79dd10 :
    expr=""c:\\_wscite\\macrotest.txt""
    str="c:\_wscite\macrotest.txt"
file : 0x79c680 :
    str=""
Comments:

(no name) variables are expressions.
They may be:
- Constant: they are evaluated once at compilation time.

(no name) : 0x79e770 :
    expr=""This""
    str="This"
- Non constant: They are translated in Reverse Polish Notation (RPN) and evaluated at run time.
(no name) : 0x79e7f0 :
    expr="lcase(scite_filename)!=lcase(file)"
    RPN=scite_filename lcase svar lcase !=
    int=0


internal_logging

Logging CopyData messages :

If you add to the [work] section of Filerx.ini logging=1 and optionally : logpath=some_file_path , WM_COPYDATA messages will be logged.
Caution : the file can become very large !

Example of short session:

Filerx is launched first. The "Toggle Test mode" button is clicked to launch SciTE.

Log file line | Comment
<< identity:908 | SciTE identifies. His WindowID is 908
>> macroenable:1 | Filerx tells SciTE that macros are available.
<< opened:C:\\_wscite\\Filerx\\ | This was the path given by Filerx to SciTE.
>> currentmacro:open_close | From Filerx, the user runs "open_close" macro. Filerx tells SciTE that this macro is the current one.
>> open:c:\\_wscite\\macrotest.txt | Open(file) is sent to SciTE.
<< opened:c:\\_wscite\\macrotest.txt | SciTE has opened the requested file.
>> askfilename: | To check if the file is entirely loaded and displayed in SciTE...
<< filename:c:\\_wscite\\macrotest.txt | OK : SciTE is ready.
>> replaceall:This\0That | ReplaceAll("This", "That")
>> macrocommand:2318;000;; | DocumentEnd
>> macrocommand:2001;0IS;8;Done ... | AddText("Done ...")
>> saveas:c:\\_wscite\\macrotest1.txt | SaveAs(file1)
>> close: | Close
>> macroenable:0 | The user has decided to shut down Filerx. Filerx tells SciTE that macros won't be available.
>> closing: | Last message to SciTE: Filerx is closing.

This is the "open_close" Macro:

Macro void open_close
    string file = "c:\\_wscite\\macrotest.txt";
    string file1 = "c:\\_wscite\\macrotest1.txt";
    Open(file);
    while (lcase(scite_filename)!=lcase(file)) {
    }
    ReplaceAll("This", "That");
    DocumentEnd;
    AddText("Done ...");
    SaveAs(file1);
    Close;


internal_differences

Scintilla calls :

Some Scintilla functions returning an integer use the lParam to return a string too.
The corresponding Macro functions discard the integer and return the string.
When the Scintilla function needs a length parameter in wParam, the Macro function doesn't : the needed length is internally calculated.

GetCurLine is defined in scintilla.iface as :

# Retrieve the text of the line containing the caret.
# Returns the index of the caret on the line.
fun int GetCurLine=2027(int length, stringresult text)
but is implemented as :
# Returns the text of the line containing the caret.
string GetCurLine()
GetLine is defined in scintilla.iface as :
# Retrieve the contents of a line.
# Returns the length of the line.
fun int GetLine=2153(int line, stringresult text)
but is implemented as :
# Returns the contents of a line.
string GetLine(int line)
GetSelText is defined in scintilla.iface as :
# Retrieve the selected text.
# Return the length of the text.
fun int GetSelText=2161(,stringresult text)
but is implemented as :
# Returns the selected text.
string GetSelText()
GetText is defined in scintilla.iface as :
# Retrieve all the text in the document.
# Returns number of characters retrieved.
fun int GetText=2182(int length, stringresult text)
but is implemented as :
# Returns all the text in the document.
string GetText()

Two Scintilla Commands are modified, too, to have a simpler Macro syntax.
The needed length parameter is internally calculated when the command is executed:

AddText is defined in scintilla.iface as :

# Add text to the document.
fun void AddText=2001(int length, string text)
but is implemented as :
void AddText(string text)
AppendText is defined in scintilla.iface as :
# Append a string to the end of the document without changing the selection.
fun void AppendText=2282(int length, string text)
but is implemented as :
void AppendText(string text)

Scintilla.iface documentation says :
## String arguments may contain NUL ('\0') characters where the calls provide a length
## argument and retrieve NUL characters. All retrieved strings except for those retrieved
## by GetLine also have a NUL appended but client code should calculate the size that
## will be returned rather than relying upon the NUL whenever possible. Allow for the
## extra NUL character when allocating buffers.
If a returned string contains '\0' characters, as Macro string variables are '\0' terminated strings, all characters following the first '\0' will be lost.


MiniFilx

MiniFilx.exe is a light version of Filerx.
Its window has the appearance of Filerx Macro Bar.
If you have a set of useful, safe Macros, Macro Bars and shortcuts, then use MiniFilx when you don't need extra functionalities of Filerx.

Minifilx installation :

MiniFilx.exe must be in the same directory as Filerx. It uses Filerx.ini and other xxxxxxx.ini files describing the Macro Bars.

Running MiniFilx :

- Launched directly, it also automatically launches SciTE.
- It may be launched from SciTE, too with these lines in SciTEglobal.properties :
command.name.1.*=Mini Filerx
command.1.*="C:\_wscite\filerx\minifilx.exe" "" "id:$(WindowID)"
command.subsystem.1.*=2

Running Macros with MiniFilx :

Macros can be executed :
- by clicking on a Macro button
- by typing its associated Shortcut Key
- through SciTE Menu : Tools/List Macros ...(Shift+F9)

Recording Macros with MiniFilx :

Macros can be recorded from SciTE : Menu Tools/Record Macro (Ctrl+F9).
When a Macro has been recorded, a new button appears in the Bar.
When MiniFilx closes, recorded Macros are automatically saved in a Recorded_nnn.macros file. They can later be reused or reedited by Filerx.

Filerx related Macro instructions :

getimiscinfo(infonum) return meaningful values if infonum is 1, 2 or 19.
getsmiscinfo() and scriptxxxxxx instructions or functions work as with Filerx.
All other Filerx related functions (getrootitem ...) return 0 or an empty string
Filerx related Macro instructions ( showtree , status ...) do nothing.

A macro can test if it is run from Filerx or MiniFilx with :
if (getimiscinfo(19)==1) {
// MiniFilx
} else {
//Filerx
}


howto_run

Run Filerx :

- Filerx may be run as a normal Windows stand-alone program : Explorer, shortcut, desktop icon ...

- If you add these lines to SciTEGlobal.properties :

command.name.0.*=Project Editor
command.0.*="C:\_wscite\filerx\filerx.exe" "C:\_wscite\Work"  "id:$(WindowID)"
command.subsystem.0.*=2

The "Project Editor" line, in SciTE Tools Menu will launch Filerx, showing "C:\_wscite\Work" directory tree.

Run SciTE from Filerx :

To launch SciTE from Filerx, you may :

- Click the left button (Toggle Test Mode) : SciTE will open a new file.

- Right click on a Tree/List item and choose "Edit with SciTE" in the menu.

Run any program from Filerx :

To launch some other program from Filerx, you may :

- Right click on a Tree/List item and choose "Windows Open" in the menu.

- Write a macro containing a "shellexecute" or "shellexecutewait" instruction and run it.

- Customize a menu and link it to a macro containing a "shellexecute" or "shellexecutewait" instruction.


howto_macros

Run a macro at startup :

To run a macro automatically when Filerx is launched :

Create a macro whose name is "_auto_run_", and make sure the file containing this macro is loaded at startup.

Run a macro from Filerx :

To run a macro from Filerx, you may :

- When editing a macro, hit <F9> key.

- Right click on a macro in the Macros Tree item and choose "Play Macro" or "Test Macro" in the menu.

- Click on the blue triangle button : the current macro (last compiled / executed / recorded) will execute in the current mode.

- Customize a menu and link it to a macro.

- Type a keyboard shortcut associated with a macro.

- Click on a Macro Bar button.

If you are in Test mode, the output will go to the internal Output or TypeLib editor, if not, it will go to SciTE.

Run a macro from SciTE :

To run a macro from SciTE :

1) In the Tools Menu, select "Run Current Macro".

2) In the Tools Menu, select "List Macros...", and select a macro to execute in the list.

These Menu items will only appear if an instance of Filerx is connected to SciTE

3) Write following lines in a property file:

command.name.1.*=GetInfos
command.1.*="C:\_wscite\filerx\filerx.exe" "macro:run:getinfos" "id:$(WindowID)"
command.subsystem.1.*=2

The line "GetInfos" will appear in the Tools Menu. When invoked, this menu item will run the macro "getinfos".

Using the same syntax, command.help, command.go, command.build and command.compile may be written to execute macros.

CAUTION : if Filerx isn't running when the command is invoked, Filerx will start without running the macro. And, the commands will remain inactive until Filerx is closed.

So : first start SciTE and Filerx, then use the commands.

4) Type the macro name prefixed by '$' in SciTE's output pane : $getinfos<enter>

Filerx must have been launched before trying to execute a macro from the output pane.

5) Use the keyboard shortcuts or the Macro Bar.

Change Macro output mode :

Macro output may be directed to SciTE, if present, or to Filerx internal Scintilla Editor (Output or TypeLib tab) :

- Right click on a macro in the macro Tree, and select "Play Macro" or "Test Macro".

- Click on the leftmost button "Toggle test mode"

Stop a macro execution :

To stop a macro:

Hit <Ctrl>-<Maj> keys

Compile a macro :

Macro compilation is not explicitly asked, but a macro is automatically compiled when :

- It is loaded from a .macros file.

- In the macro editor, you switch from a modified macro to another one.

- You switch from the "Source" tab to "Files", "Output" or "TypeLib" tab.

- You execute a modified macro.

Edit macros :

Macros may be written with Filerx itself, or with any text editor :

With Filerx :

- any new/modified macro will be available once compiled.

- tooltips are shown for Scintilla functions.

<F11> shows a list of keywords.

With another editor :

- you may have more editing commands ....

- make sure you save your file as a simple text file.

Mixing methods:

- edit your macro(s) in your favourite editor.

- copy the macro(s) to the clipboard.

- paste into Filerx Source Editor.

- force macro(s) to compile (see Compile a macro).

Rename a macro :

To change a macro's name :

- edit the name in the tree.

- show the macro in the Source Editor, change its name, and force its compilation : a macro with the same code as the original one, but with the new name, will be created; the original macro isn't destroyed.

Load macros at startup :

To make Filerx load macros at startup :

- add a line to Filerx.ini [macros] section :

[macros]
...
=C:\mymacros\mymacrofile.macros

- or, easier, right click on a macro file item, in the Macros Tree, and select "Load at startup".

Save Macros :

A .macros file may be saved :

- manually : Right click a macro file in the macro Tree, and select "Save Macro File"

- automatically : when closing Filerx if checkdirtymacros is set to 1 in the [work] section of Filerx.ini.

Customize menus with macros :

To add customized menu items to Filerx, follow these steps :

- write a void macro accepting a string parameter :

Macro void my_new_command(string my_parameter)
    message(my_parameter,"Execute my command")

- add a line to one of the filerx.ini sections : [filelistmenu], [filetreemenu], [projectmenu], [tlbmenu] :

 Execute my new Command=my_new_command
When the corresponding menu appears, a new item "Execute my new Command" will be there, and if selected, the macro "my_new_command" will execute.

Save the .macros file containing your macro, if you want to use it tomorrow, too.

Debug macros :

To debug a Macro, right-click on a macro in the Tree, and select "Debug Macro" .

Then , with the keyboard :

- "S" : steps over current line
- "G" : Go ...
- "B" : Toggle breakpoint.
- "O" : Show Output.
- "H" : Halt debug mode.
- Up/Down/Left/Right : Move Cursor
- Tab : Find next variable in text.

Or with the mouse :

- Click on a variable to see its value.
- Select any valid expression to display its value.
- Double-click on a line to toggle a breakpoint.

Ten breakpoints may be set in each macro.

Define macro shortcuts :

To define a Shortcut :
- Click on a macro in the Macro Tree to select it
- Click the top left Shortcut button.
- Type any key combination in the Dialog
- Validate.
The key combination is now associated with the selected macro.

These shortcuts are system-wide defined : typing them will execute the associated macro from any application.

If you need a lot of shortcuts, there is another possibility :
Add a _global_shortcut_=virtual_key_code , modifiers key to Filerx.ini, in the [shortcuts] section.
- you may edit Filerx.ini with any text editor
- you may edit the Property Tree [shortcuts] section of Filerx.ini.
Then only this shortcut will be system-wide defined, and you'll have entire freedom to define the macro shortcuts as described above.

Run macros with shortcuts :

If _global_shortcut_ is defined :
- Type this global shortcut, first
- Then type the macro shortcut in the Dialog Box.

If _global_shortcut_ is not defined :
You may directly type the macro shortcut.

Remove macro shortcuts :

The [shortcuts] section of Filerx.ini may need to be cleaned to remove shortcuts associated with non-existing macros, or empty shortcuts (macro_name=0 , 0 ).

Edit the Property Tree item within Filerx, or edit Filerx.ini with a text editor.

Use JScript/VBScript in macros :

Microsoft Script Control (msscript.ocx) must be properly installed and registered on your system, if you want to use the script commands.

If not, script files (.js , .vbs) can be run through shellexecute().

1) Prepare a script:

- From a file :

    Open("myscriptfile.vbs")
    string s=GetText
    Close
- From scratch in a new text :
    Open("")
    AddText("script statements ...")
    AddText("more script statements ...")
    string s=GetText
    Close
- From scratch in a variable
     string s="script statements ..."
    s=s & "more script statements ..."
- Included between SCRIPTSTART and SCRIPTEND directives :
    SCRIPTSTART s
        script statements ...
    SCRIPTEND

2) Initialize script engine :

    macroinit("VBScript")

3) Compile script :

    scriptaddcode(s)

4) Use the script :

-Call a Sub :

    scriptexecute("the_sub_name")

-Call a Function :

    string result=scripteval("the_func_name(arg1,arg2,...)")

- Execute other statements :

    scriptexecute("statement:statement ...")

- Evaluate any expression :

    string result=scripteval("3*cos(2,5)-0.1452")

5)Close script engine:

    scriptexit


howto_projects

Create a project :

To create a new project, you may :

- right click on the project Tree, and select "Create new project".

- Edit a text file with the project syntax, and save it with the .project extension.

- right click on a .dsp file, in the file List, and select "Import .dsp"

Save a project :

A .project file may be saved :

- manually : Right click a project file in the project Tree, and select "Save Project"

- automatically : when closing Filerx if checkdirtyprojects is set to 1 in the [work] section of Filerx.ini.

Add files to a project :

To add files to a project, you may :

- right click a file in the file List, and select "Add File To Selected Project"

- drag files from the file List to the project Tree.

- drag files/folders from another project in the project Tree

Load projects at startup :

To make Filerx load projects at startup :

- add a line to Filerx.ini [projects] section :

[projects]
...
=C:\myfolder\myfile.project

- or, easier, right click on a project file item, in the Projects Tree, and select "Load at startup".

Projects and Lua scripts :

To manage Lua scripts:

- In the Files Tree, select a folder where you have your Lua scripts.

- In the Projects Tree, create a new project file.

- drag Lua script files (".lua" extension) from the file List to the project Tree.

When a Lua script file is double-clicked in the tree, it is opened in the Lua editor.

It then can be modified, saved, executed using the contextual menu or F9 and F5 keys.


howto_properties

Modify Filerx.ini :

Filerx.ini may be modified from Filerx; in the Properties Tree :

- edit an item to change it.

- edit the <new> item in each section to add a new item.

- edit an item and set it to an empty string to remove it.

Modify SciTE properties :

SciTE properties may be modified from Filerx; in the Properties Tree :

edit an item : the new "name=value" will be sent to SciTE.

The change may have immediate, later or no effect, depending on the way SciTE uses the property.

Filerx doesn't write to .properties files.


howto_typelibs

Modify Favorites :

To add/remove a Type Library to/from "Favorites":

- double click on a TypeLib in the "Registry" : it will jump to the "Favorites"

- double click on a TypeLib in the "Favorites" : it will disappear, and be back in the "Registry"

- you may edit the [tlbfavorites] section of Filerx.ini, too ... But to appear in the Favorites, the Type Library must have the exact name it has in the registry, followed by a version number (not easy)...

Customize double-click on a property :

When a property/method is double-clicked in the Tree, Filerx inserts the property/method name, and shows a tooltip.

To change the default behaviour, you must write a macro :

Macro void OnInsertFunction( string ftext )
    int i = 0;
    while (ftext[i]!='(' && i<strlen(ftext)) {
        i++;
    }
    if (i>=strlen(ftext)) {
        AddText(ftext);
    } else {
        string fname = left(ftext,i+1);
        AddText(fname);
        CallTipShow(GetCurrentPos, ftext);
    }

Customize double-click on a CLSID :

To change Filerx default behaviour when a CLSID is double clicked ( a coclass sub-sub item), you have to write a macro :

Macro void OnInsertHTMLObject( string clsid )
    string clsid2 = mid(clsid,1,strlen(clsid)-2);
    AddText("\n<OBJECT\n");
    AddText("\tCLASSID=\"clsid:" & clsid2 & "\" ID=\"\">\n");
    AddText("\t<PARAM NAME=\"\" VALUE=\"\">\n");
    AddText("</OBJECT>\n");

Customize double-click on an object :

To change Filerx default behaviour when an object is double clicked ( a coclass sub-sub item), you have to write a macro :

Macro void OnInsertScriptObject( string object )
    int lex = GetLexer;
    if (lex==SCLEX_VB) {
        AddText("CreateObject(\"" & object & "\")\n");
    } else {
        message("This is not VBScript ...\nModify the macro", "InsertScriptObject");
    }

Create .api files :

To create an .api file, follow these steps :

- Select an item in a "Dispinterface" folder.

- Expand it once, to force sub-items creation.

- double click on the item

The properties/Methods will be listed in the TypeLib Editor : you may copy the text to an external editor to save it.

A macro can be created, too, and associated with a new contextual menu item, to customize the output.


howto_lua

Create a new Lua script :

- Select the "Lua" tab in the right/bottom pane.

- Enter your text.

- Right click in editor window and select "Save Lua Script as ..."

Edit existing Lua scripts :

- Create a new project file.

- Add lua scripts to the project (suffix ".lua").

- double-click on the file name in the project tree.

Run Lua scripts :

1- From Filerx Lua editor.

- Open an existing Lua script.

- Right click in editor window and select "Run Lua Script" or hit F9.

If the script has been modified, save it to be sure to run the modified script.

2- From a macro:

- Use LoadScript("scriptpath").

- Use Extender("command") where command will be understood by LuaExtension.

3- From Project tree or File list :

- Add an item to the contextual menu, attached to a Macro executing a "LoadScript"

Run Lua commands :

From Filerx Lua editor.

- Open an existing Lua script or type any valid Lua script text.

- Select some text.

- Right click in editor window and select "Execute selection" or hit F5.

Save Lua scripts :

- Open an existing Lua script or create a new one.

- Right click in editor window and select "Save Lua Script as ..."