Sign in to follow this  
Followers 0
kctvt

Take email from Note and paste to Excel

13 posts in this topic

Take email from Note and paste to Excel

Yub, that's my Question. I'm creating a code take emails from file .txt , then paste to Excel but I dont know how.

My Note like this :

==========================================

adb@gmail.com ; dfff@gmail.com ; FTT@gmail.com , 123@dot.net , esd@yahoo.com

List email ...

333@ymail.com , 444@yahoo.com ; hellu@hotmail.com ;

===========================================

So, How can I only search email in this file , take it, and past to Excel ?

I dont want to take ";" or "," or anything else not Email

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

This is mt note file :

dsfds

adb@gmail.com , dfff@gmail.com , FTT@gmail.com , 123@dot.net , esd@yahoo.com

List email ...

333@ymail.com , 444@yahoo.com , hellu@hotmail.com ,

This is my code

snipped

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Msgbox (48, "Notice" ,$array[$a],2000)

Msgbox (48, "Notice" , ^ ERROR

Can you help me fix this ...

I think problem is :

$a = 1
Do
;If @error = -1 Then ExitLoop
Msgbox (48, "Notice", $array[$a],2000)
$a = $a + 1
Until @error = 1
EndIf
Edited by SmOke_N

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use Consolewrite to output the number of elements in the array (it's in element 0) and the Index.

Or how about this

snipped

Edited by SmOke_N
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank Water :D It work very good ^^

However, I still have a problem .

This is my new code :

snipped

I have a new file like this :

dsfds
adb@gmail.com
dfff@gmail.com
FTT@gmail.com
123@dot.net
esd@yahoo.com

List email ...

333@ymail.com
444@yahoo.com
hellu@hotmail.com

I only take the line have email. If the line dont have "@" then delete that line.

So.... How can I do it ? Use _ArrayDelete ?

Edited by SmOke_N

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

kctvt,

put the filewritefromarray outside of your do loop

kylomas

Edit : make that "for" loop

Edit2: If you are going to use filereadfromarray you do not need to open the file and you certainly do NOT want to read it line by line.

Edit3: I would have done this as follows (you need to figure out how to get rid of the line w/o "@"

snipped

kylomas

Edit4: You CHANGED the input file format as I was coding thew above solution...Good Luck !!!

kylomas

Edited by SmOke_N

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Given your example(s) inputs, merged into file mailadrs.txt in script folder, run this:

#include 
Local $txt = FileRead("mailadrs.txt")
Local $mailAdrs = StringRegExp($txt, '(?im)b([w.-]+@[w.-]+)b', 3)
_ArrayDisplay($mailAdrs)

Edit: fixed as per posts below.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

jchd,

After all the rigamorole it ocurred to me that regex was the solution. Does the regex breakdown as follows?

(?im)      - case insensitive - don't get the match newlines within data, however
b           - start match on word boundry
([dw.]+  - match any chars, any number of times
@          - followed by an "@" sign
([dw.]+ - match any chars, any number of times
+)        -  close match set
b          - end on word boundry

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Geez, looking again at it I see it's overcomplicated. Reason: d in already included in w metacharacter, so we don't need d.

(?im)     - case insensitive and multiline options
b         - start match on a word boundary
(         - start capture
[w.-]+    - match one or more "word"chars (letters or digits) or dot or hyphen
@         - followed by an "@" sign
[w.-]+    - match one or more "word" chars (letters or digits) or dot or hyphen
)         - close capture
b         - must match a word boundary

In short the better pattern is "(?im)b([w.]+@[w.]+)b"

It still is a very permissive pattern, since it would not filter out invalid addresses like abc..d.e.f.g....z@.1.2.3.4.5.6.7.8.9..

But it should work for already validated addresses, unless they are special "enterprise" type (unlikely).

EDIT: I also was leaving the hyphen out... Probably too late (or is it early?) for mail regexps!

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Thank kylomas :D It work very well

I has all email I want in that file. So, I copy these Email and paste to Excel for my data email. I use it to send email.

I have 10 email to do this (email1@gmail.com, email2@gmail.com....v....v.... , email10@gmail.com) . And I only want each email just send 200 emails, then it will change the next email.

So... I have 2 file data rightnow :

First : Full of email (Data in Excel. When I send successfull email , _Excel 'll write "SENT")

adb@gmail.com 
dfff@gmail.com 
FTT@gmail.com 
123@dot.net 
esd@yahoo.com 
333@ymail.com 
444@yahoo.com 
hellu@hotmail.com

Second : List acc email I'll use to send

email1@gmail.com
email2@gmail.com
email3@gmail.com
email4@gmail.com
email5@gmail.com
email6@gmail.com
email7@gmail.com
email8@gmail.com
email9@gmail.com
email10@gmail.com

So.... What should we do now :S

Edited by kctvt

Share this post


Link to post
Share on other sites

Your question(s) and intention(s) are questionable.

Please explain why I should allow this thread to remain open when it apparently looks like you're trying to create a spam email bot.

I would suggest no one else to respond to this thread other than the original poster until otherwise told so.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

The OP sent me a PM and I exactly asked the same question - no reply so far.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

24 hours is plenty of time to respond.

I guess it wasn't legitimate after all.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0