Open Binary File for Reading
Verb: openBinaryReader
Available from: <Standard>
Opens a binary file for reading using the path, the share permission, and the encoding that can change the file later.
The command interprets all file types (.txt, .html, .pdf, ...) as binary.
Syntax
openBinaryReader --share(AutomationFileShare) --path(String) --encoding(EncodingType) (BinaryFileReader)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--share | Share Mode | Required | AutomationFileShare | Option that allows you to perform actions within the file while it is open for reading:
|
--path | Path | Required | Text | Full path of the binary file to be used for reading. |
--encoding | Encoding | Required | EncodingType | Character encoding used when reading binary file:
|
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Binary Reader | Binary File Reader | Binary file opened for reading. |
Example
The Open Binary File for Reading command is used to open a binary file with read and write permissions and the Get Binary File Text command reads and returns the contents of the file.
defVar --name binaryReader --type BinaryFileReader
defVar --name textValue --type String
// Open the file informed for reading.
// Download the following file to run the command.
openBinaryReader --share "Read" --path "binaryFile.txt" --encoding "Default" binaryReader=value
// Get the text contained in the file.
binaryReadString --file ${binaryReader} textValue=value
// Close the binary file.
binaryFileClose --file ${binaryReader}
For the correct operation of the script above, it is necessary to download the file and enter its path in the Path parameter of the Open Binary File for Reading command.