version 6.8.1 (Modified)
IT_Encode (fileName; encodedFile; encodedMode) Integer
Parameter | Type | Description | |
fileName | Text | A LocalPath to a file | |
encodedFile | Text | LocalPath file specification | |
Path to resulting encoded file | |||
encodedMode | Integer | 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 | Error Code |
Description
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:
Code | Scheme |
1 | BinHex |
2 | Base64 (Data fork only) |
3 | AppleSingle |
4 | AppleDouble |
5 | AppleSingle and Base64 |
6 | AppleDouble and Base64 |
7 | UUEncode |
8 | MacBinary |
When encoding using AppleDouble (encodeModes 4 & 6), two files are created named "%filename" and "filename".
See Also