Manfred_F
10 years agoRegular Contributor
file object, properties & methods
Hi, for the file object in the files collection, there is only a check method, no properties are defined. I wonder why. I'd like to Access a file's path, text (for Textfiles) and attributes t...
- 10 years agoHi Manfred, you are correct in that there is only a check() method available for a referenced file.
In order to acheive what you require, you will need to utilise methods of the Files and aqFile objects as shown:
function accessFiles() {
// We have a referenced file in Files cjr_ini.
// Test Complete only gives us Files.cjr_ini.Check();
// Use methods on Files and aqFile to get the information wanted, e.g.
// Get file path
var filePath = Files.FileNameByName( "cjr_ini" );
// Get file content
var fileContent = aqFile.ReadWholeTextFile( filePath, aqFile.ctANSI );
// Get file attributes
var fileAttributes = aqFile.GetFileAttributes( filePath );
Log.Message( filePath );
Log.Message( fileContent );
Log.Message( fileAttributes );
}
Regards,
Phil Baird