Hi all,
I'm a beginner of Macroscheduler and trying to find a way to get the time stamp of a file. I don't see any existing function can do it. Any suggestions? BTW, I tried to use VB code written by my friend, but it doesn't work in macroscheduler. The code looks like this:
vbstart
Function GetTimStamp(FileName)
Dim oFS As Object
Dim FileName As String
Dim mydate As String
Set oFS = CreateObject("Scripting.filesystemobject")
mydate = oFS.getfile(FileName).DateCreated
msgbox(mydate)
End Function
vbend
vbeval>GetTimeStamp("C:\TEMP\Test.txt")
This VB code give me this error message "VBScript compilation error:1025"
Please give me some advice, I've been struggle with this problem for a few days.... I'm not familiar with VB at all.
how to get the time stamp of a file?
Moderators: Dorian (MJT support), JRL
FileTime> will get the last modified time of a file. Here's a sample script that shows how you might use FileTime>, FileDate> and FileSize>.
Code: Select all
//Get a file to work with
GetFileList>%Script_Dir%\*.*,vFileList
Separate>vFileList,;,vFileName
Let>vFile=vFileName_1
//Get The Date, Time and Size of the file
FileDate>vFile,vFileDate
FileTime>vFile,vFileTime
FileSize>vFile,vFilesize
//Display the collected information
Let>vMessage=%vFile%%crlf%%Tab%%Tab%Size = %vFilesize%%crlf%
ConCat>vMessage,%Tab%%Tab%Date = %vFileDate%%crlf%
ConCat>vMessage,%Tab%%Tab%Time = %vFileTime%
MDL>vMessage
//If you want the date or time in a particular format you can use
//Midstr> to break it into parts and then put it together in
//your chosen format
MidStr>vFileDate,1,4,CCYY
MidStr>vFileDate,5,2,MM
MidStr>vFileDate,7,2,DD
Let>vFileDate=%MM%/%DD%/%CCYY%
Midstr>vFileTime,1,2,HH
Midstr>vFileTime,3,2,MN
Midstr>vFileTime,5,2,SS
Let>vFileTime=%HH%:%MN%:%SS%
Let>vMessage=%vFile%%crlf%%Tab%%Tab%Size = %vFilesize%%crlf%
ConCat>vMessage,%Tab%%Tab%Date = %vFileDate%%crlf%
ConCat>vMessage,%Tab%%Tab%Time = %vFileTime%
MDL>vMessage