Forum Discussion

JNugent's avatar
JNugent
Occasional Contributor
13 years ago

Accessing Windows Directory from TestComplete

Hi,

Currently I require an automated script that accesses my wpf application, produces a number of reports (which are excel spreadsheets) and saves these reports in a folder on the user's local machine. My test is to run these reports via the application, go into the windows explorer, access the correct folders and compare the reports against each other.

The part I am having prooblems with is Accessing Windows folder by name. For example in VBA you would do the following to access the directories:



Set filesys = CreateObject("Scripting.FileSystemObject")

Set originalFolder = filesys.GetFolder(originalResultSets) \\this refers to a variable with the directory

Set subOrigResultSets = originalFolder.SubFolders

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

i = 1

For Each SubFolder In originalFolder.SubFolders

etc



I can't seem to find a way to do this in TestComplete. I don't want to be able to access the directory by a hardcoded name mapping (example- see below) because the folders dynamically change depending on the report name so I need control over this. (for example the folder will be report1, report2, report 3 etc)


  Set explorer = Aliases.Explorer

Call explorer.wndShell_TrayWnd.ReBarWindow32.MSTaskSwWClass.MSTaskListWClass.Click(158, 26)

Set wndZZZ_Original = explorer.wndZZZ_Original

Call wndZZZ_Original.WorkerW.ReBarWindow32.TravelBand.ToolbarWindow32.ClickItem(256, False)Call explorer.wndDocuments.Documents.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.DirectUIHWND.DblClick(92, 835)

Any help much appreciated!

Thanks,

Joanne








2 Replies

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Joanne,


    As far as I know, TestComplete can work with Scripting.FileSystemObject and other objects used in your initial script. So, I recommend that you try running the first script from your post directly from TestComplete and see what will happen.


    I hope this helps :)