cancel
Showing results for 
Search instead for 
Did you mean: 

Clicking Folder on Windows Desktop

SOLVED
Occasional Contributor

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: Clicking Folder on Windows Desktop

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);

View solution in original post

2 REPLIES 2
Community Leader

Re: Clicking Folder on Windows Desktop

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);

View solution in original post

Occasional Contributor

Re: Clicking Folder on Windows Desktop

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

 

I could use ListView methods to sort the issue.

 

🙂

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors