You are here: Surpac Concepts > Macros > SCL > Superseded Commands > SclTranslate
GEOVIA Surpac

SclTranslate

Overview

This function has been superseded by SclLogical translate .It will continue to be supported but you are advised to use SclLogical translate.

Translate a Surpac logical pathname to its physical equivalent.

Synopsis

SclTranslate $logical_pathname $optional_slash_character

Description

Returns the physical pathname represented by the value of $logical_pathname. This function can also be used to convert all slashes in a string to either forward slashes or back slashes as required.

Note: It is not necessary to use SclTranslate on arguments to the TCL file, open or source commands. Logical pathnames in arguments sent to these commands will be translated automatically.

Arguments

  • Logical Pathname
  • Passed by value. The logical pathname to be expanded.

  • Optional Slash Character
  • Passed by value. This argument is optional. By default, any slashes in the expanded path will be returned as forward slashes. To insist on back slashes, specify \\ as the second argument. To use exactly what is specified in the logicals file, provide a - as the second argument.

    Generally no value is required for this argument, but if you were creating a batch file or writing a path to a file to be read by another program, then backslashes may be necessary.

Examples

# display the physical pathname represented by SSI_ETC:
puts "Full path to SSI_ETC: [SclTranslate SSI_ETC:]"
# tell user the name of the file being written to.
puts "Writing to a file SSI_BIN:test.txt ([SclTranslate SSI_BIN:]test.txt)"
# open the file for writing
set a [open SSI_BIN:test.txt w]
  # write the full pathname of the SSI_BIN directory with forward slashes
  puts $a [SclTranslate SSI_BIN:]
  # write the full pathname of the SSI_BIN directory with back slashes
  puts $a [SclTranslate SSI_BIN: \\]
  # write the full pathname of the SSI_BIN directory using the slash type specified in the logicals file
  puts $a [SclTranslate SSI_BIN: -]
close $a
# create a batch file that lists the newly created file
set a [open SSI_BIN:showtest.bat w]
  # write the full pathname of the SSI_BIN directory with back slashes
  puts $a "dir [SclTranslate SSI_BIN: \\]"
close $a