The [findBar] command.
The findBar command lets you interact with the Find Bar available
for each pane of a document window.
The document window can be specified by the -w option. If
this option is not present, the command applies to the currently active
When the document window is split into several panes, all the
subcommands apply to the current pane.
The formal syntax of the [findBar] command is:
findBar subcommand ?options?
The possible subcommands are described below. Depending on the
subcommand, some options may be specified.
The [hide] subcommand
This subcommand hides the Find Bar. The complete syntax is:
findBar hide ?-w win?
The [configure] subcommand
This subcommand lets you get or set the values of some parameters. The
complete syntax can take two forms:
findBar configure option
findBar configure option ?value? ?option value...?
The first form returns the value of an option. The second form lets you
modify the value of one or several options. This command does not implement
the -w option because it affects the Find Bar globally: by design,
all the find bars use the same settings.
The possible options are:
The matching and casing options are displayed in the popup menu represented by a
magnifying glass at the left of the search field.
- the -match option is an integer value indicating the type of search
anchor an action should use to find a match. The value is an integer
between 0 and 2 with the following meaning:
- the -nocase option is a boolean value indicating if the search
should be case insensitive or not.
- the value of the -replaceString option corresponds to the string in the replace field.
- the value of the -searchString option corresponds to the string in the search field.
Note: the system uses a dedicated pasteboard (known as the Find
pasteboard) to hold information about the current state of the Find Bar and
in particular the search string. In order to manipulate programmatically the
search string, you could also use the [pasteboard read]
and [pasteboard write] commands with a
-name find option.
The [perform] subcommand
This subcommand lets some actions be performed. The
complete syntax is:
findBar perform ?-w win? action
The action argument is an integer representing the action to
perform. The possible values are:
The Set Search String action mentionned in the previous table
installs in the search field the string that is currently selected in the
text. In order to install another search string programmatically, use the
[findBar configure] command.
|Show Find Interface||1|
|Replace and Find||6|
|Set Search String||7|
|Replace All In Selection||8|
|Select All Matches||9|
|Select All in Selection||10|
|Hide Find Interface||11|
|Show Replace Interface||12|
|Hide Replace Interface||13|
The [show] subcommand
This subcommand displays the Find Bar. The complete syntax is:
findBar show ?-w win?
The [visible] subcommand
This subcommand tells whether the Find Bar is visible in the current pane
of the specified window. The complete syntax is:
findBar visible ?-w win?
If the -w option is not specified and if there is no opened document
window, the command just returns 0.
Here are some examples of use of the findBar command:
«» findBar show
«» findBar visible
«» findBar configure -searchString foobar -nocase 1
«» findBar configure -searchString
«» findBar perform 2 ; # Find next match
«» findBar perform 3 ; # Find previous match
«» selection set 0 5 ; # Select the text between positions 0:5
«» findBar perform 7 ; # Install the selection in the find bar
«» findBar perform 12 ; # Display the Replace field
«» findBar hide
Last updated 2016-12-09 15:30:38