AutoHotkey Community

It is currently May 26th, 2012, 5:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: July 15th, 2008, 8:03 pm 
Offline

Joined: July 15th, 2008, 7:50 pm
Posts: 1
I am trying to develop a script that copies specific text from emails I receive in a set format. However, I am a AHK newbie....so some guidance would be appreciated. The emails come in from a sendmail form and look something like this (there is more info of course):

------
Name - John Doe
Emp (No) - 20302022
J&B - Tall
------

I'd like to copy JUST the data (John Doe, 20302022, Tall) into an Excel worksheet (already created) in the (next available) empty row into the appropriate columns. So I have an excel file that has already been formatted I just want it to copy the form info into the correct columns in the next available row.

I started by having AHK recognize the window for outlook based on the inbox name (which means it's already open and set to the inbox). Then I used MouseClick and ClickDrag to highlight the text. I realize these are based on fixed positions and may cause some trouble down the line (should I resize the different viewing panes, etc.).

Any input on how to approach this? Specifically - how can I have the data copied? How do I get AHK to recognize an email msg with a specific title? Can I create a loop to go through multiple e-mails with the same title and input the data into excel in subsequent rows? How do I get excel to copy data into specific rows/columns?

Thanks for your help!!

-A

p.s. Moderators, please delete the duplicate msg posted by guest. I thought I was logged in. My mistake.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Options
PostPosted: August 1st, 2008, 9:34 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
You can use Excel/Outlook VBA as well to do this.

Basic psuedocode:

Select all text in message
Parse text, retain only right hand tokens after the "-"

Switch to excel
Find last blank cell in range
Paste values

As for ahk, you could copy the text (use Home and END + Ctrl C to copy all). i.e. use keyboard shortcuts versus mouse movements to ensure it works always.

and search & replace new lines with TAB
and search & replace all record delimiters with newline

and paste in excel, it will automatically get put in different columns then.

If you post a full email and your excel file might be easier to work out the code.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 22nd, 2009, 11:22 am 
Offline

Joined: February 22nd, 2009, 11:13 am
Posts: 4
Hey,

I can't see that this one ever got answered but I have a similar problem that I've now spent HOURS looking for a solution to....

Maybe this is staring me in the face, but my knowledge of scripting at this point would fit on a the back of a postage stamp!

Basically, I have an automatically generated plain text email that contains the recipient's email address in the message body between two brackets ,eg (your.name@company.com) which I need to find, cut out, delete the remaining empty brackets, and then tab back to the 'To' field, and paste the extracted email address.

I'm afraid my ability to search within an active window for a text variable between two constant symbols is not there yet.....but I'm sure somebody knows how to do it?

Here's hoping......
Thanks in advance!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Sample
PostPosted: February 23rd, 2009, 7:54 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
Please provide sample Input, with Desired Output


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 23rd, 2009, 1:36 pm 
Offline

Joined: February 22nd, 2009, 11:13 am
Posts: 4
Hi

I'm working along the lines of: -

1. Highlight (without opening) an email in the Outlook Inbox.

LControl & RControl::
Send, {ALTDOWN}w{ALTUP}{TAB 3}{SHIFTDOWN}{DOWN 8}{SHIFTUP}{DEL} ; This removes the Outlook forwarding text (Date, etc.) from the top of the message

...now I need to insert some script to find the first round bracket '('....then...

{SHIFTDOWN}scroll forward, selecting all text until it finds the closing bracket ')' {SHIFTUP}{CTRLDOWN}x{CTRLUP}
{BACKSPACE}{DEL} ; To delete the brackets that remain (if they do!)

Then tab back up to the 'To' field and paste in the text from the clipboard....

{SHIFTDOWN}{TAB 3}{SHIFTUP}{CTRLDOWN}v{CTRLUP}
return

....plus I'd also add {DEL} entries to delete the brackets from the 'To' field if they were cut as part of the required syntax.

Thanks again in advance for any help!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2009, 1:32 pm 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
If you know regex, try this

http://www.autohotkey.com/docs/commands/RegExMatch.htm

you can use this tool to help you create the appropriate regex

http://www.gskinner.com/RegExr/

try this topic as well to extract text

http://www.autohotkey.com/forum/topic35597.html

search the forums, text manipulation is a common question, and with a bit of diligence i'm sure you'll get there, you've made good progress.

post your script in code blocks to make it easier to read and copy/paste... so that i can try what you have written


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 26th, 2009, 9:01 pm 
Offline

Joined: February 22nd, 2009, 11:13 am
Posts: 4
Thanks again for the response vixay. I have to say that I think my problem is that I just can't interpret the examples posted for RegEx usage. Following your response though, I have at least found another site (http://www.regular-expressions.info/) that has posted the RegEx string syntax to find email addresses, which is: -

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

...so I feel that we're getting there, slowly.

Unfortunately I don't know how to use this with RegEx. I'm going to persevere with my searches, but if anybody can point me in the right direction in the meantime then that would be teriffic!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: posting code blocks
PostPosted: February 26th, 2009, 9:02 pm 
Offline

Joined: February 22nd, 2009, 11:13 am
Posts: 4
Oh yeah, how do I post my script in "code blocks"?

cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 5:10 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
Hit the "code" button when you compose your message to start a block, hit again to end, or type text as below.
[code]Your Text Here[/code]

You should also provide your sample input so that i can test any solutions i come up with


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 15th, 2011, 8:49 am 
I regularly get mails which are in paragraph and i need to paste it to specified template format in excel. so how can i do it easily and can i get code to copy the complete mail and paste it in excel which directly gets converted to required template format.

Any help for this query..


Report this post
Top
  
Reply with quote  
 Post subject: Re: Sample
PostPosted: September 22nd, 2011, 5:56 pm 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
vixay wrote:
Please provide sample Input, with Desired Output

^^


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Miguel and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group