I've the following code when Imacros start uploading my files which are in a specific folder.
Can someone help me to extend the following code ?
I'm using the following Imacros edition:
Windows : Windows server 2019
iMacros version : 12.6 Browser Enterprise edition
Code: Select all
Sub UploadFiles()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim attachmentsPath : attachmentsPath = Replace(Settings("Paths.AttachmentsFolder"), "{{LRN}}", PeachApp("LRN"), 1, -1, vbTextCompare)
Dim attachmentsFolder
Set attachmentsFolder = fso.GetFolder(attachmentsPath)
Set fso = Nothing
Dim file
For Each file In attachmentsFolder.Files
If PROD Then On Error Resume Next
im.Play(Array("Upload File", "uploadsFolder", attachmentsPath, "fileName", file.Name))
Script.SaveErrorState()
On Error Goto 0
Script.RestoreErrorState()
If Err.Number = 0 Then
Logger.LogInfo(Array("Uploaded ", file.Name))
Else
Err.Description = "Failed to upload " & file.Name & ", " & Err.Description
HandleError()
End If
Next
End Sub
In that folder there are 2 types of files. .PDF files and .TXT files.
I want to extend the code that he will upload all .pdf files but only the .TXT files which matchs my file name.
So for example my file name = Test-123test.txt
He may only pick the .TXT file which has 123test.txt in his name.
Can someone help me on this?
Thanks in advance!