Using Find and Replace from a Command Line

Canvas supports a command-line interface (CLI) to find and replace strings in Canvas files stored in either a CygNet APPS or BSS folder or a local folder. Domain ID support is also available to edit files in a BSS in a different domain. Be aware that there is no undo for find and replace. Make a backup of your files before editing. See other important notes here.

Note: You cannot combine the Find and Replace CLI parameters and the other Canvas CLI parameters in the same command line. But you could do a find and replace and then open the file on the next command line. See the CLI topics for more information:

To find and replace a string in a Canvas file

  1. Open a Command Prompt window.
  2. Navigate to the directory where the Canvas application is installed, typically CygNet\Bin.
  3. Type the command using the syntax described below.

Usage

Canvas -Find=[FindString] -Replace=[ReplacementString] -Files=[File1;File2;File3] -Source=[BSS|Local] -Domain=[DomainId] -Options=[Controls;Metadata;Screen;Script]

 

Note: CLI parameters 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

-Find="find this string"

-Replace

Yes

Specify the replacement string. Wrap multiple words in quotation marks.

Example

-Replace="replace with this string"

-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

-Files=C:\temp\MyScreen1.can;C:\temp\MyScreen2.can;C:\temp\MyScreen3.can

-Files=CYGDEMO.BSS\Canvas_Screens\MyScreen1.can;CYGDEMO.BSS\Canvas_Screens\MyScreen2.can

-Source

Yes

Specify the source type for the file you want to edit. Options include:

  • BSS — Indicates that the file is stored in a CygNet APPS or BSS folder
  • Local — Indicates that the file is stored in a local or network Windows file-system folder

Examples

-Source=BSS

-Source=Local

-Domain

No

Specify a CygNet domain ID to override the ambient domain for the specified BSS to edit files on a different domain.

The -Domain parameter is optional, and if not specified, the ambient domain is used for the specified BSS.

Example

-Domain=5488

-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:

  • Controls — Find and replace any string found in a Canvas control property
  • Metadata — Find and replace any string found in a screen's Metadata
  • Screen — Find and replace any string found in a screen (or object) property
  • Script — Find and replace any string found in a screen's script

Examples

-Options=Controls;MetaData;Screen;Script

-Options=Controls|Screen|Script

-Options=Controls Screen Script

-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

canvas help

canvas.view help

canvas.view.lite help

canvas ?

canvas.view ?

canvas.view.lite ?

canvas /help

canvas.view /help

canvas.view.lite /help

Command-Line Usage

You can get user assistance for the relevant CLI options for Find and Replace.

Command-line help for Canvas

Type "canvas help" at the command-line prompt to see usage tips

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=CYGSITE2.BSS\Screens\MyOtherScreen.can -Source=BSS -Domain=5488 -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