| Reply | « Previous Thread | Next Thread » |
|
Hi,
I'm trying to read unread messages from the Inbox, my code snippet is this: Code:
import appuifw
import e32
import thread
import messaging,string
import inbox
import contacts
def getsender():
while(1):
box=inbox.Inbox()
id=box.sms_messages()
for item in id:
if box.unread(item):
b=box.content(item)
sender = box.address(item) # senders name or number
mobileNum = getSenderNum(sender)
print mobileNum
box=inbox.Inbox() NameError: global name inbox is not defined. Please help me identify te problem here. ![]() Thanks and Regards Neeraj |
| itmediaconnect |
| View Public Profile |
| Find all posts by itmediaconnect |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
Hi,
Please post the entire code you're using. The function getSenderNum is not defined anywhere and the function getsender is only defined, not called. |
|
This is the complete code:
Code:
import appuifw
import e32
import thread
import messaging,string
import inbox
import contacts #import contact db
db = contacts.open() #store in a variable "db"
def getSenderNum(sms_sender):
found = db.find(sms_sender) #find in database the contact name
try: found #check if found
except NameError:
senderData = found[0]
senderNum = senderData.find("mobile_number")[0].value
else:
senderNum = sms_sender
return senderNum
#now all you have to do is assign a variable the number of that contact name
def getsender():
while(1):
box=inbox.Inbox()
id=box.sms_messages()
for item in id:
if box.unread(item):
b=box.content(item)
sender = box.address(item) # senders name or number
mobileNum = getSenderNum(sender)
print mobileNum
thread.start_new_thread(getsender, ())
Thanks and Regards Neeraj |
| itmediaconnect |
| View Public Profile |
| Find all posts by itmediaconnect |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| problem in Reading sms from inbox | venkatesh.pampana | General Symbian C++ | 2 | 2008-10-29 14:04 |
| Reading Messages from the inbox | mottaisami | Mobile Java Networking & Messaging & Security | 2 | 2007-02-01 12:19 |
| S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? | www_peach | Symbian Networking & Messaging | 8 | 2006-02-01 03:57 |
| S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? | www_peach | General Symbian C++ | 0 | 2005-09-20 04:58 |
| S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? | www_peach | Mobile Java Networking & Messaging & Security | 0 | 2005-09-20 04:56 |