Sample Code Please: Find Link and click on it: WebPage
Moderators: JRL, Dorian (MJT support)
Sample Code Please: Find Link and click on it: WebPage
Is it possilbe for someone to display some sample code for me?
I want to automate the task of printing invoices that are sent to me via email.
I know how to log into my email account, but want I do not know how to do is to click on a specfic email with a certain topic, then open that email and click on a link in that email.
When someone buys one of my products, I get an email and I usually go to that email, click on the link in that email and I print the inovice as that link takes me directly to a invoice page.
The subject of the email goes like this
"New Order ID:34352234xxxx"
Then I open up the email, and there is a link that says
"To New Order ID:xxxxxxxxxx click here"
Can someone please show me a sample script that will look for the subject "New Order ID"
and click on the link "To New Order ID"
Thank you!
________
TF101
I want to automate the task of printing invoices that are sent to me via email.
I know how to log into my email account, but want I do not know how to do is to click on a specfic email with a certain topic, then open that email and click on a link in that email.
When someone buys one of my products, I get an email and I usually go to that email, click on the link in that email and I print the inovice as that link takes me directly to a invoice page.
The subject of the email goes like this
"New Order ID:34352234xxxx"
Then I open up the email, and there is a link that says
"To New Order ID:xxxxxxxxxx click here"
Can someone please show me a sample script that will look for the subject "New Order ID"
and click on the link "To New Order ID"
Thank you!
________
TF101
Last edited by adivarup on Wed Feb 02, 2011 12:34 pm, edited 1 time in total.
This may not be exactly what you are asking for, but.....
I have scripts that take orders from websites for customers by
1. creating an email inbox like [email protected],
2. use RetrievePOP3 to pull the order files (in .txt format) to a folder.
You could then write a script to strip out the link, Open IE to that link and print your invoice.
OR you could create a rule in your email system to sort out any email with "ORDER ID" in the subject line to a different folder than your other emails. Then write the script to strip out the link you need to open.
These methods would be easier than trying to click-through your email interface to pick out just the emails you need to process.
I have scripts that take orders from websites for customers by
1. creating an email inbox like [email protected],
2. use RetrievePOP3 to pull the order files (in .txt format) to a folder.
You could then write a script to strip out the link, Open IE to that link and print your invoice.
OR you could create a rule in your email system to sort out any email with "ORDER ID" in the subject line to a different folder than your other emails. Then write the script to strip out the link you need to open.
These methods would be easier than trying to click-through your email interface to pick out just the emails you need to process.
Thanks for your response.
Yes, its sounds like your way will be easier. But I still have the issue of picking pulling the link from the email and clicking on it to open up to a new window.
I would still like to know how to make it work for the method I have in mind. Your idea is very helpful but understanding this task helps me with a a few other things.
thanks
________
WEB SHOWS
Yes, its sounds like your way will be easier. But I still have the issue of picking pulling the link from the email and clicking on it to open up to a new window.
I would still like to know how to make it work for the method I have in mind. Your idea is very helpful but understanding this task helps me with a a few other things.

thanks
________
WEB SHOWS
Last edited by adivarup on Sat Aug 13, 2011 3:07 pm, edited 1 time in total.
Hi,
If someone has a quick second, would you mind helping me on this.
Thank you!
________
BMW 802 history
If someone has a quick second, would you mind helping me on this.
Thank you!
________
BMW 802 history
Last edited by adivarup on Wed Feb 02, 2011 12:35 pm, edited 1 time in total.
Hi, thanks for your response.
My client? I am using a webmail interface, like hotmail.
________
hot box vape
My client? I am using a webmail interface, like hotmail.
________
hot box vape
Last edited by adivarup on Wed Feb 02, 2011 12:36 pm, edited 1 time in total.
Sorry, I'd help if I could but I have no knowledge in that realm. I've never used a web based email so I set up an account a few minutes ago and sent myself a message, viewing source shows nothing and beyond manipulating text (which doesn't appear to be possible) I don't know how to begin.
Seems like WebRecorder might be an option though I've never used that either so again I'm no help.
Can you set up pop3 to download from your web based email? It appears that google mail has pop3 capabilities.
Good luck,
Dick
Seems like WebRecorder might be an option though I've never used that either so again I'm no help.
Can you set up pop3 to download from your web based email? It appears that google mail has pop3 capabilities.
Good luck,
Dick
JRL
Do you have some sample code you can share with me where you are reading your pop3 email, going to a message and clicking on the hyperlink in that message. I can change over to pop3 if that is the case.
________
Ferrari P specifications
Do you have some sample code you can share with me where you are reading your pop3 email, going to a message and clicking on the hyperlink in that message. I can change over to pop3 if that is the case.
________
Ferrari P specifications
Last edited by adivarup on Wed Feb 02, 2011 12:36 pm, edited 1 time in total.
OK, this is quick and dirty and no guarantees that the code will be correct, I have not tested it.
I use Pegasus Mail as my POP3 client. When I receive a new email message it not only shows up in the client, it shows up in C:\PMAIL\MAIL\DICK as a file named xxxxxxxx.CNM. You could also use Macro Scheduler's POP3 client to create files with names of your choice in a directory of your choice as Paul (SkunkWorks) pointed out earlier. You can then parse the txt in the POP3 received message to acquire your URL. Here is a sample email that I sent to myself with your "To New Order ID:1234567890 click here" text as the "link" to the mjtnet URL. In the email client it would show up as:
To New Order ID:1234567890 click here
however the raw file looks like this:
Return-Path:
Received: from [192.168.0.137]
by mail.myserver.com (8.9.3/8.9.2) with ESMTP id RAA24435
for ; Tue, 28 Mar 2006 17:03:48 -0600
From: "My Name"
To: myname(at)myserver.com
Date: Tue, 28 Mar 2006 15:58:25 -0600
MIME-Version: 1.0
Subject: URL test
Reply-to: myname(at)myserver.com
Message-ID:
Priority: normal
X-mailer: Pegasus Mail for Windows (4.31)
Content-type: text/html; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
X-PM-PLACEHOLDER: .
To New Order ID:1234567890 click here
What I would do next is loop through and read each new .CNM file, looking for the line that contains the text "To New Order ID:1234567890 click here". this line will also contain the URL. Since the order number will be different each time, I'd limit the search to "To New Order ID:" One possible problem would be if this string shows up in the subject line as well as the body of the message. I'm not going to worry about that for this example.
The code for one iteration could look something like this: (as I said this is untested)
ReadFile>C:\pmail\mail\dick\xxxxxxxx.CNM,filetext
Separate>filetext,%CRLF%,var
Let>k=0
Repeat>k
add>k,1
Let>line=var_%k%
separate>line,To New Order ID:,linetest
If>%linetest_count%>1
Separate>line,",URLfind
Let>kk=0
Repeat>kk
add>kk,1
Let>URL=URLfind_%kk%
Midstr>URL,1,4,test
If>test=http,found
Until>kk,URLfind_count
EndIF
Until>k,var_count
Label>found
MDL>do something with variable %URL%
See help for HTTPRequest> to see how to use the variable "URL" to call the website.
Hope this is useful,
Dick
I use Pegasus Mail as my POP3 client. When I receive a new email message it not only shows up in the client, it shows up in C:\PMAIL\MAIL\DICK as a file named xxxxxxxx.CNM. You could also use Macro Scheduler's POP3 client to create files with names of your choice in a directory of your choice as Paul (SkunkWorks) pointed out earlier. You can then parse the txt in the POP3 received message to acquire your URL. Here is a sample email that I sent to myself with your "To New Order ID:1234567890 click here" text as the "link" to the mjtnet URL. In the email client it would show up as:
To New Order ID:1234567890 click here
however the raw file looks like this:
Return-Path:
Received: from [192.168.0.137]
by mail.myserver.com (8.9.3/8.9.2) with ESMTP id RAA24435
for ; Tue, 28 Mar 2006 17:03:48 -0600
From: "My Name"
To: myname(at)myserver.com
Date: Tue, 28 Mar 2006 15:58:25 -0600
MIME-Version: 1.0
Subject: URL test
Reply-to: myname(at)myserver.com
Message-ID:
Priority: normal
X-mailer: Pegasus Mail for Windows (4.31)
Content-type: text/html; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
X-PM-PLACEHOLDER: .
To New Order ID:1234567890 click here
What I would do next is loop through and read each new .CNM file, looking for the line that contains the text "To New Order ID:1234567890 click here". this line will also contain the URL. Since the order number will be different each time, I'd limit the search to "To New Order ID:" One possible problem would be if this string shows up in the subject line as well as the body of the message. I'm not going to worry about that for this example.
The code for one iteration could look something like this: (as I said this is untested)
ReadFile>C:\pmail\mail\dick\xxxxxxxx.CNM,filetext
Separate>filetext,%CRLF%,var
Let>k=0
Repeat>k
add>k,1
Let>line=var_%k%
separate>line,To New Order ID:,linetest
If>%linetest_count%>1
Separate>line,",URLfind
Let>kk=0
Repeat>kk
add>kk,1
Let>URL=URLfind_%kk%
Midstr>URL,1,4,test
If>test=http,found
Until>kk,URLfind_count
EndIF
Until>k,var_count
Label>found
MDL>do something with variable %URL%
See help for HTTPRequest> to see how to use the variable "URL" to call the website.
Hope this is useful,
Dick
Last edited by JRL on Wed Mar 29, 2006 2:33 pm, edited 1 time in total.
Thanks for the response on this.
I will play around with it...
Is there a way to find a Hyperlink on a page by partial name then then click on it?
________
medical marijuana patient
I will play around with it...
Is there a way to find a Hyperlink on a page by partial name then then click on it?
________
medical marijuana patient