| Reply | « Previous Thread | Next Thread » |
|
my aplication is saving sms into the text file when sms receiving
but aplication is not running well. when new sms receiving app is delete old text file and save new sms. i wanna save all new sms |
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
You can either create a new file for each SMS, or append the existing file with the content of new messages. See this article for ways of writing a text file.
Basically to append a file you do this: Code:
f=open("C:\\f.txt", "a")
f.write(text)
f.close()
|
|
Quote:
![]() |
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
Code:
import inbox
i=inbox.Inbox()
id=i.sms_messages()[0]
x=i.content(id)
adres=i.address(id)
c=1
for i in os.listdir("E:\\"):
if(i.startswith("sms") and i.endswith(".txt")):
c+=1
def ru(x):
return x.decode('utf-8')
c+=1
f = open("E:\\sms"+str(c)+".txt","w")
f.write(adres+u':'+x)
f.close()
my code is here. whre is my mistake |
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
|
Quote:
Code:
f.write(adres+u':'+ru(x)) |
|
it is only save 1 sms, but i wanna save all received sms
|
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Online
Forum Nokia Champion
|
|
hi mr.eagle
i think you are reading only the first sms using the line Code:
id=i.sms_messages()[0] Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
With your current code you are only writing one SMS, given by id=i.sms_messages()[0]. So to write all the messages, make a loop and write each to a file.
Something like this: Code:
for i in range(len(i.sms_messages())):
id=i.sms_messages()[i]
x=i.content(id)
f=open("E:\\sms"+str(i)+".txt","w")
f.write(adres+u':'+x)
f.close()
|
|
i wanna save last received sms, but it delete old saved sms and save into the file new one, i wanna save all received sms
|
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
So do you want the last one, or all of them?
|
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Online
Forum Nokia Champion
|
|
i feel you just want to save the recent one with a different file name correct
Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
last one and all new sms
|
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
plzz help me
![]() |
| cool_eagle |
| View Public Profile |
| Find all posts by cool_eagle |
|
please be pacient until some one answers ur question
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problem about get SMS in SIM Card | legendlau | General Symbian C++ | 1 | 2008-06-02 04:53 |
| 6310i 4.80 bugs + few words about Nokia politics + other feedback | mwiacek | General Messaging | 2 | 2007-11-10 14:19 |
| Sms Receving problem | cdoewarrior | General Messaging | 5 | 2007-03-03 16:47 |
| HELP! problem w/ sending and reading sms.. | mauve928 | General Messaging | 0 | 2003-12-14 20:10 |
| Problem sending SMS using Nokia 6210 and SDK 2.1 | standi | PC Suite API and PC Connectivity SDK | 2 | 2002-07-25 04:14 |