Automating Order Retrieval from Website (1 Viewer)

RogerCooper

Registered User.
Local time
Today, 07:46
Joined
Jul 30, 2014
Messages
277
I would like to automate the following task.

1. Login to website
2. If there any orders in the inbox, select them all
3. Click the print preview button on the site
4. Save the document as a PDF
5. E-mail the PDF
6. Click the delete button on the site.

I was thinking of using VBA with automation object for Internet Explorer. Is this the right way to go or should I be using a different approach entirely?
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:46
Joined
Jul 9, 2003
Messages
16,245
I note your question has yet to receive a reply, so I thought I would give it a bump....

I didn't answer yesterday because I couldn't think of anything, except to ask you if the website has api interface...

In any event, I don't think there's a simple answer to your question...
 

jleach

Registered User.
Local time
Today, 10:46
Joined
Jan 4, 2012
Messages
308
There's a few ways to do it. An API is the best (as APIs are built specifically for the purpose of getting data programmatically), but not always available (as a side note, it's often illegal to use programming to scrape websites: ESPN and Yahoo stock tickers, for example: if you read the TOS they forbid it).

Anyway, barring an API, you can use IE automation through VBA. There's decent enough support to it. This is the only decent place I know of for information to get started with it: http://www.utteraccess.com/wiki/Access_and_the_web_HTML_Object_Library

If you want to get outside of VBA, you might look at something like iMacros: https://imacros.net/overview/
 

sxschech

Registered User.
Local time
Today, 07:46
Joined
Mar 2, 2010
Messages
791
If an API is not available, another option is autohotkey which can record keystrokes, mouse movements and clicks. However, this method would only work if the steps outlined can be done via keyboard or the exact position of the items on the web page to click on never change because recording mouse locations rely on a coordinate, so the click event would take place at position x, y. If that changes due to window size or resolution, the click event coordinate would happen and the button would not be clicked for example. Another issue is if there is a delay between clicking or keyboard actions. As long as the time interval is consistent it would work as pausing/timing can be coded, but if you can't anticipate the timing, such as today it takes 2 seconds before the next step and tomorrow it takes 8 seconds, the actions will continue and be out of sync. Due to the websites that I need to automate tasks with, I've used it as part of the process since I found that I can't rely on consistency for the entire process, but is still better automating 50% than having none at all.

https://www.autohotkey.com/
 

jleach

Registered User.
Local time
Today, 10:46
Joined
Jan 4, 2012
Messages
308
sxschech - you should take a look at iMacros. It's very similar (at least in this feature) to autohotkeys, but has far better support for web (such as waiting until the page is loaded before moving on to the next step, etc).

There's a nice bit of programmability to it as well. You can record macro-style (like AHK or Excel macros), you can script it out (fairly simple scripting language: wait for X page to load, then find this element ID, send XYZ keys, find submit button, press it, etc), download data from tables as files, etc.

It's not free, but it is a pretty nice tool. I got involved with it a few years ago downloading patient and staff schedules from an EMR website that didn't have an API and we've been running it since every 10 minutes on an automated server via FireFox - pretty solid.
 

Mark_

Longboard on the internet
Local time
Today, 07:46
Joined
Sep 12, 2017
Messages
2,111
For myself, I didn't reply because the solution I have isn't easy to do.

I'd work on reading in the source HTML to identify what files there are. That way you could also look at the code the page uses to print/delete reports.

I am guessing it uses a file dialog to specify where you save to, but I'm not sure how to automate that unless you know exactly which interface it uses.

For the emailing, that is pretty easy once you know where the file is. The rest, not so much.

How often is this done? Your looking at a fairly extensive time investment. Is it worth it?
 

RogerCooper

Registered User.
Local time
Today, 07:46
Joined
Jul 30, 2014
Messages
277
How often is this done? Your looking at a fairly extensive time investment. Is it worth it?
This is done multiple times a day, so automation is worthwhile. In addition, some customers want us to login each day for orders, so learning how to automate is useful.

Thanks to everyone for their suggestions.
 

Users who are viewing this thread

Top Bottom