Micro Focus QTP (UFT) Forums
Identifying objects on Desktop - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Identifying objects on Desktop (/Thread-Identifying-objects-on-Desktop)



Identifying objects on Desktop - rahul29 - 02-23-2012

I am trying to open a particular application thru the Desktop but am unable to identify any object (individually) on the Desktop. I am only looking for desktop objects, not the windows that are already open. On using below code, i was able to get the count of objects on the desktop, but still not able to identify any of them:

Code:
intCount = Window(objWindow).WinListView(objWinListView).GetItemsCount

Could you help in identifying and opening an object on the desktop? Ideally if there was a way to identify the Icon of the application, and then activate it, that would be great. Or can we use any Ordinal identifier or hotkeys??
I am using qtp10 and Windows Vista system. Could provide more details if needed.

Thanks!


RE: Identifying objects on Desktop - inborntester - 02-23-2012

Hope the below help to get some idea.
Code:
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fol = fso.GetFolder(DesktopPath)
Set files = fol.Files
For each fil In files
  filname=Mid(fil.name,1,instr(1,fil.name,".")-1)
' replace Adobe Reader 8 with the icon name you looking for
  reqapp=(Strcomp(filname,"Adobe Reader 8"))
   If  reqapp then
   Else
  ' write you code for activate it        
   End If
Next

make sure the icon you are looking available in your personal desktop folder more than common user folder. if its not so means just copy and paste it in your desktop folder.