Is there a way to have Webrecorder/IE library save a image that is on a page

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
redcloud
Newbie
Posts: 3
Joined: Sat May 19, 2018 8:38 pm

Is there a way to have Webrecorder/IE library save a image that is on a page

Post by redcloud » Sat May 19, 2018 8:53 pm

I want to know is there a function that comes with Webrecorder/IE library to download images that appear on a web page. I know I can do this with the screenshot and save it that way or something to that effect, but that would require the page to be in view. I want to do it with the Webrecorder because then it can actually control the page and do everything it needs to be done in the background while I am still working on my computer without it having to take over my computer. So I want to know can Web Recorder do a Save As, and save the image in the background like it handles all of the other functions? Or can I RegEx the url of the image and have it download the image that way. I can't do it via HTTPREQUEST because the user has to be logged in and on a browser to download the images so it has to be down from the same Internet Explorer session that loaded the pictures.

Also I wanted to know if you IEShowIE does the commands you send to the window continue to function? Or does hiding it pause all internet connections to it until its shown again?

Also I want to know that if I use IECreate to do something like this IECreate>IE[50] will the instance be called 50? so if i do it again IECreate>IE[20] right after that, can i then call either 50 or 20 when i want until its closed? or is it always going to be in order? Can i do IECreate>myownname instead of sticking ith the IE[] theme?

redcloud
Newbie
Posts: 3
Joined: Sat May 19, 2018 8:38 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by redcloud » Sun May 27, 2018 4:31 pm

Anyone have any ideas?

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by Marcus Tettmar » Mon Jun 04, 2018 2:57 pm

You would probably have to simulate a right click and Save As on the image. You can probably determine the X,Y position with IEGetTagPos and use that to send a mouse move, rclick and then handle the Save As. Or use Image Recognition to do same.

Alternatively extract the tag/parse the html to find the URL of the image and attempt to retrieve it directly with HTTPRequest. However,as you say, there probably needs to be an active session, so unless the session vars can be passed on the URL or in headers, this may not be possible.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by nodochau » Fri Mar 27, 2020 11:28 pm

Hi Marcus,
That is my project for now. I want to save the product image of the seller on Amazon. I think the idea of find the position of the object then move mouse and do a save as. But can you give me an example? I am stuck with IEGetTagPos command. If you see the attached picture, I can find the tag of the title but don't know how to find the position of the image.
Please help.
Thanks a lot
Image

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by Marcus Tettmar » Sat Mar 28, 2020 8:34 am

Instead of doing that I would look at extracting the url from the source of the image and then retrieving it and saving to file with HTTPRequest. Should be able to do that with the IE/Edge/Chrome functions.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by nodochau » Sat Mar 28, 2020 6:53 pm

Marcus Tettmar wrote:
Sat Mar 28, 2020 8:34 am
Instead of doing that I would look at extracting the url from the source of the image and then retrieving it and saving to file with HTTPRequest. Should be able to do that with the IE/Edge/Chrome functions.
And Marcus,
If I can find the urls of images then how can I save them as images instead of the urls?
Thanks

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by Grovkillen » Sat Mar 28, 2020 6:54 pm

nodochau wrote:
Sat Mar 28, 2020 6:53 pm
Marcus Tettmar wrote:
Sat Mar 28, 2020 8:34 am
Instead of doing that I would look at extracting the url from the source of the image and then retrieving it and saving to file with HTTPRequest. Should be able to do that with the IE/Edge/Chrome functions.
And Marcus,
If I can find the urls of images then how can I save them as images instead of the urls?
Thanks
Use the command Marcus referred to, HTTPRequest.
Let>ME=%Script%

Running: 15.0.24
version history

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by nodochau » Sun Mar 29, 2020 6:59 pm

Grovkillen wrote:
Sat Mar 28, 2020 6:54 pm
nodochau wrote:
Sat Mar 28, 2020 6:53 pm
Marcus Tettmar wrote:
Sat Mar 28, 2020 8:34 am
Instead of doing that I would look at extracting the url from the source of the image and then retrieving it and saving to file with HTTPRequest. Should be able to do that with the IE/Edge/Chrome functions.
And Marcus,
If I can find the urls of images then how can I save them as images instead of the urls?
Thanks
Use the command Marcus referred to, HTTPRequest.
I know it but how? Cause I am new with this topic.
Example I have this link of the image which I found from extracting text : https://m.media-amazon.com/images/I/61L ... 8_ML3_.jpg
Please give me an example...:)

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by nodochau » Sun Mar 29, 2020 7:08 pm

nodochau wrote:
Sun Mar 29, 2020 6:59 pm
Grovkillen wrote:
Sat Mar 28, 2020 6:54 pm
nodochau wrote:
Sat Mar 28, 2020 6:53 pm

And Marcus,
If I can find the urls of images then how can I save them as images instead of the urls?
Thanks
Use the command Marcus referred to, HTTPRequest.
I know it but how? Cause I am new with this topic.
Example I have this link of the image which I found from extracting text : https://m.media-amazon.com/images/I/61L ... 8_ML3_.jpg
Please give me an example...:)
Yes, I got it.
Thanks a lot for your info.

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by Grovkillen » Sun Mar 29, 2020 7:16 pm

Code: Select all

Let>URL=https://m.media-amazon.com/images/I/61L4YoMBDmL._AC_UY218_ML3_.jpg

GoSub>DOWNLOAD_IMAGE,URL,test.jpg

SRT>DOWNLOAD_IMAGE
  Let>DOWNLOAD_TO=%DESKTOP_DIR%\%DOWNLOAD_IMAGE_Var_2%
  HTTPRequest>DOWNLOAD_IMAGE_Var_1,DOWNLOAD_TO,GET,,,,,,
END>DOWNLOAD_IMAGE
So simply give the sub routine the URL + a file name and it will (in this example) download it to your desktop.
Let>ME=%Script%

Running: 15.0.24
version history

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Is there a way to have Webrecorder/IE library save a image that is on a page

Post by nodochau » Mon Mar 30, 2020 12:04 am

Thanks. I got it worked.
Beautiful.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts