Change name before pushing button to download!

Discussions and Tech Support related to the iMacros Google Chrome extension.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Change name before pushing button to download!

Post by ifchor » Thu Feb 21, 2019 12:02 pm

BUILD=1005 RECORDER=CR
OPERATING SYSTEM = WINDOWS 10 Pro / Version 1809 / English
BROWSER= Chrome 72

Here I am again (sorry, i just post in this chat when i have tried everything!)
I would like to know if there is a way to change the name of the download before downloading it (people say its possible... but i haven't being able to do it up to now).


In order to download what i need, there are two buttons in the webpage:

"Export select" and "Excel XLSX" (this one is the one that downloads the file).

The code i wrote is the following one:

TAG POS=1 TYPE=SPAN ATTR=TXT:Export<SP>Selected
ONDOWNLOAD FOLDER=* FILE=DBF1_{{!VAR1}}_{{!VAR2}} WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Excel<SP>(XLSX)

I have no clue what I am doing wrong. That code just downloads the file but ignores completely the "ondownload sentence...".

Help please!

Thank you in advance,

Laura.
chivracq
Posts: 8693
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change name before pushing button to download!

Post by chivracq » Thu Feb 21, 2019 6:29 pm

ifchor wrote:
Thu Feb 21, 2019 12:02 pm

Code: Select all

BUILD=1005 RECORDER=CR
OPERATING SYSTEM = WINDOWS 10 Pro / Version 1809 / English
BROWSER= Chrome 72 
Here I am again (sorry, i just post in this chat when i have tried everything!)
I would like to know if there is a way to change the name of the download before downloading it (people say its possible... but i haven't being able to do it up to now).


In order to download what i need, there are two buttons in the webpage:

"Export select" and "Excel XLSX" (this one is the one that downloads the file).

The code i wrote is the following one:

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=TXT:Export<SP>Selected
ONDOWNLOAD FOLDER=* FILE=DBF1_{{!VAR1}}_{{!VAR2}} WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Excel<SP>(XLSX)
I have no clue what I am doing wrong. That code just downloads the file but ignores completely the "ondownload sentence...".

Help please!

Thank you in advance,

Laura.
'Free'/'PE' not mentioned in your FCI...?

I'm not completely sure if File Download is supported in the 'Free' Versions, (as I don't use those Versions), but if it is, then 'ONDOWNLOAD' is "definitely" only supported in the 'PE' Version...

What do you have in '!VAR1' and '!VAR2'...? If you have any Char(s) not accepted by the OS for Filenames like any Soft Returns or Tabs for example if your 2 '!VARn' come from some previous 'EXTRACT'/'EVAL()', I wouldn't be surprised if iMacros or the Browser "falls back" onto the Default Filename... I think that part is actually handled by the Browser itself, on FF, some get ignored, some get replaced by an Underscore, and some cause the Download to fail without any Error..., but I don't know how CR will "behave"... And that Behaviour even seems to "regularly" change from (Browser) Version to Version...

And there is "soon" some new Release coming out for iMacros for CR v10.0.x (see this Post from yesterday from TechSup) as CR71 and/or CR72 seem(s) to be breaking the File Upload Functionality in v10.0.5 for CR... It could be that File Download is also impacted..., I don't know... But I guess you would need to post some URL or to confirm from some Demo Macro if you want TechSup/Dev to have a look and to be able to reproduce your Issue...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Fri Feb 22, 2019 8:28 am

PE version! Sorry I forgot again!

What do you have in '!VAR1' and '!VAR2'...?

Simple numbers! I even tried to substitute the VAR-s for normal name, but doesnt work... unfortunately.
The problem is that the page is protected by username and password, and is a company thing, so I cannot display it in here!

SET !VAR1 EVAL("[55000, 19501, 27501, 34001, 39501, 53501, 60001, 72501, 81501, 120001, 205001][{{!LOOP}} - 1];")
SET !VAR2 EVAL("[55050, 27500, 34000, 39500, 53500, 60000, 72500, 81500, 120000, 205000, 700000][{{!LOOP}} - 1];")

I don't know... But I guess you would need to post some URL or to confirm from some Demo Macro if you want TechSup/Dev to have a look and to be able to reproduce your Issue...
Maybe it is impossible to be done... :|

Thank you so much for your response and your time!
chivracq
Posts: 8693
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change name before pushing button to download!

Post by chivracq » Fri Feb 22, 2019 9:38 am

ifchor wrote:
Fri Feb 22, 2019 8:28 am
PE version! Sorry I forgot again!

What do you have in '!VAR1' and '!VAR2'...?

Simple numbers! I even tried to substitute the VAR-s for normal name, but doesnt work... unfortunately.
The problem is that the page is protected by username and password, and is a company thing, so I cannot display it in here!

SET !VAR1 EVAL("[55000, 19501, 27501, 34001, 39501, 53501, 60001, 72501, 81501, 120001, 205001][{{!LOOP}} - 1];")
SET !VAR2 EVAL("[55050, 27500, 34000, 39500, 53500, 60000, 72500, 81500, 120000, 205000, 700000][{{!LOOP}} - 1];")

I don't know... But I guess you would need to post some URL or to confirm from some Demo Macro if you want TechSup/Dev to have a look and to be able to reproduce your Issue...
Maybe it is impossible to be done... :|

Thank you so much for your response and your time!
Ah OK, '!VAR1' + '!VAR2' with your Array Construction was working and was "clean", I remember from some previous Thread of yours, OK then...

"Maybe it is impossible to be done..."
=> Beh pfff..., yeah, LOL...! That's a Barbie's Reaction, ah-ah...!! OK, Thanks for that, my Day cannot go wrong anymore, ah-ah...! :D
So OK no, 'ONDOWNLOAD' is supposed to behave like you expect..., but like I mentioned, CR71/CR72 might be breaking that Functionality, I don't know...
But you opened your Thread in the 'iMacros for CR' Sub-Forum, meaning you tested your Script in some other Version(s) or Browser(s) where your Script was working like expected and that the Issue is specific to your FCI and iMacros for CR v10.0.5. => In which FCI(s) did you test where your Script was working...?
(Doesn't rime again with "Maybe it is impossible to be done..." if you already know that your Script works in some other FCI...)

And most importantly, you didn't react to 'Free' or 'PE'...? Because if you are using the 'Free' Version, then yep, completely normal, and documented I think in the Release Notes and in the Wiki, 'ONDOWNLOAD' is not supported by the 'Free' Version... because it requires the 'FIO' Module for File-Access...

But OK, never mind, I'm "soft-alerting" TechSup to have a look at your Thread, I don't use that Version, so I won't be able to find you some Workaround if there is a Bug, (and to do any Testing myself if you actually use the 'PE' Version as I only have the 'Free' Version installed), and if there is a Bug, then some next Release is already "in the make" for CR, then hopefully your Pb can also be fixed in that next Version then...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Fri Feb 22, 2019 10:50 am

And most importantly, you didn't react to 'Free' or 'PE'...? Because if you are using the 'Free' Version, then yep, completely normal, and documented I think in the Release Notes and in the Wiki, 'ONDOWNLOAD' is not supported by the 'Free' Version... because it requires the 'FIO' Module for File-Access...

I USE PE VERSION (i think i posted in last post but not sure). Just in case, we purchased that with my company last year.

Ah OK, '!VAR1' + '!VAR2' with your Array Construction was working and was "clean", I remember from some previous Thread of yours, OK then...


Yes still on it! It works thanks to you I must say.

"Maybe it is impossible to be done..."
=> Beh pfff..., yeah, LOL...! That's a Barbie's Reaction, ah-ah...!! OK, Thanks for that, my Day cannot go wrong anymore, ah-ah...! :D


Ok, maybe I have been a little bit dramatic... :D but you cannot imagine how frustrated I get when I think I have the solution and it does not work... :cry:

But you opened your Thread in the 'iMacros for CR' Sub-Forum, meaning you tested your Script in some other Version(s) or Browser(s) where your Script was working like expected and that the Issue is specific to your FCI and iMacros for CR v10.0.5. => In which FCI(s) did you test where your Script was working...?

Nice question, I will try with Explorer... maybe miracle happens! --> Little update. It works in there! I owe you a beer minimum!

But OK, never mind, I'm "soft-alerting" TechSup to have a look at your Thread, I don't use that Version, so I won't be able to find you some Workaround if there is a Bug, (and to do any Testing myself if you actually use the 'PE' Version as I only have the 'Free' Version installed), and if there is a Bug, then some next Release is already "in the make" for CR, then hopefully your Pb can also be fixed in that next Version then...

Thank you so much. I hope you get paid by these people, cause the effort that you do everyday its awesome!

Thank you,

Laura.
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Fri Feb 22, 2019 4:01 pm

Not trying to bump this issue, cause its new, but do not know how to add that this functionality is not working for Firefox either... at least to me.

Thank you in advance!
chivracq
Posts: 8693
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change name before pushing button to download!

Post by chivracq » Fri Feb 22, 2019 6:23 pm

ifchor wrote:
Fri Feb 22, 2019 10:50 am
And most importantly, you didn't react to 'Free' or 'PE'...? Because if you are using the 'Free' Version, then yep, completely normal, and documented I think in the Release Notes and in the Wiki, 'ONDOWNLOAD' is not supported by the 'Free' Version... because it requires the 'FIO' Module for File-Access...

I USE PE VERSION (i think i posted in last post but not sure). Just in case, we purchased that with my company last year.

Ah OK, '!VAR1' + '!VAR2' with your Array Construction was working and was "clean", I remember from some previous Thread of yours, OK then...


Yes still on it! It works thanks to you I must say.

"Maybe it is impossible to be done..."
=> Beh pfff..., yeah, LOL...! That's a Barbie's Reaction, ah-ah...!! OK, Thanks for that, my Day cannot go wrong anymore, ah-ah...! :D


Ok, maybe I have been a little bit dramatic... :D but you cannot imagine how frustrated I get when I think I have the solution and it does not work... :cry:

But you opened your Thread in the 'iMacros for CR' Sub-Forum, meaning you tested your Script in some other Version(s) or Browser(s) where your Script was working like expected and that the Issue is specific to your FCI and iMacros for CR v10.0.5. => In which FCI(s) did you test where your Script was working...?

Nice question, I will try with Explorer... maybe miracle happens! --> Little update. It works in there! I owe you a beer minimum!

But OK, never mind, I'm "soft-alerting" TechSup to have a look at your Thread, I don't use that Version, so I won't be able to find you some Workaround if there is a Bug, (and to do any Testing myself if you actually use the 'PE' Version as I only have the 'Free' Version installed), and if there is a Bug, then some next Release is already "in the make" for CR, then hopefully your Pb can also be fixed in that next Version then...

Thank you so much. I hope you get paid by these people, cause the effort that you do everyday its awesome!

Thank you,

Laura.
ifchor wrote:
Fri Feb 22, 2019 4:01 pm
Not trying to bump this issue, cause its new, but do not know how to add that this functionality is not working for Firefox either... at least to me.

Thank you in advance!
OK, I quote "in block", I'm a bit in a hurry...

Oh, 'PE' indeed, I had missed it, I guess you probably had edited your previous Reply just before I hit the 'Quote' Button as I see it was "already" included in my Quote... Then OK, 'ONDOWNLOAD' should work like you expect using the 'PE' Version...

And yep, by "Barbie's Reaction", I meant "a bit dramatic" or "Drama Queen", ah-ah...! :wink:

And good, you tested in other Browsers and FCI's, even if you don't mention the Versions, but I guess that will probably be in the current/last Versions for IE and FF...
=> It works with: iMacros for IE v12.5 + IE11.
It doesn't work with: iMacros for CR v10.0.5 'PE' + CR72 [AND] iMacros for FF v10.0.2 for FF 'PE' + FF64/65.

Hum, OK, I find it a bit strange, v10.0.5 for CR has already been available since a few months, and v10.0.2 for FF since 1.5 years.
That Functionality is pretty "Standard" I would think, and you are very probably not the only one using it, so I'm surprised nobody reported it earlier then... :o

Stg else that could play a role is maybe the File Extension, maybe you could try specifying the File Extension:

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=TXT:Export<SP>Selected
ONDOWNLOAD FOLDER=* FILE=DBF1_{{!VAR1}}_{{!VAR2}}.xlsx WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Excel<SP>(XLSX)
WAIT SECONDS=2
I did some "Testing" for myself recently, related to the 'SAVEAS' Command (which is very similar to 'ONDOWNLOAD') and the different 'TYPE=' Types, and with specifying or not the Extension and even specifying deliberately some "wrong" Extension, like ".html" while doing a 'SAVEAS TYPE=TXT' and I found out that there is some quite complex "Negotiation" Mechanism between iMacros and the Browser (I was using v8.8.2 for FF + Pale Moon v26.3.3 on Win10_x64), so it could be that this '.xlsx' is causing the Pb, if iMacros for example doesn't really know how to handle it... I don't know, I'm just guessing...

But OK, I had alerted TechSup this morning just after my last Reply, as the WE was coming, in case they checked the Forum..., but nope..., Monday then I guess... :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Mon Feb 25, 2019 8:22 am

Good morning and good monday!

I tried specifying file name but does not work. Thank you for your help and looking forward for tech support!

Best Regards,

Laura.
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Thu Feb 28, 2019 1:06 pm

Hi guys!

Any updates on the issue?

Best Regards,

Laura.
Tom, Tech Support
Posts: 3522
Joined: Mon May 31, 2010 4:59 pm

Re: Change name before pushing button to download!

Post by Tom, Tech Support » Wed Mar 06, 2019 6:04 pm

Hi ifchor,

Sorry for the late reply. I just tested our demo Download macro using iMacros for Chrome 10.0.5 in the latest Chrome 72.0.3626.121. I changed the ONDOWNLOAD command to specify a custom folder and file name and the file downloads to the correct location and with the specified file name for me. Here is the macro:

Code: Select all

'This macro demonstrates the ONDOWNLOAD command
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://demo.imacros.net/Automate/Downloads
'    
'Use the FOLDER=* part of the ONDOWNLOAD command to define another download directory 
'Automatic file name generation can be overwritten by replacing
'FILE=+_{{!NOW:yyyymmdd_hhnnss}}  
'with 
'FILE=yourname (The correct file extension is added automatically)
'For more information visit http://wiki.imacros.net/ONDOWNLOAD
'
'For IE9/IE10 users, one has to change a setting not to prompt to open attached/downloaded zip files. 
'One has to first download by hand such a file, then open the downloads view (Ctrl+J), 
'right-click on the zip file to retrieve its context menu and 
'disable "Always ask before opening this type of file"
'
'
ONDOWNLOAD FOLDER=C:\Temp FILE=my_download_{{!NOW:hhnnss}}.zip WAIT=YES
TAG POS=2 TYPE=A ATTR=TXT:*Download*
WAIT SECONDS=6
URL GOTO=http://demo.imacros.net/Automate/OK 
Would you please test the same macro (make sure the folder C:\Temp exists on your machine first). I'm suspecting that the behavior you are experiencing may be site-specific.
Regards,

Tom, iMacros Support
ifchor
Posts: 18
Joined: Wed Oct 03, 2018 2:17 pm

Re: Change name before pushing button to download!

Post by ifchor » Fri Mar 08, 2019 9:53 am

Dear Support,

That macro works. It looks like in my case, the webpage name prevails over the name that i input in ONDOWNLOAD...

so no solution for this right?

thank you so much for your support and sorry for late reply!

Laura.
Tom, Tech Support
Posts: 3522
Joined: Mon May 31, 2010 4:59 pm

Re: Change name before pushing button to download!

Post by Tom, Tech Support » Fri Mar 08, 2019 12:24 pm

Yes, unfortunately in this case, you will have to move/rename the file after it has been downloaded. Or, you could try iMacros in a different browser (Firefox or IE) to see if it gives you a different result.
Regards,

Tom, iMacros Support
Post Reply