SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    File date and time in Visual Test

    Hello. I'm very new to Visual Test. I just purchased the product a couple days ago and am beginning to write my first scripts. I tried using the FileDateTime function from visual basic, but it didn't work. Does anyone know how to get the file date and time within Visual Test? Thanks.

    -eecscoder

    ------------------

  2. #2
    Junior Member
    Join Date
    Sep 2001
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: File date and time in Visual Test

    Hi, eecscoder!

    Here is simple script to get a file's Date and/or Time:

    -------------------
    Dim strFilePath as String
    Dim CreateTime as FILETIME
    Dim LastAccessTime as FILETIME
    Dim LastWriteTime as FILETIME
    Dim FileStruct As OFSTRUCT
    Dim SystemTime As SYSTEMTIME

    strFilePath = "D:\bla bla bla..." 'your file's path and name

    hFile = OpenFile(strFilePath, FileStruct, OF_READ Or OF_SHARE_DENY_NONE)
    If hFile = 0 Then
    MsgBox "Can't open the file"
    End
    End If

    if GetFileTime(hFile , CreateTime, LastAccessTime, LastWriteTime) then
    FileTimeToSystemTime(CreateTime, SystemTime)

    print SystemTime.wYear
    print SystemTime.wMonth
    print SystemTime.wDay
    print SystemTime.wHour
    print SystemTime.wMinute
    print SystemTime.wSecond

    else
    Msgbox "GetFileTime is failed!"
    End
    End if
    ------------------------

    That's all.
    Regards,
    Vahancho

    P.S. Please don't forget also to make link to WINAPI.INC file)


    ------------------

  3. #3
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: File date and time in Visual Test

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Vahancho:
    Here is simple script to get a file's Date and/or Time:
    <HR></BLOCKQUOTE>
    You have to use Windows APIs. You can get all attributes of the File. See below an API to get time of file.

    declare function GetFileTime lib "kernel32.dll" alias "GetFileTime" (hFile&, lpCreationTime as FILETIME, lpLastAccessTime as FILETIME, lpLastWriteTime as FILETIME) as long

    VT has winapi.inc file in <VT Installed Dir>\vt6\includes. Winapi.inc has some more windows APIs.



    ------------------
    Thanks & Regards,
    Palani.
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

 

 

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:05 AM.

Copyright BetaSoft Inc.