DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

PyS60 - ListSMS To File.txt

11.26.2006
| 8387 views |
  • submit to reddit
        // Salva la lista degli SMS in un file

from time import ctime

import codecs
import inbox

box = inbox.Inbox()
msg = box.sms_messages()

f = codecs.open('E:/Others/listSMS.txt', 'w', 'utf8') # Apre il file in codifica UTF8
for i in msg:
	f.write(box.address(i))
	f.write('\n')
	f.write(ctime(box.time(i))) # Converte i secondi in una stringa rappresentante il tempo
	f.write('\n')
	f.write(box.content(i))
	f.write('\n')
f.close()

print 'Fine'

f = codecs.open('E:/Others/listSMS.txt', 'r', 'utf8')
print f.read()
f.close()
    

Comments

Snippets Manager replied on Sun, 2010/04/04 - 1:33am

I think it should work for any S60 version provided that you have PyS60 installed...

Snippets Manager replied on Thu, 2006/02/09 - 1:52pm

only work for s60 not s60v3 sorry

Snippets Manager replied on Mon, 2009/01/19 - 2:58am

Hi, I am interested in this program and tried to implement it. It works fine I was able to take a backup of all my sms messages from inbox. I slightly modify the program to backup my sent items folder, drafts folders. But i am not able to access messages in the "My folders". I searched the API documentation of pys60. I searched on google but still I am not able to find how to access My folders. Is it possible to access my folders from pys60? If not is there any extension module available? Please help me. I have lots of sms messages in my folders. I want to take a backup of the message in a single text file using pys60. Thanks and regards, Poomalairaj