Articles

[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Expand]Using TestComplete/viewarticle/57875/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Collapse]References/viewarticle/57878/
  [Expand]Test Objects/viewarticle/57881/
  [Collapse]Scripting Objects/viewarticle/57882/
   [Collapse]A
    [Expand]ADO/viewarticle/55372/
    [Expand]ADODriver/viewarticle/58932/
    [Expand]aqBinaryFile/viewarticle/55629/
    [Expand]aqConvert/viewarticle/55352/
    [Expand]aqDateTime/viewarticle/55342/
    [Expand]aqDriveInfo/viewarticle/59323/
    [Expand]aqEnvironment/viewarticle/55346/
    [Expand]aqFile/viewarticle/55351/
    [Expand]aqFileCertificateInfo/viewarticle/59358/
    [Expand]aqFileInfo/viewarticle/55419/
    [Expand]aqFileSystem/viewarticle/55345/
    [Expand]aqFileVersionInfo/viewarticle/59295/
    [Expand]aqFolderInfo/viewarticle/55571/
    [Expand]aqObject/viewarticle/55360/
    [Expand]aqObjEvent/viewarticle/58410/
    [Expand]aqObjField/viewarticle/58420/
    [Expand]aqObjIterator/viewarticle/58407/
    [Expand]aqObjMethod/viewarticle/58416/
    [Expand]aqObjProperty/viewarticle/55781/
    [Expand]aqString/viewarticle/55359/
    [Expand]aqTextFile/viewarticle/56875/
    [Expand]AQtime/viewarticle/55153/
    [Expand]AQtimeIntegration/viewarticle/55042/
    [Expand]aqUtils/viewarticle/55373/
   [Expand]B
   [Expand]C
   [Expand]E
   [Expand]D
   [Expand]F
   [Expand]H
   [Expand]I
   [Expand]O
   [Expand]P
   [Expand]R
   [Expand]S
   [Expand]T
   [Expand]U
   [Expand]W
   [Expand]V
   [Expand]Obsolete Objects
  [Expand]Project and Project Item Objects/viewarticle/57880/
  [Expand]TestComplete Events/viewarticle/56945/
  [Expand]Language Reference/viewarticle/57879/
  [Expand]User Form Components/viewarticle/56689/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 9/23/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Programming Reference

aqFile Object

Description

The aqFile object allows you to manage files as well as read from and write to text and binary files. This object complements the aqFileSystem object, but unlike the latter it lets you deal with files only.

Members

Example

The example below demonstrates how you can create a file and write text to it using the aqFile object.

VBScript

Sub CreatingAndWritingToTextFile

 If (aqFile.Create("C:\MyFiles\DemoFile.txt") = 0) Then
  Call aqFile.WriteToTextFile("C:\MyFiles\DemoFile.txt", "Hello!", aqFile.ctUTF8)
  Call Log.Message("The file is created and the specified text is written to it successfully.")
 else 
  Call Log.Error("The file was not created.")
 End If
 
End Sub

JScript

function CreatingAndWritingToTextFile()
{
 if (aqFile.Create("C:\\MyFiles\\DemoFile.txt") == 0)
 {
  aqFile.WriteToTextFile("C:\\MyFiles\\DemoFile.txt", "Hello!", aqFile.ctUTF8);
  Log.Message("The file is created and the specified text is written to it successfully.");
 }
 else 
 {
  Log.Error("The file was not created.");
 }
}

DelphiScript

function CreatingAndWritingToTextFile;
begin
 if (aqFile.Create('C:\\MyFiles\\DemoFile.txt') = 0) then
 begin
  aqFile.WriteToTextFile('C:\\MyFiles\\DemoFile.txt', 'Hello!', aqFile.ctUTF8);
  Log.Message('The file is created and the specified text is written to it successfully.');
 end
  else 
 begin
  Log.Error('The file was not created.');
 end;
end;

C++Script, C#Script

function CreatingAndWritingToTextFile()
{
 if (aqFile["Create"]("C:\\MyFiles\\DemoFile.txt") == 0)
 {
  aqFile["WriteToTextFile"]("C:\\MyFiles\\DemoFile.txt", "Hello!", aqFile.ctUTF8);
  Log["Message"]("The file is created and the specified text is written to it successfully.");
 }
 else 
 {
  Log["Error"]("The file was not created.");
 }
}

See also
Working With Files From Scripts | TestComplete Helper Objects | aqConvert Object | aqDateTime Object | aqEnvironment Object | aqFileSystem Object | aqObject Object | aqString Object | aqUtils Object


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document