4D v13.2

IT_Encode

Home

 
4D v13.2
IT_Encode

IT_Encode 


 

IT_Encode ( fileName ; encodedFile ; encodedMode ) -> Function result 
Parameter Type   Description
fileName  Text in A LocalPath to a file
encodedFile  Text in LocalPath file specification
in Path to resulting encoded file
encodedMode  Integer in 1 = BinHex 2 = Base64 (Data fork only) 3 = AppleSingle 4 = AppleDouble 5 = AppleSingle AND Base64 6 = AppleDouble AND Base64 7 = UUEncode 8 = MacBinary
Function result  Integer in Error Code

The IT_Encode command encodes a file using the encodeMode specified. The specified file will not be altered and an encoded copy will be created. The name of the encoded file created will be the original file name plus a suffix appended to specify the encoding method. For Binhex encoding, the suffix ".hqx" will be appended. For Base64 encoding, the suffix ".b64" will be appended. For AppleSingle encoding, the suffix ".as" will be appended.

fileName takes a full pathname specification to a file you want to Encode. If an null string is passed in this parameter the user will be prompted with a dialog to select a file.

encodedFile can be passed:

  • a full LocalPath file specification providing a name and location for the encoded file.
  • a full LocalPath folder specification (without specifying the file name) providing the folder in which the encoded file will be saved; the file name will be the original file name with a suffix defining the encoding mode.
  • a null string (in this case, the IT_Encode command) will provide its own name for the document, placed in the same folder as the file specified in the first parameter.
    Whether specified or not, the final pathname of the encoded document will be returned in this parameter. Due to the potential for possible naming conflicts within the specified directory, you should always rely on the returned value as the true reference to the encoded file, not the original value passed into the command.

encodeMode identifies which encoding method to apply to the file. The default value is 1 for binhex encoding. Other methods are:

CodeScheme
1BinHex
2Base64 (Data fork only)
3AppleSingle
4AppleDouble
5AppleSingle and Base64
6AppleDouble and Base64
7UUEncode
8MacBinary

When encoding using AppleDouble (encodeModes 4 & 6), two files are created named "%filename" and "filename".

 
PROPERTIES 

Product: 4D
Theme: IC Utilities
Number: 88910

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Internet Commands 6.8.1

 
SEE ALSO 

IT_Decode