RPA Community Forum

Code snippet for file to complete downloading before closing TagUI

#1

For anyone looking for a ready code snippet to implement into TagUI
Adjust timing loop as required, this code snippet will exit after 10sec

The file name is passed into script as p1

 js begin
    var fs = require('fs');
    for(i=0;i<100;i++){
    if (fs.exists('/home/userdir/`p1`')) {
    i= 100;
    }
    sleep(100);
    }
js finish

I had to use this script as the website I’m downloading data from is rather slow and I found myself with a couple of .crdownload files because chrome hasn’t finished downloading before the script ended. hopefully, it’ll help someone out there.