Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gmail Extract
#1
I might be on the wrong forum for this question but here it goes. i have a gmail account that contains a folder or label called 'newsletter signup' inside the folder or label contains about 4,000 separate emails each when opened contains 1 unique e-mail address. I basically need a macro or some sort of gmail extraction program that can open each e-mail, copy the e-mail address, then paste into notepad or excel.

any suggestions?

Thanks!
#2
I see 3 ways.

1. Download all messages to your computer using QM email functions. Then will be easy to extract email addresses. But it also downloads messages from other folders-labels, therefore will need to somehow separate messages from the newsletter folder. The folder name is not in the messages, therefore it may be difficult.

2. Open each message in web browser... I think it is possible, but difficult and less reliable. Probably with html element functions. Or with accessible object functions.

3. Create gmail IMAP account in your email client program (eg Thunderbird). Then extracting messages will be much easier than #2. Use accessible object functions.
#3
Macro for #3.

Macro Macro1423
Code:
Copy      Help
;This macro displays text of all messages in a folder in Thunderbird 3.0.6.

out ;;clear QM output

;find Thunderbird window
int w1=win(" - Mozilla Thunderbird" "MozillaUIWindowClass")
;activate message text pane
act child("" "MozillaWindowClass" w1 0 0 0 7)

;find accessible object of first message
Acc a=acc("" "LISTITEM" w1 "MozillaUIWindowClass" "" 0x1010)
;repeat for each message
rep
,a.DoDefaultAction ;;open
,key Ca ;;select all
,str s.getsel ;;get selected text
,;if(!s.len) 1; key Ca; 1; s.getsel ;;try to enable this if sometimes does not select
,out s ;;show in QM output
,out "---------------------"
,a.Navigate("next"); err break ;;get accessible object of next message
,
#4
Is possible to login in gmail without explorer open?
#5
using HtmlDoc or another way...
#6
With HtmlDoc would be difficult or impossible, because javascript often uses 'window' object. In HtmlDoc there is no window and 'window' object, only 'document' object.

Can automate it in web browser control.

Function Dialog91
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str ax3SHD
ax3SHD=""
if(!ShowDialog("Dialog91" &Dialog91 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 533 313 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 532 312 "SHDocVw.WebBrowser"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,goto load
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

;____________________

;load

;user data
str user="xxxxxxxxxxxxxxxxxxxx@gmail.com"
str password="xxxxxxxxxxxxxxxxxxx"

;____________________

;load gmail. If not logged in, will load login page.
str url
opt waitmsg 1
web "http://mail.google.com/mail/" 1 hDlg "" url
;out url
if(!url.beg("https://www.google.com/accounts/ServiceLogin")) ret ;;already logged in

;fill login form
;out 1
Htm el
el=htm("INPUT" "Email" "" hDlg 0 12 0x121); el.SetText(user)
el=htm("INPUT" "Passwd" "" hDlg 0 13 0x121); el.SetText(password)
el=htm("INPUT" "signIn" "" hDlg 0 14 0x121); el.Click
;out 2
#7
Thanks.
#8
in the code: how get the html of web browser control?
#9
Function Dialog91
Code:
Copy      Help
,Htm h=htm("body" "" "" hDlg)
,out h.HTML ;;<body>
,;out h.DocText(1) ;;all. But with gmail it is very slow. Don't know why, slowly retrieves <head>, which in gmail is bigger than <body>.

another way

Function Dialog91
Code:
Copy      Help
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,
,;<body>
,MSHTML.IHTMLDocument2 doc2=we3.Document
,out doc2.body.outerHTML
,
,;;all. Also slow with gmail.
,;MSHTML.IHTMLDocument3 doc3=we3.Document
,;out doc3.documentElement.outerHTML
#10
Thanks again.
#11
Is possible to use cookies to login in gmail and get html with HtmlDoc?
#12
I wrote all I know about gmail+HtmlDoc in one of previous posts.
HtmlDoc executes scripts, but they often don't work well without window.


Forum Jump:


Users browsing this thread: 1 Guest(s)