cancel
Showing results for 
Search instead for 
Did you mean: 

Clicking Folder on Windows Desktop

SOLVED
TestQA1
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
ApplePen
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

4 REPLIES 4
ApplePen
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

TestQA1
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.

 

🙂

shejuti
Occasional Contributor

Re: Clicking Folder on Windows Desktop

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?

BenoitB
Community Hero

Re: Clicking Folder on Windows Desktop

Use find method with Name property and use wildcard "*" in the Name property value to search.

 

Un sourire et ça repart

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