Object states - Macros

Far Manager

Object states

Panels
OperatorTypeDescription
APanel.ItemCount PPanel.ItemCount Number stores the number of the elements on the panel
APanel.SelCount
PPanel.SelCount
Number stores the number of the selected files on the panel
APanel.CurPos
PPanel.CurPos
Number stores the index of an element on the panel
APanel.Current
PPanel.Current
String stores the name of an element under the cursor
APanel.Path
PPanel.Path
String stores the path for the panel (without trailing '\')
APanel.UNCPath
PPanel.UNCPath
String stores the UNC path for the panel (without trailing '\')
APanel.Width
PPanel.Width
Number stores the width of the panel
APanel.Type
PPanel.Type
Number stores the type of the panel:
Value Description
0 File panel
1 Tree panel
2 Quick view panel
3 Informational panel
APanel.DriveType
PPanel.DriveType
Number specifies the drive type of the panel:
Value Description
-1 plugin panel
0 Drive type couldn't be detected
2 Removable drive
3 Hard disk
4 Mapped network share
5 CDROM
6 Virtual drive
15 SUBST-disk
APanel.OPIFlags
PPanel.OPIFlags
Number plugin panel flags, can be a combination of the following values (if the panel is not a plugin panel then this value is 0):
ValueDescription
0x00000001 there's a filter applied to the panel
0x00000002 there're a sort groups used on the panel
0x00000004 the highlighting is used on the panel
0x00000010 folder selection mode does not depend on the FAR Manager settings
0x00000020 the standard FAR file processing mode is used, if the requested operation is not supported by the plugin; if this flag is set then panel element names are the real file names
0x00000040 file names without paths are shown
0x00000080 file names are aligned to the right
0x00000100 the original case is used to display the file names (despite of FAR Manager settings)
APanel.ColumnCount
PPanel.ColumnCount
Number Number of panel columns.
Dialogs
Dlg.ItemCount Number number of elements in a dialog box
Dlg.CurPos Number the number of the item of a dialog box currently in focus
Dlg.ItemType Number type of the element currently in focus
Value Description
-1error, for example Dlg.ItemType was called outside of the dialog
4Text input box
5Password input box
6Fixed width input box
7Push Button
8Check Box
9Radio Button
10Combo box
11List box
255Custom control
0x8004Text input box history
0x800ACombo box list
Command Line
CmdLine.ItemCount Number number of characters in the command line
CmdLine.CurPos Number current command line cursor position
CmdLine.Value String command line content
Editor
Editor.FileName String full name of the file being edited
Editor.CurLine Number current line in the editor (first line is 1)
Editor.CurPos Number current cursor position in the current line in the editor (first column is 1); tab size is accounted
Editor.RealPos Number current cursor position in the current line in the editor (first column is 1); without accounting for tab size
Editor.Value Value contents of the current line in the editor (under the cursor).
For example, to show the character under the cursor:
MsgBox(substr(Editor.Value,Editor.CurPos-1,1),Editor.FileName,0)
Editor.Lines Number number of lines in the editor
Editor.State Number state of the current internal file editor - bit flag set:
Value Description
0x00000001 file is new or already deleted
0x00000002 can be switched to the viewer by F6
0x00000004 remove the file after closing the editor
0x00000008 file was modified in the editor (there is a '*' sign in the editor status line)
0x00000010 there is a stream selection box (alternative is Editor.Sel(0,4))
0x00000020 there is a vertical selection block (alternative is Editor.Sel(0,4))
0x00000040 file was modified during the whole editing session
0x00000080 the cursor is in replace mode
0x00000100 cursor position was modified by the plugin
0x00000200 the editor is locked (ReadOnly)
0x00000400 permanent blocks are used
0x00000800 modal editor
0x08000000 FAR is started with /e
Example:
$If (Editor.State & 0x8) ...do something if file was modified... $End
Viewer
Viewer.FileName String full name of the file being viewed
Viewer.State Number state of the current internal file viewer - bit flag set:
Value Description
0x00000001 codepage autodetection is on
0x00000002 text and codepage are not in ANSI encoding
0x00000004 Unicode mode
0x00000008 line wrapping is on
0x00000010 wrap lines by words instead of by letters
0x00000020 hexadecimal mode is used
0x00000800 modal viewer
0x08000000 FAR is started with /v
Example,
$If (Viewer.State & 0x20) ...do something if hex mode is on... $End
Drive menu
Drv.ShowPos Number drive menu is shown for the left panel (AltF1, value 1) or the right panel (AltF2, value 2).
Drv.ShowMode Number drive menu representation flags; bitmask:
Value Description
0x00000001 disk type displaying is enabled
0x00000002 network name (and the path associated with a SUBST drive under NT) displaying is enabled
0x00000004 disk label displaying is enabled
0x00000008 file system type displaying is enabled
0x00000010 total and free disk size displaying is enabled
0x00000020 removable disk parameters displaying is enabled
0x00000040 plugin items displaying is enabled
0x00000080 CD parameters displaying is enabled
0x00000100 total and free disk size (Windows Explorer style) displaying is enabled
0x00000200 network parameters displaying is enabled
Other
MacroArea String name of the current macro area
ItemCount Number number of elements in the current object; delimiters are also counted in the menu
CurPos Number position in the current object
Title String title of the current object
Far.Width Number FAR Manager console width
Far.Height Number FAR Manager console height
Far.Title String current title of FAR console window
Help.FileName String full path to the opened help file; for the list of plugins help topics (Shift-F2) this value is empty
Help.Topic String ID of the current help topic (without the leading '@' symbol)
Help.SelTopic String ID of the selected help topic (without the leading '@' symbol)
MsX Number Horizontal offset of mouse cursor since the last mouse event was triggered
MsY Number Vertical offset of mouse cursor since the last mouse event was triggered
MsButton Number Indicates the status of the mouse buttons. The least significant bit corresponds to the leftmost mouse button. The next least significant bit corresponds to the rightmost mouse button. The next bit indicates the next-to-leftmost mouse button. The bits then correspond left to right to the mouse buttons. A bit is 1 if the button was pressed.
The following constants are defined for the first five mouse buttons:
Value Description
0x0001 FROM_LEFT_1ST_BUTTON_PRESSED
0x0002 RIGHTMOST_BUTTON_PRESSED
0x0004 FROM_LEFT_2ND_BUTTON_PRESSED
0x0008 FROM_LEFT_3RD_BUTTON_PRESSED
0x0010 FROM_LEFT_4TH_BUTTON_PRESSED
MsCtrlState Number Indicates the state of the control keys. This member can be one or more of the following values.
Value Description
0x0001 RIGHT_ALT_PRESSED
0x0002 LEFT_ALT_PRESSED
0x0004 RIGHT_CTRL_PRESSED
0x0008 LEFT_CTRL_PRESSED
0x0010 SHIFT_PRESSED
0x0020 NUMLOCK_ON
0x0040 SCROLLLOCK_ON
0x0080 CAPSLOCK_ON
0x0100 ENHANCED_KEY

Notes

  1. It is impossible to use macro-language elements while recording a macro in a usual way. Macro-language elements can be added to the sequence only by editing the registry manually or by using special applications or FAR plugins.