| View previous topic :: View next topic |
| Author |
Message |
jonathan2260
Joined: 13 May 2008 Posts: 7
|
Posted: Sun May 18, 2008 3:29 pm Post subject: Grabbing info from an email |
|
|
Hello
I"m trying to grab information from emails to put them in variables.
Under this link, http://www.autohotkey.com/forum/viewtopic.php?t=31783
someone pointed out to me which commands could be useful to get the information without resorting to mouse positions.
My script works fine for mouse positions for myself but as soon as I tried to give it to a work colleague for him to try, it would not work because his outlook screen positions are different from mine.
I'm trying to figure it out but I'm not a programmer and I'm feeling lost trying to understand these commands so help would be greatly appreciated.
Basically I get work forms in an email format and I'm sending them into a ticket system using autohotkey.
Here's what it looks like a bit (edited to avoid conflict with employer)
Incident ID: xxxxxxxxxx
Store Number: xxxxx
Site ID: xxxxx
Contact Name: xxxxx
Open Time xx/xx/xx xx:xx:xx
Opened By: xxxxxx
How would I get it to grab the information (where it's all x in this example) in a way to make sure positions don't matter.
Is there any examples I can follow or can someone supply me with one with details of what the commands do?
Thanks for the help. |
|
| Back to top |
|
 |
n-l-i-d Guest
|
|
| Back to top |
|
 |
keybored
Joined: 18 Jun 2006 Posts: 90 Location: Phoenix, AZ
|
Posted: Sun May 18, 2008 4:27 pm Post subject: meet grabby (well part of him) |
|
|
jonathan,
Just so happens I am working on the same problem.
The code below works for non HTML emails if they contains CWP or UID (my work sends emails with this Universal ID etc...). I loop through the possible controls and update my variable when I hit a match. I am changing this to use StringLen to be more universal but I don't have Outlook at home so I have to finish later.
| Code: | if (v_WinClass = "rctrl_renwnd32") ; if outlook active
{
var1 = 1
Loop, 6
{
ControlGetText, v_EmailData, RichEdit20W%var1%, A
if v_EmailData Contains CWP,UID
{
v_GrabbedData = %v_EmailData%
break
}
var1 := (var1 + 1)
}
}
msgbox, %v_GrabbedData% |
|
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1206 Location: USA
|
Posted: Sun May 18, 2008 4:36 pm Post subject: |
|
|
I just started some MS Office automation functions.....they can be found Here
I just added Outlook_GetMessageText()..... You could use that combined with RegExMatch to get the info you need..... You may also want to see my post here....It shows how to automate Internet Explorer via COM, so that you will be able to make your script robust. _________________
 |
|
| Back to top |
|
 |
keybored
Joined: 18 Jun 2006 Posts: 90 Location: Phoenix, AZ
|
Posted: Sun May 18, 2008 4:46 pm Post subject: many thanks |
|
|
ahklerner, It occurs to me he didn't say he has Outlook.
I will dig into your functions. I am making a tool for aggregating lots of emailed data we receive at work. |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1206 Location: USA
|
Posted: Sun May 18, 2008 5:04 pm Post subject: Re: Grabbing info from an email |
|
|
| jonathan2260 wrote: | | ...because his outlook screen... |
_________________
 |
|
| Back to top |
|
 |
keybored
Joined: 18 Jun 2006 Posts: 90 Location: Phoenix, AZ
|
Posted: Sun May 18, 2008 5:51 pm Post subject: that outlook |
|
|
Yep that's a good sign
Tried your code remotely logged in from work. It is a limitation that the window has to be open. My code works either way, which was a happy surprise really, because I didn't plan for it. Of course it may break if something in the environment changes.
Anyway thanks for the help I will be using those tools for sure. |
|
| Back to top |
|
 |
|