Auto click "Save As" button (SOLVED)

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
ato09
Posts: 5
Joined: Tue Oct 31, 2017 5:20 pm

Auto click "Save As" button (SOLVED)

Post by ato09 » Tue Oct 31, 2017 5:37 pm

iMacros (8.44) + Browser (Chrome 61.0.3163.100 (Official Build) (32-bit)) + OS (Windows 7 Ultimate)

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO={{!COL2}} 
ONDOWNLOAD FOLDER=C:\Users\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM

TAB CLOSE
The macro stuck at the save as pop-up. Is there anyway to automate clicking the save as? I've tried event=click and even keypress but failed. Any advice? Thanks.
Last edited by ato09 on Thu Nov 02, 2017 6:20 am, edited 1 time in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Auto click "Save As" button

Post by chivracq » Tue Oct 31, 2017 5:58 pm

ato09 wrote:iMacros (8.44) + Browser (Chrome 61.0.3163.100 (Official Build) (32-bit)) + OS (Windows 7 Ultimate)

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO={{!COL2}} 
ONDOWNLOAD FOLDER=C:\Users\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM

TAB CLOSE
The macro stuck at the save as pop-up. Is there anyway to automate clicking the save as? I've tried event=click and even keypress but failed. Any advice? Thanks.
Try adding a mini-'WAIT' Statement (0.5 or 1 sec) after the 'SAVEITEM', before the 'TAB CLOSE'... :idea:
Hum..., even if the '!REPLAYSPEED'="MEDIUM" is already equivalent to a 'WAIT=1 sec'... :?

Post one URL otherwise and I can have a look...
- (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...
ato09
Posts: 5
Joined: Tue Oct 31, 2017 5:20 pm

Re: Auto click "Save As" button

Post by ato09 » Tue Oct 31, 2017 6:12 pm

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO=https://glodimg.chinabrands.com/pdm-product-pic/Clothing/2017/06/03/source-img/20170603175241_21313.jpg
ONDOWNLOAD FOLDER=C:\Users\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM

TAB CLOSE
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Auto click "Save As" button

Post by chivracq » Tue Oct 31, 2017 6:59 pm

ato09 wrote:

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO=https://glodimg.chinabrands.com/pdm-product-pic/Clothing/2017/06/03/source-img/20170603175241_21313.jpg
ONDOWNLOAD FOLDER=C:\Users\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM

TAB CLOSE
Ah...!, OK for the URL, but did you try the mini-'WAIT' Statement...?
- (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...
ato09
Posts: 5
Joined: Tue Oct 31, 2017 5:20 pm

Re: Auto click "Save As" button

Post by ato09 » Tue Oct 31, 2017 10:14 pm

I did tried this as you suggested but it still stuck at save as dialog window. It got stuck at line 12.

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO=https://glodimg.chinabrands.com/pdm-product-pic/Clothing/2017/06/03/source-img/20170603175241_21313.jpg
ONDOWNLOAD FOLDER=C:\Users\SUHARTO-DELL\Pictures\AP_shop\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM
WAIT SECONDS=1

TAB CLOSE
ato09
Posts: 5
Joined: Tue Oct 31, 2017 5:20 pm

Re: Auto click "Save As" button

Post by ato09 » Wed Nov 01, 2017 8:48 pm

Anything that I changed after line 12 are useless as it's always stuck at the windows save dialog.

Code: Select all

TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM
I've tried changing it to this. (HREF->SRC) Thinking that it might be the problem but to no avail.

Code: Select all

TAG POS=1 TYPE=IMG ATTR=SRC:https://*.jpg CONTENT=EVENT:SAVEITEM
I can't find anything similar problem from my google searches. Help please.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Auto click "Save As" button

Post by chivracq » Wed Nov 01, 2017 10:47 pm

ato09 wrote:I did tried this as you suggested but it still stuck at save as dialog window. It got stuck at line 12.

Code: Select all

VERSION BUILD=844 RECORDER=CR

TAB OPEN
TAB T=2
SET !DATASOURCE savepicture.csv
SET !ERRORIGNORE YES
SET !LOOP 1

set !replayspeed medium
URL GOTO=https://glodimg.chinabrands.com/pdm-product-pic/Clothing/2017/06/03/source-img/20170603175241_21313.jpg
ONDOWNLOAD FOLDER=C:\Users\SUHARTO-DELL\Pictures\AP_shop\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM
WAIT SECONDS=1

TAB CLOSE
Yep, but disable the '!ERRORIGNORE' to catch any RuntimeError...
ato09 wrote:Anything that I changed after line 12 are useless as it's always stuck at the windows save dialog.

Code: Select all

TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM
I've tried changing it to this. (HREF->SRC) Thinking that it might be the problem but to no avail.

Code: Select all

TAG POS=1 TYPE=IMG ATTR=SRC:https://*.jpg CONTENT=EVENT:SAVEITEM
I can't find anything similar problem from my google searches. Help please.
Yep, sorry you reacted a bit late after my last Reply, a few new Threads came to the Forum and I was busy with some Social Life, ah-ah...!

But OK, I tested your Script, and it works for me in its simplest form:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1

'set !replayspeed medium
URL GOTO=https://glodimg.chinabrands.com/pdm-product-pic/Clothing/2017/06/03/source-img/20170603175241_21313.jpg
'ONDOWNLOAD FOLDER=C:\Users\SUHARTO-DELL\Pictures\AP_shop\men_tshirt FILE={{!COL1}}.jpg WAIT=yes
'ONDOWNLOAD FOLDER=C:\Users\SUHARTO-DELL\Pictures\AP_shop\men_tshirt FILE=_Forum_ato09_#01.jpg WAIT=yes
ONDOWNLOAD FOLDER="D:\\TEMP\\iMacros\\Temp (Last Backup - 2015-12-09)\\_Forum Cases\\ato09" FILE=_Forum_ato09_#03.jpg WAIT=yes

TAG POS=1 TYPE=IMG ATTR=HREF:https://*.jpg CONTENT=EVENT:SAVEITEM
'WAIT SECONDS=1
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10_x32.)

As you can see, it even works with '!REPLAYSPEED' + the 'WAIT' Statement both deactivated...
But the Folder where you want to save the Pix needs to exist preamble to running the Script..., I thought it would be created when I first tried to use your own "C:\Users\SUHARTO-DELL\...", but I got some RuntimeError about "Access denied to that Folder...", but it works fine if I link to some existing Folder...

OK, just to be sure, I tested as well on CR with the exact same simplified Script and it works fine as well, hum, the 'TAG' + 'SAVEITEM' takes 3-5 sec on CR while instant on PM, but it still works...
=> Tested on iMacros for CR v8.4.4, CR Version 61.0.3163.100 (Official Build) (64-bit), Win10_x64.
- (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...
ato09
Posts: 5
Joined: Tue Oct 31, 2017 5:20 pm

Re: Auto click "Save As" button

Post by ato09 » Thu Nov 02, 2017 12:14 am

Thank you so much!!! Although the solution that you gave doesn't fix it, but I got an idea where the problem arise. It seem that in the download section of the chrome itself, I just need to turn off the "Ask where to save each file before downloading". And that fixed it. The code worked just like it should have been. Thank you so much for your time to reply to my post. :D :D :D
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Auto click "Save As" button

Post by chivracq » Thu Nov 02, 2017 3:45 am

ato09 wrote:Thank you so much!!! Although the solution that you gave doesn't fix it, but I got an idea where the problem arise. It seem that in the download section of the chrome itself, I just need to turn off the "Ask where to save each file before downloading". And that fixed it. The code worked just like it should have been. Thank you so much for your time to reply to my post. :D :D :D
OK, good to know indeed, and glad you managed to solve it...

I actually only installed CR just a few weeks ago, completely Standard, and only for the Forum, I didn't tweak anything (well, yet...!, I don't like the auto-Updates without asking me anything, grrr...!), but good that you found the "Trigger" for a Solution... :D

Stg else I had forgotten to mention was that both FF and CR "complained" about the Site being Unsafe and I had to add some Domain Certificate Exception, but that's strangely often/nearly always the case with Chinese Sites, either (American...?) Browsers don't trust them, or most Chinese Sites indeed have some Hacking Tools trying to spy on the User as soon as some Page is loaded... I'll check the Source, this happens nearly every time I try to check some Chinese Site, a bit strange I would think... :?
- (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...
Post Reply