After that i use the Copy Action with GetLatestFile as source. But when the FileSet is Empty it gets an Error in the FileSet Script with ListIndex out of bounds. I tried to change the FileSet Script:
if PDFS.Count = 0 then GetLatestFileCount = 0 else GetLatestFileCount = PDFS.Count -1 GetLatestFile = PDFS.File(GetLatestFileCount)
But that wont work, its allways ListIndex is out of bounds.
I dont know VB very well as you can imagine and i hope someone can help here...
One way to do this would be to turn on “Fail if no files found” and “Ignore failure”, and then your VB code only has to handle the case when there is actually a file.
Another solution that involves very little scripting (always a good thing in my book) would be to:
- FileSet Define [Sorted by filedate, descending] - Iterate Fileset [with “Action.Reset” in the OnAfterEachIteration script event] ------ Do the copy here [this will only get called if at least one file found, and only for the first (most recent) file] - Something else here
i have done the first solution now and it works, i know that the problem was the StringList PDFS.File. But i will move to the second solution tomorrow couse i dont like to ignore failures.
long time ago and i have to review the script. I tried to do the second solution but i dont know how. How can i sort the FileSet Define by filedate? And how can i do the “Iterate Fileset [with “Action.Reset” in the OnAfterEachIteration script event]” ?
i really hope you or someone else is helping me out…