SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: Drive

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    95
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Drive

    What function can be used to get all local drives on the machines? ie. drive A, drive B or drive C
    I did a search on the Test complete help file and couldn't find it. any suggestions?

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    1,196
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Drive

    Hello,

    The information you need can be obtained using methods and classes of the WMI OLE object.
    A detailed description of WMI and its classes can be found in MSDN:
    http://msdn.microsoft.com/en-us/library/aa394582.aspx

    You can use the following script to get the information:

    [VBScript]

    Sub Main
    PostDrivesInfo("< computer name >")
    End Sub
    Sub PostDrivesInfo(ComputerName)
    Dim ObjectsList, CurrentObject, FolderID
    FolderID = Log.CreateFolder("Logical Disks")
    Log.PushLogFolder(FolderID)
    Set WMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")

    ' Selects all hard drives
    Set ObjectsList = WMIService.ExecQuery("Select * from Win32_LogicalDisk")

    For Each CurrentObject in ObjectsList
    FolderID = Log.CreateFolder(CurrentObject.Name)
    Log.PushLogFolder(FolderID)
    Log.Message "Label: " & CurrentObject.VolumeName
    Log.Message "Size (MB): " & CurrentObject.Size / 1024^2
    Log.Message "FreeSpace (MB): " & CurrentObject.FreeSpace / 1024^2
    Log.PopLogFolder
    Next
    Log.PopLogFolder
    End Sub

    Please visit the following MSDN page for more information about the Win32_LogicalDisk class:
    http://msdn.microsoft.com/en-us/library/aa394173.aspx
    Best regards,
    David - SmartBear Support

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    95
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Drive

    Thanks for the scripts! I will try it. Acutally, my test scripts with a project are stored in different drives on different machines. ie store in drive C in machine1, drive D in machine2. That's why I need to find a solution that Test complete can run the test scripts on a particular drive on a machine. It means that I can run the tests with the same project on different machines.

    I tried to use the LocalVariable panel but it didn't work well because the same project is used on all test machines. I can't hardcode to set a variable 'LocalDrive' to 'D' on the project as it won't work on the machine. any suggestions?

  4. #4
    Senior Member
    Join Date
    May 2004
    Posts
    1,196
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Drive

    Hello,

    You can use the Project.Path, ProjectSuite.Path and Utilities.ExpandFileName methods to retrieve the paths.
    Please see the corresponding TestComplete help topics for more information.
    Best regards,
    David - SmartBear Support

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:28 PM.

Copyright BetaSoft Inc.