Jump to content
Macro Express Forums

How to copy specific values from email


macrolearningcurve
 Share

Recommended Posts

Hi

 

I am n00b in scripting. So far only used Macro Express's capture function.

I wish to copy some of the form value in email.

Example of the email as below

 

Firefox Window

Gmail

Email Content

 

First name : ABC

Last Name : ZXC

Email : what@hotmail

Country : UK

 

How can I achieve this?

1, Copy (Using ctrl-c ) the value behind "first name "

2, Copy the value behind "last name :"

3, Copy the value behind "Email :"

 

I am using Arsclip, so I can store up to 10 ctrl-c.

 

Please list out the steps I need to achieve it.

Or keywords I can use to search for example in this forum

Or articles that i can learn about this.

 

Appreciate your time

Thanks

 

Tim

Link to comment
Share on other sites

There are a couple of approaches. I usually will copy the entire page contents to the clipboard, read it into a variable, and parse out the chunks by finding markers like “To:”. If this sounds to intimidating you can tab thru the page and assuming they are al in fields you can grab the text. Or you can use the CTRL+F method and Tab > Shift+Tab. But if they are not in fields the easiest way was the first idea I mentioned.

 

I was assuming that you are using a web based email. If not you can look at using controls to grab fields. I have a macro that disposes of email in Outlook to a file server and it grabs the date, subject and other info to create the file name.

Link to comment
Share on other sites

  • 1 year later...
There are a couple of approaches. I usually will copy the entire page contents to the clipboard, read it into a variable, and parse out the chunks by finding markers like “To:”. If this sounds to intimidating you can tab thru the page and assuming they are al in fields you can grab the text. Or you can use the CTRL+F method and Tab > Shift+Tab. But if they are not in fields the easiest way was the first idea I mentioned.

 

I was assuming that you are using a web based email. If not you can look at using controls to grab fields. I have a macro that disposes of email in Outlook to a file server and it grabs the date, subject and other info to create the file name.

 

 

Would you be able to give an example on how to parse out the cunks by finding the markers? and the macro you have sounds very interesting as well ! :P Thank you!

Link to comment
Share on other sites

Would you be able to give an example on how to parse out the cunks by finding the markers? and the macro you have sounds very interesting as well ! :P Thank you!

I'm not Cory (he doesn't monitor the ME3 boards anymore, to my knowledge), so his method may differ from mine, but I might use features such as

"Set Integer from position of text in Variable" to locate the To:, then use copy to clipboard starting at that Integer and copying over a specific number

of characters from that point. You'll need some logic to determine the exact number of spaces, and you'll need to modify the original integer in order

to prevent the "To:" from being copied as well, but that's the general idea.

 

Something like this:

 

Example email header:

To: Captain Caveman

From: Jean Gray

 

Example macro:

Clipboard Copy
Variable Set String %T1% from Clipboard
Variable Set Integer %N1% from Position of Text in Variable %T1%
Variable Modify Integer: %N1% = %N1% + 3
Variable Set Integer %N2% from Position of Text in Variable %T1%
Variable Modify Integer: %N3% = %N2% - %N1%
Variable Modify String: Copy Part of %T1% to %T2%
Variable Modify String: Trim %T2%
Text Box Display: Recipient

<CLIPC><TVAR2:01:03:><IVAR2:01:13:1:To:><NMVAR:01:01:1:0000001:2:0000003><IVAR2:02:13:1:From:><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:02:01:N01:N03:><TMVAR2:01:02:00:000:000:><TBOX4:T:1:CenterCenter000278000200:000:Recipient%T2%>

 

EDIT-

 

If you read this earlier, I had posted the above code for ME Pro, not realizing I was on the ME3 board... I have now updated the code for ME3. Sorry for any confusion.

Link to comment
Share on other sites

  • 3 weeks later...

Could you please put comments by the steps that are being taken per line on that macro, it functions perfectly but i just don't know what its doing the + 3 totally threw me off. Reason being is that i have to process items within an email such as Name, Last name, address and so on, copy and paste into another window and would like to edit the macro to do so. Thank you!!!

Link to comment
Share on other sites

Example macro:

Clipboard Copy //Self Explanatory

 

Variable Set String %T1% from Clipboard //This command sets %T1% from the clipboard

 

Variable Set Integer %N1% from Position of Text in Variable %T1% //This command (as seen in the Direct Editor) locates the specified

phrase To: within %T1% and assigns %N1% with the position (measured in characters) of the first letter of the phrase.

 

Variable Modify Integer: %N1% = %N1% + 3 //Because I know that "To:" consists of 3 characters, I change the value of %N1% to

%N1% + 3 to give me the position immediately following To:

 

Variable Set Integer %N2% from Position of Text in Variable %T1% //This is virtually identical to establishing %N1%, but this time I'm

looking for the position of the phrase From: and assigning that to %N2%

 

Variable Modify Integer: %N3% = %N2% - %N1% //Basic Math: By subtracting N1 from N2 I am able to measure the number of

characters and spaces between them. Based on the example previously given, I believe we end up with 20 - 4 = 16.

 

Variable Modify String: Copy Part of %T1% to %T2% //Here I copy from the location of %N1% (4) up %N3% spaces (16) to the location

of %N2% (20) and assign the copied text to variable %T2% - Everything between just after To: and just before From:

 

Variable Modify String: Trim %T2% //Lastly, I used the "Trim" command which removes leading and trailing spaces. Basically making

sure that " Captain Caveman " gets turned into "Captain Caveman"

 

Text Box Display: Recipient

 

I hope this helps. If not, please consider picking the macro apart line by line on your own and playing with different commands to help

familiarize yourself with how Macro Express works. The Help files are invaluable for learning the ropes.

Link to comment
Share on other sites

  • 3 weeks later...
Example macro:

 

 

I hope this helps. If not, please consider picking the macro apart line by line on your own and playing with different commands to help

familiarize yourself with how Macro Express works. The Help files are invaluable for learning the ropes.

 

This.. IS.. amazing! thank you!!

Link to comment
Share on other sites

Are you going to be using only one certain email address or are you saying your going to use all three of those emails?

 

i made a macro that dose something similer were it will take a Outlook email and copy certain bits of info out of it then use it later in a ticket in remedy setting the coppyed information as a value so I can use it in a later date. But to do this I always use emails coming from outlook and they come in the same format every time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...