<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Surya's blog &#187; pyS60</title>
	<atom:link href="http://www.hakc.net/tag/pys60/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hakc.net</link>
	<description></description>
	<lastBuildDate>Sat, 25 Jul 2009 11:39:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>pyS60 Automatic SMS sender</title>
		<link>http://www.hakc.net/2009/03/28/pys60-automatic-sms-sender/</link>
		<comments>http://www.hakc.net/2009/03/28/pys60-automatic-sms-sender/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 11:05:03 +0000</pubDate>
		<dc:creator>Surya</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Automatic SMS]]></category>
		<category><![CDATA[pyS60]]></category>

		<guid isPermaLink="false">http://www.hakc.net/?p=52</guid>
		<description><![CDATA[Ever felt like sending a predefined message to someone automatically after x seconds? Annoy someone ? If you have a smartphone with pyS60 installed it&#8217;s just 13 lines of copy-paste. Code and instructions after the break. The Script : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [...]]]></description>
			<content:encoded><![CDATA[<p>Ever felt like sending a predefined message to someone automatically after x seconds? Annoy someone ? If you have a smartphone with pyS60 installed it&#8217;s just 13 lines of copy-paste. Code and instructions after the break.</p>
<p><span id="more-52"></span></p>
<p>The Script :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># 25/03/2009 -- Surya -  HAKC.NET</span>
<span style="color: #ff7700;font-weight:bold;">import</span> messaging
<span style="color: #ff7700;font-weight:bold;">import</span> appuifw
<span style="color: #ff7700;font-weight:bold;">import</span> e32 <span style="color: #808080; font-style: italic;">#import the modules.</span>
number = <span style="color: #483d8b;">&quot;123456789&quot;</span> <span style="color: #808080; font-style: italic;">#define the recipient phone number here</span>
text = <span style="color: #483d8b;">&quot;Hi :}&quot;</span> <span style="color: #808080; font-style: italic;">#define the message here</span>
i = <span style="color: #ff4500;">0</span> <span style="color: #808080; font-style: italic;">#counter initial value</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>: <span style="color: #808080; font-style: italic;">#infinte loop</span>
	tex = appuifw.<span style="color: black;">note</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Sending!&quot;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#Throw a dialog box just before the message is sent</span>
	messaging.<span style="color: black;">sms_send</span><span style="color: black;">&#40;</span>number, text<span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#Send the message</span>
	tex = appuifw.<span style="color: black;">note</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Sent!&quot;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#Throw a dialog box after the message is sent</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> i <span style="color: #808080; font-style: italic;">#Print the counter in Python Console</span>
	i=i+<span style="color: #ff4500;">1</span> <span style="color: #808080; font-style: italic;">#Increment the counter</span>
	e32.<span style="color: black;">ao_sleep</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">300</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#Wait for 5 minutes (value to be given in seconds) before the next </span>
&nbsp;
<span style="color: #808080; font-style: italic;"># NOTE : You do get charged for every text sent (unless it's free). I don't endorse spamming.</span></pre></td></tr></table></div>

<p>The script is not a biggie. It just sends sends the predefined text to the predefined number in an infinte <em>While</em> loop which sleeps for the defined seconds before the next iteration.</p>
<p>How to execute ? If you don&#8217;t have the Python installed in your <a href="http://www.forum.nokia.com/Resources_and_Information/Explore/Software_Platforms/S60/">Series 60</a> phone, get it <a href="http://sourceforge.net/projects/pys60">here</a>. Just copy the above snippet create a new &#8216;I_am_so_kewl.<strong>py</strong>&#8216; file in your pc, paste and save the above snippet. Then transfer the file to the Python directory in the mem card/phone memory. Open Python shell in the phone (usually in the &#8216;Applications&#8217; folder), Options-&gt;Run Script-&gt; Browser for &#8216;I_am_so_kewl.py&#8217;, execute it and watch the magic happen. <em>Make sure</em> that once you run the sript you don&#8217;t exit the python shell, you can just click the menu button and python will silently run with the evil script in the background. If you&#8217;re just curious to check how many messages have been sent, just open the python shell again and you&#8217;d have the latest counter read printed (add 1 to it; I was too lazy to increment it in the script). More information on pyS60 : <a href="http://wiki.opensource.nokia.com/projects/PyS60">Nokia Wiki</a>,  <a href="http://croozeus.com/tutorials.htm">Croozeus</a> and <a href="http://www.mobilenin.com/pys60/menu.htm">Mobilenin</a>.</p>
<p>Special thanks goes to my first victim for being the guinea pig and the inspiration behind this. Some might look at the code, the other way and might put this into work for evil purpose; I don&#8217;t endorse that.</p>
<p><img id="smallDivTip" style="border: 1px solid blue; z-index: 90; opacity: 1; position: absolute; left: 25px; top: 145px;" src="chrome://dictionarytip/skin/book.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hakc.net/2009/03/28/pys60-automatic-sms-sender/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
