SaveFile Method

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The method is applied to window objects that correspond to standard Save File dialogs. It simulates the selection of the specified file in the dialog and then closes the dialog.

Declaration

TestObj.SaveFile(FileNameFileType)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
FileName [in]    Required    String    
FileType [in]    Optional    Variant Default value: -1   
Result None

Applies To

A window object that corresponds to a standard Save File dialog box:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.

Parameters

The method has the following parameters:

FileName

The fully-qualified name of the file to be selected.

FileType

A string or an integer value that specifies the type of the file to be selected. This parameter corresponds to the value that is shown in the Files of type box of the standard Save File dialog.

If FileType is specified, the method sets the appropriate value in this box before selecting the file. If FileType is omitted or is equal to -1, the method does not change the value of this box.

If FileType is a string, the method treats it as an item’s text that is shown in the drop-down list of the “Files of type” box. If FileType is an integer, the method treats it as the index of the desired item (indexes are zero-based). If the specified item was not found, the method posts an error message to the test log and does not save a file.

Result Value

None.

Remarks

The SaveFile method is not recorded on Windows 7 and Windows Vista; instead, TestComplete records interactions with the Save File dialog elements. However, you can modify the recorded test and manually replace them with the SaveFile method call.

Example

For sample code that demonstrates how to use the method, see Working With Open File and Save File Dialogs.

See Also

OpenFile Method
Working With Open File and Save File Dialogs

Highlight search results