Get Binary File Characters
Verb: binaryReadLength
Available from: <Standard>
This command is used for getting a set amount characters from a binary file.
The command considers all file types as binary (.txt, .html, .pdf, etc)
Syntax
binaryReadLength --length(Numeric) --file(BinaryFileReader) (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--length | Amount of characters | Required | Number | Amount of characters that should be obtained from the binary file, starting from the very beginning of the file. |
--file | Binary reader | Required | Binary File Reader | Binary file, opened by the Open Binary File for Reading command, from which the characters should be obtained. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Text | Text | Characters obtained according to the length defined in the Amount of characters parameter. |
Example
The Get Binary File Characters command gets the characters in binary from a text file.
defVar --name readerBinary --type BinaryFileReader
defVar --name valueBinary --type String
//Open the file informed for reading.
//Download the following file to run the command.
openBinaryReader --share "Read" --path "binaryFile.txt" --encoding "Default" readerBinary=value
// Returns the first 20 characters of the file.
binaryReadLength --length 20 --file ${readerBinary} valueBinary=value
logMessage --message "${valueBinary}" --type "Info"
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 to Read" command.
Remarks
For the Get Binary File Characters command to work correctly, there must be a file that contains a value in binary.
The Binary reader parameter uses the variable that is generated by the Open Binary File for Reading command, which holds the file with the binary value.