Can't get Imacros to download a PDF

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
ccvle
Posts: 13
Joined: Fri Feb 02, 2018 4:45 pm

Can't get Imacros to download a PDF

Post by ccvle » Wed Mar 14, 2018 7:39 pm

IE = 11.09600.18893
IMACROS=12.0501.6698

Hi, I would appreciate if someone can help me figure this one out or lead me to the where i can read additional materials so i can figure out myself.

Currently after the last command, a pop up window will pop up and reveal the available documents to download. The problems are 1) the POS is different everytime. I know how to use relative position, but I can't figure out what is the anchor to use. 2)the biggest problem is, even if I know the TAG POS to use for the download link, when I enter that command to the Imacros, it wouldn't do anything. For example, in the example provided below, I used Imacros recording function to figure out the command for the download link is TAG POS=19 TYPE=TD ATTR=* , but when I manually enter the command in the script before, it didn't do anything.

Code: Select all

SET !ERRORIGNORE YES
TAB T=1
URL GOTO=https://ccfs.sos.wa.gov/#/Home
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:UBINumber CONTENT=604140761 
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Search
TAG POS=1 TYPE=TD ATTR=CLASS:ng-binding
TAG POS=R-1 TYPE=A ATTR=TXT:*
SET !TIMEOUT_STEP 1
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:btnFilingHistory
TAG POS=1 TYPE=TD ATTR=TXT:Initial*
TAG POS=R1 TYPE=A ATTR=TXT:View<SP>Documents
ccvle
Posts: 13
Joined: Fri Feb 02, 2018 4:45 pm

Re: Can't get Imacros to download a PDF

Post by ccvle » Wed Mar 14, 2018 11:26 pm

I'm going to change my question because I figured out how to download the file. I change used relative position and change the command from type=TD to Type=I. The question I have now is, I cant get the file to preview in IE , so I cant use the ondownload command to rename the file before saving. If I cant get PDF to preview in IE, is there a way to extract the file name ? that way I can know which file is associated with which search result.
chivracq
Posts: 7722
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Can't get Imacros to download a PDF

Post by chivracq » Fri Mar 16, 2018 12:06 am

ccvle wrote:

Code: Select all

IE = 11.09600.18893
IMACROS=12.0501.6698
Hi, I would appreciate if someone can help me figure this one out or lead me to the where i can read additional materials so i can figure out myself.

Currently after the last command, a pop up window will pop up and reveal the available documents to download. The problems are 1) the POS is different everytime. I know how to use relative position, but I can't figure out what is the anchor to use. 2)the biggest problem is, even if I know the TAG POS to use for the download link, when I enter that command to the Imacros, it wouldn't do anything. For example, in the example provided below, I used Imacros recording function to figure out the command for the download link is TAG POS=19 TYPE=TD ATTR=* , but when I manually enter the command in the script before, it didn't do anything.

Code: Select all

SET !ERRORIGNORE YES
TAB T=1
URL GOTO=https://ccfs.sos.wa.gov/#/Home
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:UBINumber CONTENT=604140761 
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Search
TAG POS=1 TYPE=TD ATTR=CLASS:ng-binding
TAG POS=R-1 TYPE=A ATTR=TXT:*
SET !TIMEOUT_STEP 1
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:btnFilingHistory
TAG POS=1 TYPE=TD ATTR=TXT:Initial*
TAG POS=R1 TYPE=A ATTR=TXT:View<SP>Documents
ccvle wrote:I'm going to change my question because I figured out how to download the file. I change used relative position and change the command from type=TD to Type=I. The question I have now is, I cant get the file to preview in IE , so I cant use the ondownload command to rename the file before saving. If I cant get PDF to preview in IE, is there a way to extract the file name ? that way I can know which file is associated with which search result.
Okay, but hum, I thought you had understood my "CIM" from your previous/first Thread, which would now in this Thread become "FCIM", and the "F" stands for "FULL"..., with all Explanation in my Sig... :idea:
=> FCIM...! :mrgreen:

Sorry but make it reach your "Central Management Thinking System", I don't react/help for Threads where FCI is not mentioned, even if you think that some part(s) is/are not needed, I don't care as I don't read otherwise...!, OS is missing for example from your FCI, and for a Thread about "Download PDF", then yep, OS can play a Role...!, Downloading requires FIO (Local File I/O), and FIO involves OS... Hum, and especially for PDF Files, such Files with '.pdf'/'.xls'/etc Extensions get handled differently at the OS-Level, so OS definitely plays or can play a Role in your Case...
Even if I can often "deduct" that Info from a Screenshot or a Path (or some previous Thread(s)), but that Info belongs directly in your OP when you open a Thread without me having to play "little Detective" to find it out...

Hum, and I see iMB v12.0, your previous Thread was from more than 30 days ago, you were using iMB v12.0 Trial then, you need to mention as well if you switched/upgraded in the meantime to iMB v12.0 Professional/Enterprise Edition or if you are still using the Trial Version...? :|
Hum, Trial I guess or you would be asking your Qt directly to TechSup and not on the Forum if you had any Commercial Edition as you then get (Direct) Access to TechSup..., but pfff..., you need to mention that Info directly and proactively without me having to ask the "correct Qt's"... :roll:

(And don't worry, I don't care if you are still using some Trial Version even after more than 30 days, I'm not affiliated with iOpus/Ipswitch (and I'm often the first one to "bash" them, ah-ah...!), I only care about helping Users (who use the Forum "a bit correctly") and to provide a bit of "Quality" Threads on the Forum... 8) My main Motivation actually to help Users on the Forum is because of the (semi) "Open Source"/Free Aspect of the 3 Add-ons for FF/IE/CR..., hum even if that's (the "Free" part) since recently not completely the case anymore for CR... :shock: )
Yeah well, I sometimes "say stg" when some "funny" User starts complaining about "the Software" not meeting their "Expectations" or stg like that, while they've been using the Trial Version for already 1.5 or 2 years, then yep, I usually find such Users "funny" and I might make some "funny"/"ironicosarcastic" Remark in my "Creative Style" about it, ah-ah...! :wink:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
ccvle
Posts: 13
Joined: Fri Feb 02, 2018 4:45 pm

Re: Can't get Imacros to download a PDF

Post by ccvle » Fri Mar 16, 2018 3:59 pm

chivracq wrote:
ccvle wrote:

Code: Select all

IE = 11.09600.18893
IMACROS=12.0501.6698
Hi, I would appreciate if someone can help me figure this one out or lead me to the where i can read additional materials so i can figure out myself.

Currently after the last command, a pop up window will pop up and reveal the available documents to download. The problems are 1) the POS is different everytime. I know how to use relative position, but I can't figure out what is the anchor to use. 2)the biggest problem is, even if I know the TAG POS to use for the download link, when I enter that command to the Imacros, it wouldn't do anything. For example, in the example provided below, I used Imacros recording function to figure out the command for the download link is TAG POS=19 TYPE=TD ATTR=* , but when I manually enter the command in the script before, it didn't do anything.

Code: Select all

SET !ERRORIGNORE YES
TAB T=1
URL GOTO=https://ccfs.sos.wa.gov/#/Home
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:UBINumber CONTENT=604140761 
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Search
TAG POS=1 TYPE=TD ATTR=CLASS:ng-binding
TAG POS=R-1 TYPE=A ATTR=TXT:*
SET !TIMEOUT_STEP 1
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:btnFilingHistory
TAG POS=1 TYPE=TD ATTR=TXT:Initial*
TAG POS=R1 TYPE=A ATTR=TXT:View<SP>Documents
ccvle wrote:I'm going to change my question because I figured out how to download the file. I change used relative position and change the command from type=TD to Type=I. The question I have now is, I cant get the file to preview in IE , so I cant use the ondownload command to rename the file before saving. If I cant get PDF to preview in IE, is there a way to extract the file name ? that way I can know which file is associated with which search result.
Okay, but hum, I thought you had understood my "CIM" from your previous/first Thread, which would now in this Thread become "FCIM", and the "F" stands for "FULL"..., with all Explanation in my Sig... :idea:
=> FCIM...! :mrgreen:

Sorry but make it reach your "Central Management Thinking System", I don't react/help for Threads where FCI is not mentioned, even if you think that some part(s) is/are not needed, I don't care as I don't read otherwise...!, OS is missing for example from your FCI, and for a Thread about "Download PDF", then yep, OS can play a Role...!, Downloading requires FIO (Local File I/O), and FIO involves OS... Hum, and especially for PDF Files, such Files with '.pdf'/'.xls'/etc Extensions get handled differently at the OS-Level, so OS definitely plays or can play a Role in your Case...
Even if I can often "deduct" that Info from a Screenshot or a Path (or some previous Thread(s)), but that Info belongs directly in your OP when you open a Thread without me having to play "little Detective" to find it out...

Hum, and I see iMB v12.0, your previous Thread was from more than 30 days ago, you were using iMB v12.0 Trial then, you need to mention as well if you switched/upgraded in the meantime to iMB v12.0 Professional/Enterprise Edition or if you are still using the Trial Version...? :|
Hum, Trial I guess or you would be asking your Qt directly to TechSup and not on the Forum if you had any Commercial Edition as you then get (Direct) Access to TechSup..., but pfff..., you need to mention that Info directly and proactively without me having to ask the "correct Qt's"... :roll:

(And don't worry, I don't care if you are still using some Trial Version even after more than 30 days, I'm not affiliated with iOpus/Ipswitch (and I'm often the first one to "bash" them, ah-ah...!), I only care about helping Users (who use the Forum "a bit correctly") and to provide a bit of "Quality" Threads on the Forum... 8) My main Motivation actually to help Users on the Forum is because of the (semi) "Open Source"/Free Aspect of the 3 Add-ons for FF/IE/CR..., hum even if that's (the "Free" part) since recently not completely the case anymore for CR... :shock: )
Yeah well, I sometimes "say stg" when some "funny" User starts complaining about "the Software" not meeting their "Expectations" or stg like that, while they've been using the Trial Version for already 1.5 or 2 years, then yep, I usually find such Users "funny" and I might make some "funny"/"ironicosarcastic" Remark in my "Creative Style" about it, ah-ah...! :wink:

I use Window 7 Enterprise version and I did ended up buying the basic version of Imacros. You can ignore all the questions that i have in the original thread. For some reasons, I didn't know "ondownload" can detect a download and autosave based on your command. I thought the only way to save PDF was to use the saveitem command, which required the pdf to open in browser. I guess I was wrong. I did have to switch from IE 11 to FF 52 in order to get it to work. I think IE was giving me the error message that no download was detected (forgot the error code). FF was working for the most part, but for some reasons the "ondownload" doesn't always detect the download (i.e., instead of auto save the pdf, i would get a download prompt that ask if i want to open or save the file). The macros worked the best when I leave my computer alone and not do anything.
chivracq
Posts: 7722
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Can't get Imacros to download a PDF

Post by chivracq » Fri Mar 16, 2018 5:40 pm

ccvle wrote:I use Window 7 Enterprise version and I did ended up buying the basic version of Imacros. You can ignore all the questions that i have in the original thread. For some reasons, I didn't know "ondownload" can detect a download and autosave based on your command. I thought the only way to save PDF was to use the saveitem command, which required the pdf to open in browser. I guess I was wrong. I did have to switch from IE 11 to FF 52 in order to get it to work. I think IE was giving me the error message that no download was detected (forgot the error code). FF was working for the most part, but for some reasons the "ondownload" doesn't always detect the download (i.e., instead of auto save the pdf, i would get a download prompt that ask if i want to open or save the file). The macros worked the best when I leave my computer alone and not do anything.
Hum, you don't need to quote yourself again, that doesn't help for "Readability" of the Thread, but OK, never mind...

OK, a bit of "fishing" required, but we have your FCI...:

Code: Select all

IE = 11.09600.18893
IMACROS=12.0501.6698 PE
Win7 Enterprise
FF52
But hum, if using FF now, you then need to mention which Version of the FF Add-on you are using...!? :roll:
=> Will probably be v9.0.3 I guess...?
Recommended FCI on FF would be v8.9.7 for FF + FF v55.0.3, as v9.0.3 broke (or "stopped supporting") quite some Functionality, but nothing related to "Download" and the 'ONDOWNLOAD' Command "luckily", I think..., but 'SAVEAS' was impacted... Well, I never bothered installing v9.0.3 for FF, and I don't do any Downloads in my Scripts, so I don't really "follow" that Functionality...

Yeah well, about 'SAVEITEM' and 'ONDOWNLOAD', 2 different Mechanisms indeed... :wink:
- 'ONDOWNLOAD' as a first Choice I would think, but it doesn't always work completely "properly and reliably" all the time as "too many Cooks are trying to steer the Sauce at the same time" in the Process (iMacros + Browser + any Plugins related to the Extension + OS + the Web-Page and the Web-Server serving the File).
- And in case of "Difficulties", then 'SAVEITEM' can indeed be a viable Workaround if the File (PDF in your case) can be viewed directly in the Browser (usually with the "Help" of some Plugin, which can in return become a "pain in the ass" as it might want to control some extra / too much Functionality...), and 'SAVEITEM' might be slower for iMacros as it saves the File from the Browser Cache and therefore first needs to have the File completely (and correctly!) in some Tab in the Browser while with 'ONDOWNLOAD' your Script can keep running while the Download is still happening... It's possible to shorten '!TIMEOUT_PAGE' (+ '!ERRORIGNORE') if you don't want your Script to wait too long, but that can be "dangerous" as you might end up with the File being truncated, if stg ueberhaupt gets saved...

>

But OK, now if I understand correctly, your Qt is about "... is there a way to extract the file name ?".
=> I would think Yes, if the Filename (and URL) is "hardcoded" in the Source of the Page, but very often they are "dynamically" computed from some (JS) Script, so that can be tricky then... But an 'EXTRACT=HREF' on the "correct" HTML Element is sometimes able to directly construct the correct URL as well...
I can't have a look at the Site as it is behind L&P...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply