I have a script that writes a PDF to the user's desktop, then calls a VB script to attach the PDF to a Slack post. Most of the time it works just fine but occasionally the saved PDF is a zero-length file that Slack can't handle. My inclincation is to add some logic to check file.length before proceeding, but I'm not what to do if/when the file.length is zero. Pause for a few ticks and try again?
Hoping someone else has encountered something like this.
It's not a file.exists problem. The file exists but, once in a while, file.length is zero
Slack won't accept that, understandably.
I'm trying to use $.sleep to build in a short pause between executing fileExport and starting the Slack upload process. But I'm not clear on one important question: Does pause the script execution also pause the fileExport process? I wouldn't think so but I just don't know.