Forum Discussion

aamer_iqbal's avatar
aamer_iqbal
Occasional Contributor
11 years ago

How to extract the zip files present in a folder using TestComplete


There are 2 methods I have used for doing the above action.



Method1 :

I have used below method to get the zip file name from the folder but I am unable to Right-Click on that zip file to unzip it using 7-Zip or windows Extract.





Code :

    var folderInfo = aqFileSystem["GetFolderInfo"]("Path of folder");

    Log["Message"]folderInfo["Name"]); // Folder name



    var subFolder = folderInfo["Files"];

    var zipFileName = subFolder["Item"](0); // Zip file name



    /* What method to use here now for Right-clicking? */



 



Method2 :

By recording, I get the below code and it is extracting the zip files, this is hard coding method but I want generalized method so that I can unzip the same file from the any location.



function Test()

{

   w1 = Sys["Process"]("Explorer")["Window"]("CabinetWClass", "Reserved")["Window"]("ShellTabWindowClass", "Reserved")["Window"]("DUIViewWndClassName")["Window"]("DirectUIHWND")["Window"]("CtrlNotifySink", "", 3)["Window"]("SHELLDLL_DefView", "ShellView")["Window"]("DirectUIHWND");

  w1["ClickR"](165, 35);

  w1["PopupMenu"]["Click"]("7-Zip|Extract Here");

}



Kindly provide with your useful information and helip regarding this issue.



Thanks and regards,

Aamer Iqbal