Using Find and Replace from a Command Line
Canvas supports a command-line interface to find and replace strings in Canvas files stored in either a CygNet APPS or BSS folder or a local folder. Be aware that there is no undo for find and replace. Make a backup of your files before editing. See other important notes here.
To find and replace a string in a Canvas file
- Open a Command Prompt window.
- Navigate to the directory where the Canvas application is installed, typically CygNet\Bin.
- Type the command using the syntax described below.
Usage
Canvas -Find=[FindString] -Replace=[ReplacementString] -Files=[File1;File2;File3] -Source=[BSS|Local] -Options=[Controls;Metadata;Screen;Script]
Note: Command-line commands are not case sensitive.
Parameters
All parameters require additional data; follow each parameter with "=additional data"; see usage and examples.
| Parameter | Required | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
-Find |
Yes |
Specify the string you want to find. Wrap multiple words in quotation marks. Example
|
|||||||||
|
-Replace |
Yes |
Specify the replacement string. Wrap multiple words in quotation marks. Example
|
|||||||||
|
-Files |
Yes |
Specify the full path and file name of any file(s) you want to edit in a semi-colon separated list wrapped in quotation marks. Do not use -Path to specify the path to a file. The presence of both -Path and -Files invalidates the command line. Example
|
|||||||||
|
-Source |
Yes |
Specify the source type for the file you want to edit. Options include:
Examples
|
|||||||||
|
-Options |
Yes |
Specify where in the file you want to make the substitution. These options can be combined in any order; they can be separated with any separator (a semi-colon (;) or a pipe (|)) or no separator at all. Options include:
Examples
|
|||||||||
|
-Help |
No |
Displays a dialog box showing command-line usage. "help", "\help", "/help", and "?" are also valid. The Command Line Usage dialog box will be displayed when any invalid options are typed at the command line. Examples
|
Command-Line Usage
You can get user assistance for the relevant command-line options for Find and Replace.
|
Type |
Examples
|
C:\CygNet\Bin>Canvas -Find=YYYYY -Replace=ZZZZZ -Files=C:\Canvas_Screens\MyScreen.can -Source=Local -Options=Controls;Screen;Script |
|
C:\CygNet\Bin>Canvas -Find=YYYYY -Replace=ZZZZZ -Files=CYGDEMO.BSS\Canvas_Screens\MyScreen.can -Source=BSS -Options=Script Controls Screen |
|
C:\CygNet\Bin>Canvas -Find=YYYYY -Replace=ZZZZZ -Files=C:\Canvas_Screens\MyScreen.can -Source=Local -Options=Metadata|Script |
|
C:\CygNet\Bin>Canvas -Help |
Note: You cannot combine the Find/Replace parameters and other Canvas command-line parameters in the same command line. But you could do a find and replace and then open the file on the next command line.
