Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
4 years ago

Clicking Folder on Windows Desktop

Hi Folks,

 

I'm new to TestComplete andhave been trying to create a Javascript that could double click on the Folder on Windows Desktop.

 

I can see it could be accessed using SysListView32, FolderView window object but I don't know what to do next.

Let's say my Folder name is ABC and it's on desktop.

I tried Find() function but that didn't work too.

 

Any ideas would be very appreciated.

 

Code Sample:


var t,w, control;

t = Sys.Process("explorer");
w = t.Window("WorkerW", "", 13);
w = w.Window("SHELLDLL_DefView", "", 1);
w = w.Window("SysListView32", "FolderView", 1);

control = w.Find("wSelectedItems", "ABC", 1000);

control.DblClick();

 

Error:

object 'control' doesnt exist.

 

  • You could do it like the codes.

    var pcDesktop = Aliases.explorer.PCdesktop.desktop.listView;
    for(i = 0;i < pcDesktop.wItemCount; i++){
      if(equal(pcDesktop.wItem(i),foldername)){
        pcDesktop.DbClickItem(i);
      }else{
       continue;
      }
    }

    Or A another simple way to do that like this. You could use DbClickItem method.

    xxx.Window("SysListView32", "FolderView", 1).DblClickItem(folderName);

  • ApplePen's avatar
    ApplePen
    Community Leader

    You could do it like the codes.

    var pcDesktop = Aliases.explorer.PCdesktop.desktop.listView;
    for(i = 0;i < pcDesktop.wItemCount; i++){
      if(equal(pcDesktop.wItem(i),foldername)){
        pcDesktop.DbClickItem(i);
      }else{
       continue;
      }
    }

    Or A another simple way to do that like this. You could use DbClickItem method.

    xxx.Window("SysListView32", "FolderView", 1).DblClickItem(folderName);

    • TestQA1's avatar
      TestQA1
      Frequent Contributor

      Thanks very much for your reply. Helped me a lot.

       

      I could use ListView methods to sort the issue.

       

      🙂

  • shejuti's avatar
    shejuti
    Occasional Contributor

    Hi, How did you manage to ignore the number 13 here - w = t.Window("WorkerW", "", 13);

    Because that number seems to change each time I run it. Is there any way to select WorkerW for any index?