Forum Discussion
ArmandsBruns
14 years agoFrequent Contributor
Hi Mike
Thanks for your support
I tried to convert VBScript :)
but it shows me error:
-----------------------------------------------------
Function findLatestFileAndLaunch()
filePath = "D:\"
fileExtension = "Result_IE_*.xlsx"
i = 0
Set filesInFolder = Array()
Set fileInformation = Array()
Dim newestFile
'Grab the files that match the extension supplied from the folder specified.
filesInFolder = aqFileSystem.FindFiles(filePath, fileExtension)
'Grab the file details for comparison.
while filesInFolder.HasNext
Set fileInformation(i) = filesInFolder.Next
i = i + 1
'Set newestFile to the first file that was found
newestFile = fileInformation(0)
For a = 0 To fileInformation.length-1
'Compare the files and find the most recent.
if (aqDateTime.Compare(newestFile.DateLastModified, fileInformation(a).DateLastModified) = 1) Then
newestFile = fileInformation(a)
End If
Next
'Add the latest file as a TestedApp and Run it.
Set appIdx = TestedApps.Add(newestFile.Path)
TestedApps.Items(appIdx).Run()
End Function
-----------------------------------------------------
Armands
Thanks for your support
I tried to convert VBScript :)
but it shows me error:
-----------------------------------------------------
Function findLatestFileAndLaunch()
filePath = "D:\"
fileExtension = "Result_IE_*.xlsx"
i = 0
Set filesInFolder = Array()
Set fileInformation = Array()
Dim newestFile
'Grab the files that match the extension supplied from the folder specified.
filesInFolder = aqFileSystem.FindFiles(filePath, fileExtension)
'Grab the file details for comparison.
while filesInFolder.HasNext
Set fileInformation(i) = filesInFolder.Next
i = i + 1
'Set newestFile to the first file that was found
newestFile = fileInformation(0)
For a = 0 To fileInformation.length-1
'Compare the files and find the most recent.
if (aqDateTime.Compare(newestFile.DateLastModified, fileInformation(a).DateLastModified) = 1) Then
newestFile = fileInformation(a)
End If
Next
'Add the latest file as a TestedApp and Run it.
Set appIdx = TestedApps.Add(newestFile.Path)
TestedApps.Items(appIdx).Run()
End Function
-----------------------------------------------------
Armands