J2ME之家

匿名投稿 投稿指南 RSS订阅 J2ME通告:
搜索: 您的位置主页>Symbian>网络编程>

S60 Python 编程指南——发送短信给多个手机

2008-8-21 00:21:17 来源:j2me之家整理 责任编辑:本站整理 【 点击: 我要投稿 [进入论坛]

[J2ME之家-Symbian网络编程]*按以下要求编写一个程序:
1、在屏幕上显示以下字符: Type a word:


2、显示一个哀求框:”Send message to your 2 friends ? “


3、当按 “ok” 后,程序发送短信到另外两个手机,要求输入内容: Greetings from: 输入字符


4、显示一个弹出通知: Messages sent

示例代码:
-----------------------------------------------
# Copyright (c) 2005 Jurgen Scheible
# this script lets you send an sms to 2 users at the same time

import appuifw
import messaging

data = appuifw.query(u"Type your name:", "text")

nbr1 = "123456" # change the mobile number here
nbr2 = "234567" # change the mobile number here
txt = u"Greetings from:" data

if appuifw.query(u"Send message to your 2 friends","query") == True:
messaging.sms_send(nbr1, txt)
messaging.sms_send(nbr2, txt)

appuifw.note(u"Messages sent", "info")
else:
appuifw.note(u"Well, your Messages are not sent then", "info")
----------------------------------------------------
代码说明:
----------------------------------------------------
# Copyright (c) 2005 Jurgen Scheible
# this script lets you send an sms to 2 users at the same time.

# import the messaging module
import appuifw
import messaging

# create text input field
data = appuifw.query(u"Type your name:", "text")

# define the mobile numbers here
nbr1 = "123456"
nbr2 = "234567"

# define the text that the sms shall contain
txt = u"Greetings from:" data

# create a query with type: "query" -> appuifw.query(label, type)
# by using an if statement one can check whether the user has pressed "ok" -> True or "cancel" -> False
if appuifw.query(u"Send message to your 2 friends","query") == True:
# send out the sms; include the mobile number and the text to be sent
messaging.sms_send(nbr1, txt)
messaging.sms_send(nbr2, txt)

# confirm with a pop-up note that the sms has been sent out
appuifw.note(u"Messages sent", "info")
else:
# in case the user had pressed "cancel", send a pop-up note that the messages have not been sent out
appuifw.note(u"Well, your Messages are not sent then", "info")

Tag:短信 多个 手机 发送 指南 编程 the sent your to appuifw.query
责任编辑:本站整理
  • 用户名: (新注册)密码: 匿名:  请文明参与讨论,禁止漫骂攻击。
    评论总数: [ 查看全部 ] 网友评论
    关于我们 - 联系我们 - 广告服务 - 法律声明 - RSS订阅 - 网站地图 - 返回顶部