on readBinaryFile filePath
-- Call handler using the full file path
byteList = []
-- This list will contain all of the byte values retrieved
fileObj = new(xtra "fileIO")
fileObj.openFile(filePath, 1)
-- Open the file with read-only access
if fileObj.status() = 0 then
fileLength = fileObj.getLength()
-- Find the length of the file in bytes
repeat with index = 1 to fileLength
byteList.append(charToNum(fileObj.readChar()))
-- Append the value of each byte of the file to byteList
end repeat
end if
fileObj.closeFile()
-- Close the file
fileObj = 0
-- Clear the FileIO instance from memory
return byteList
on readBinaryFile filePath, startByte, endByte
-- Optional parameters for specifying positions in the file
byteList = []
fileObj = new(xtra "fileIO")
fileObj.openFile(filePath, 1)
if fileObj.status() = 0 then
fileLength = fileObj.getLength()
if startByte.voidP then
-- Read entire file if parameters aren't supplied
startByte = 1
endByte = fileLength
end if
if (fileLength >= startByte) and (fileLength >= endByte) then
fileObj.setPosition(startByte-1)
-- Position FileIO to read from the correct point in the file
repeat with index = startByte to endByte
byteList.append(charToNum(fileObj.readChar()))
end repeat
end if
end if
fileObj.closeFile()
fileObj = 0
return byteList
end
repeat with index = 1 to tags.count
memberName = string (tags.getPropAt (index))
newText = clipString (tags[index])
member (memberName).text = newText
end repeat
end if