You Are Here:

Community: Developer Discussion Boards

#1 Old sms saving problem - 2008-08-20, 10:59

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
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
Reply With Quote

#2 Old Re: sms saving problem - 2008-08-20, 11:04

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
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()
and every new text that is written is added to the text that is already in the file.
Reply With Quote

#3 Old Re: sms saving problem - 2008-08-20, 11:05

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by bogdan.galiceanu View Post
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.
ok thanks
Reply With Quote

#4 Old Re: sms saving problem - 2008-08-20, 11:50

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
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
Reply With Quote

#5 Old Re: sms saving problem - 2008-08-20, 11:53

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
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
Since you didn't say what probelm you're having, I can only assume that it should be like this:
Code:
f.write(adres+u':'+ru(x))
Please remember to always say the problem you have so we can provide good asnwers.
Reply With Quote

#6 Old Re: sms saving problem - 2008-08-20, 11:57

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by bogdan.galiceanu View Post
Since you didn't say what probelm you're having, I can only assume that it should be like this:
Code:
f.write(adres+u':'+ru(x))
Please remember to always say the problem you have so we can provide good asnwers.
it is only save 1 sms, but i wanna save all received sms
Reply With Quote

#7 Old Re: sms saving problem - 2008-08-20, 12:02

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
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
Reply With Quote

#8 Old Re: sms saving problem - 2008-08-20, 12:04

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
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()
This is just an example, you should modify it to suit your needs.
Reply With Quote

#9 Old Re: sms saving problem - 2008-08-20, 12:05

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
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
Reply With Quote

#10 Old Re: sms saving problem - 2008-08-20, 12:08

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
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
So do you want the last one, or all of them?
Reply With Quote

#11 Old Re: sms saving problem - 2008-08-20, 12:10

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Online
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
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
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
Reply With Quote

#12 Old Re: sms saving problem - 2008-08-20, 12:11

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by bogdan.galiceanu View Post
So do you want the last one, or all of them?
last one and all new sms
Reply With Quote

#13 Old Re: sms saving problem - 2008-08-20, 13:07

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
plzz help me
Reply With Quote

#14 Old Re: sms saving problem - 2008-08-20, 13:09

Join Date: Dec 2004
Posts: 37
n6630
Offline
Registered User
Quote:
Originally Posted by cool_eagle View Post
plzz help me
please be pacient until some one answers ur question
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia