Search code examples
javascriptfirefoximacros

How to know if file already exists with Firefox iMacros


I'm using iMacros firefox addon to automatize redundant tasks like downloading bills (pdf files) from a website to my local disk. What I want is, if bill has been already downloaded, to not ask for download next time. Is there a way to know if a file already exists locally ? My macros are integrated in a js script. Thanks for your help.


Solution

  • Here is a simple workaround for that:

    var ret = iimPlayCode("SET !FOLDER_DATASOURCE D:\\iMacros\\Downloads\\blablabla.pdf");
    if (ret == 1) {
        // file exists
    } else {
        // file doesn't exist
    }