Jump to content

_filereadtoarray - (Moved)


Recommended Posts

Hello does anyone know a way to download my atom feed to my computer.

https://gmail.google.com/gmail/feed/atom

my work around is

global $aFile_data

$file='mail.google.com_mail_feed_atom.xml'

$hndl=ShellExecute('https://gmail.google.com/gmail/feed/atom')
$refresh=TimerInit()

while 1

    $R_tiime= TimerDiff($refresh)
    if ($R_tiime > 10000) then
    _save()

    EndIf

WEnd

func _save()
Send("{CTRLDOWN}r{CTRLUP}")
Sleep(5000)
Send("{CTRLDOWN}s{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("{ALTDOWN}y{ALTUP}")
$refresh=TimerInit()
_Read_loc()
EndFunc

Func _Read_loc()

$read=FileRead($file)
$email_count=0
$max_count=_FileCountLines($file)
do
$email_count+=1
$aArray=_StringBetween($read,"<entry>","</entry>")
$Title_ar=_StringBetween($aArray[$email_count],"<title>","</title>")
$name_ar=_StringBetween($aArray[$email_count],"<name>","</name")
$email_ar=_StringBetween($aArray[$email_count],"<email>","</email")
$summary_ar=_StringBetween($aArray[$email_count],"<summary>","</summary")
$issued_ar=_StringBetween($aArray[$email_count],"<issued>","</issued")
MsgBox(1,"Email: "&$email_count,"Title:"&$Title_ar[0]&@CRLF&"Date:"&$issued_ar[0]&@CRLF&"Sender Name:"&$name_ar[0]&@CRLF&"Sender Email:"&$email_ar[0]&@CRLF&"Summary:"&$summary_ar[0])
Until $email_count+1 = $max_count

EndFunc


 

 

Id like it to every 10 seconds to save the .xml file.  And then read and split the .xml with a the delimiter <entry> so I can isolate and read each entry. if anyone could help me it would be much appreciated.
 

Edited by Jblz619
Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Ty jos for moving so i got the file to read well but i need to find a better work around for getting the .xml

global $aFile_data

$file='mail.google.com_mail_feed_atom.xml'

$hndl=ShellExecute('https://gmail.google.com/gmail/feed/atom')
$refresh=TimerInit()

while 1

    $R_tiime= TimerDiff($refresh)
    if ($R_tiime > 10000) then
    _save()

    EndIf

WEnd

func _save()
Send("{CTRLDOWN}r{CTRLUP}")
Sleep(5000)
Send("{CTRLDOWN}s{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("{ALTDOWN}y{ALTUP}")
$refresh=TimerInit()
_Read_loc()
EndFunc

Func _Read_loc()

$read=FileRead($file)
$email_count=0
$max_count=_FileCountLines($file)
do
$email_count+=1
$aArray=_StringBetween($read,"<entry>","</entry>")
$Title_ar=_StringBetween($aArray[$email_count],"<title>","</title>")
$name_ar=_StringBetween($aArray[$email_count],"<name>","</name")
$email_ar=_StringBetween($aArray[$email_count],"<email>","</email")
$summary_ar=_StringBetween($aArray[$email_count],"<summary>","</summary")
$issued_ar=_StringBetween($aArray[$email_count],"<issued>","</issued")
MsgBox(1,"Email: "&$email_count,"Title:"&$Title_ar[0]&@CRLF&"Date:"&$issued_ar[0]&@CRLF&"Sender Name:"&$name_ar[0]&@CRLF&"Sender Email:"&$email_ar[0]&@CRLF&"Summary:"&$summary_ar[0])
Until $email_count+1 = $max_count

EndFunc

 

 

Edited by Jblz619
Link to comment
Share on other sites

20 minutes ago, argumentum said:

..no idea why you're going about this this way but in any case maybe this ( https://www.autoitscript.com/forum/topic/187431-thunderbird-to-tray/_) give's you a way around to whatever you need to get done.

 

its a work around because i couldn't get pop 3 to work or imap. I tried third part mail clients like outlook, thunderbird and mailbird. I tried addons and filters nothing would move to a folder and leave in a readable format unless manually done.  theimpoertexport addon for thunderbird needed to be manually done. And the rest if the email clients would only move to folder in inbox.

Edited by Jblz619
Link to comment
Share on other sites

40 minutes ago, argumentum said:

Cool I have Jos smpt email send working already. For sending emails. Just trying to get read mail pop3 or imap to work.  I was looking into gmail api previously but there is a lot of inputs i'm not familiar with it yet. I will look more into getting the oautho token and finding out what a json file is so i can enter my client id and client secret.

;=======================================================================================================================
; Date:             2018-02-12, 17:52
;
; Description:      Send email using API to single or group of receipients.
;
; Function(s):      gmailUsersMessagesSend() -> example usage
;
; Param(s):         $sClientId          Your client_id from *json file
;                   $sClientSecret      Your client_secret from *json file
global $aFile_data, $email_count
$file='mail.google.com_mail_feed_atom.xml'

$hndl=ShellExecute('https://gmail.google.com/gmail/feed/atom')
$refresh=TimerInit()

while 1

    $R_tiime= TimerDiff($refresh)
    if ($R_tiime > 10000) then
    _save()
    EndIf

WEnd

func _save()
Send("{CTRLDOWN}r{CTRLUP}")
Sleep(5000)
Send("{CTRLDOWN}s{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("{ALTDOWN}y{ALTUP}")
$refresh=TimerInit()
_Read_XML()
EndFunc

Func _Read_XML()
$read=FileRead($file)
$email_count=0
$aArray=_StringBetween($read,"<feed","</feed>")
if not @error then
$count=_StringBetween($aArray[0],"<fullcount>","</fullcount")
$aArray=_StringBetween($read,"<entry>","</entry>")
do
$Title_ar=_StringBetween($aArray[$email_count],"<title>","</title>")
$name_ar=_StringBetween($aArray[$email_count],"<name>","</name")
$email_ar=_StringBetween($aArray[$email_count],"<email>","</email")
$summary_ar=_StringBetween($aArray[$email_count],"<summary>","</summary")
$issued_ar=_StringBetween($aArray[$email_count],"<issued>","</issued")
MsgBox(1,"Email: "&$email_count,"Title: "&$Title_ar[0]&@CRLF&"Date: "&$issued_ar[0]&@CRLF&"Sender Name: "&$name_ar[0]&@CRLF&"Sender Email: "&$email_ar[0]&@CRLF&"Summary: "&$summary_ar[0])
$email_count+=1
Until $email_count = $count[0]
EndIf
EndFunc

I wrote this to read the .xml file it works great to read and parse. But would like to try another way to get the .xml besides shellexecute and send keys to save file lol.

like inetget

or inetread

or iecreate

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...