Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP 11 on Win7 64B does not work with basic wintreeview
#2
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi there,

If you wan to just select a folder from the Browse for folder dialog. Try the code mentioned below. It should work.



Code:
Option Explicit
On Error Resume Next
Dim FolderPath  'Path to the folder to be searched for files
Dim objFSO   'The fileSystemObject
Dim objFolder  'The folder object
Dim colFiles  'Collection of files from files method
Dim objFile   'individual file object
Dim strOUT    'Single output variable
subCheckWscript 'Ensures script is running under wscript
subGetFolder  'Calls the browseForFOlder method
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FolderPath)
Set colFiles = objFolder.Files
For Each objFile in colFiles
   strOUT = strOUT & objFile.Name & vbTab & objFile.Size _
   & " bytes" & VbCrLf
Next
WScript.Echo strOUT

' ****** subs below ******
Code:
Sub subCheckWscript
If UCase(Right(WScript.FullName, 11)) = "CSCRIPT.EXE" Then
    WScript.Echo "This script must be run under WScript."
    WScript.Quit
End If
End Sub
Sub subGetFolder
Dim objShell, objFOlder, objFolderItem
Const windowHandle = 0
Const folderOnly = 0
const folderAndFiles = &H4000&
Set objShell = CreateObject("Shell.Application")      
Set objFolder = objShell.BrowseForFolder(windowHandle,  "Select a folder:", folderOnly)      
Set objFolderItem = objFolder.Self  
FolderPath = objFolderItem.Path
End Sub
Reply


Messages In This Thread
RE: QTP 11 on Win7 64B does not work with basic wintreeview - by ManualTester - 11-16-2012, 07:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Does QTP Recognize IBM Work place forms 2.7??? nit_naresh 0 2,333 09-04-2011, 10:43 AM
Last Post: nit_naresh
  Is QTP10 Supports Win7 64 Bit platform OS JyotiRanjan 6 7,286 08-23-2011, 07:54 AM
Last Post: Setsuna F. Seiei
  QTP11 and WIN7 64 bit applications madankumar.jayapal 0 7,179 01-20-2011, 05:04 PM
Last Post: madankumar.jayapal
  js errors with qtp 10 on win7 vs. IE8 yaniv mendelson 2 4,108 03-15-2010, 03:52 PM
Last Post: yaniv mendelson
  Basic concept of QTP shwetap 1 2,601 11-11-2009, 04:43 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 1 Guest(s)