miscthings wrote:Hello, been lurking all day to try to find an answer to my problem but I can't seem to figure it out, so I thought I'd post on the forums.
I am using the trial client of iMacros Browser at the moment.
FCI:
Code: Select all
Windows 7 Enterprise - English
iMacros Browser V11.5.499.3066
Emulating IE11
Basically I am trying to use iMacros to do a repetitive task of downloading .pdfs from a website over and over.
This macro would run periodically, but the main issue is how to deal with duplicate documents. Ideally, the solution for me would be to find out if there is a way to check a local directory for a file name, and if it exists, skip this file and continue the loop to the next. My exact question is pretty much asked here, but this is for the Firefox version, and I'm wondering if there's a method for non-JS iMacro code (or, at least, I can't seem to figure out EVAL syntax to write the if check).
https://stackoverflow.com/questions/386 ... ox-imacros
If iMacros is incapable of doing it, then I guess I have no choice but to overwrite the files, which is still technically okay for me, except that iMacros is deleting files from my local directory sometimes. With my existing code, when I downloaded a file, I would do it the first time, get the file successfully, but on the second download (same file), it would sometimes
delete the existing file from my directory, and return Error -1415.
I could paste my whole code but really the only relevant line is probably the ONDOWNLOAD line:
Code: Select all
ONDOWNLOAD FOLDER=C:\Users\hob\Desktop\testDir FILE={{acc}}DUE{{date}} WAIT=YES
It's kind of random when it deletes a file, sometimes it will just overwrite without any errors but sometimes the error will happen and stop the script.
Here is the exact copy of the error in my client:
Code: Select all
Error -1415: Cannot find downloaded file 'C:\Users\hob\Desktop\testDir\2241387642DUEJun 26 2017.pdf'. Line 21: ONDOWNLOAD FOLDER=C:\Users\hob\Desktop\testDir FILE={{acc}}DUE{{date}} WAIT=YES
So basically:
1.) Is there a way to check for a file in a local directory, and provide action accordingly based on true/false?
2.) Error -1415 does not exist in iMacro error database, but this isn't a problem if I can figure out the check before downloading at all
3.) What is this .bak file also being generated, is there a way to not download this?
Woaw...!, Compliments for the Quality of your Post/Thread, this should be the "Standard" but unfortunately doesn't occur very often especially with new Users, oops...!
=> Hum, wondering where you got that "FCI" from...!?
OK...!!, thinking..., thinking..., but yep, my first Idea was indeed to use/misuse '!FOLDER_DATASOURCE' Command like you found out from this SOF Thread, well done...!, I posted the Method btw more than 1 year before @Shugar, ah-ah...!, in
this Thread...
But yep, like I said, you can only run a Check on the ReturnCode for the '.iim' Macro (played from 'iimPlay()') and you cannot access this RetCode from the '.iim' Macro itself obviously, because it is still running, ah-ah...!
=> You would indeed need to run your '.iim' Macro from a '.js' Script on FF or using the Scripting Interface, with some '.VBS' or 'C++' or 'C#' or whatever Programming Language you fill confident to use with iMacros...
But OK, some other Method I can think of, in "pure" '.iim' and that therefore would work for iMB (or any other Browser), would be to actually start your Macro (and iMB as well if it's not already running) from a '.BAT' File with an "extra" DOS Command in the '.BAT' before launching iMB + your Macro that would create a 'DIR' Output of your Directory to a '.TXT' File that your Macro could use as a (Temp) DataSource to check if a specific File already exists in the 'DIR' Results...
I demonstrated the Method maybe 2 or 3 months ago, let me find the Thread back...
=> Yep, found it, from 3 months ago indeed... Hum, very-very similar Thread like yours actually, and the User was on iMB v11.5 + Win7 as well, that's why I came up with this Method, I guess...
:
-
Choosing uploaded file by date
I gave the whole Idea/Method in my 2nd Post in that Thread, but read the complete Thread and it shouldn't be very difficult to adapt for your own Needs, I would think...
Well, good luck, and I'll be happy to help you a bit further if you get stuck in the 'Process", but my "Impression" is that you are very "capable", ah-ah...!
(Will be nice btw, and useful for other Users searching the Forum, if you can share your Final Script...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...