<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://ether.scottdstrader.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sstrader</id>
		<title>EtherWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://ether.scottdstrader.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sstrader"/>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Special:Contributions/Sstrader"/>
		<updated>2026-05-09T08:46:29Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=The_Barbarella_Library&amp;diff=2096</id>
		<title>The Barbarella Library</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=The_Barbarella_Library&amp;diff=2096"/>
				<updated>2024-08-22T21:07:24Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://thebarbarellalibrary.com/ The Barbarella Library] is a website that documents and organizes every edition of the Barbarella comics along with related material such as magazines and artwork.&lt;br /&gt;
&lt;br /&gt;
I originally published the website on 30 Jun 2024 and [https://www.scottdstrader.com/blog/echo/?p=10013 wrote about it on my blog].&lt;br /&gt;
&lt;br /&gt;
[[Category: Projects]]&lt;br /&gt;
[[Category: Web sites]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2095</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2095"/>
				<updated>2024-08-22T21:04:55Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WebSiteStatus}}&lt;br /&gt;
&lt;br /&gt;
Welcome to &amp;#039;&amp;#039;&amp;#039;EtherWiki&amp;#039;&amp;#039;&amp;#039;. This wiki contains information and help topics for [[:Category:Projects|projects]] and [[:Category:Web sites|web sites]] I had created.&lt;br /&gt;
&lt;br /&gt;
* Android apps&lt;br /&gt;
** [[Phonebot]] for Android allows you to create applications directly from your phone.&lt;br /&gt;
** [[Argot]] (pronounced &amp;#039;are-go) is a free Android application that allows you to bookmark locations using GPS.&lt;br /&gt;
* Web sites&lt;br /&gt;
** [[The Barbarella Library]] is a website that documents and organizes every edition of the Barbarella comics along with related material such as magazines and artwork.&lt;br /&gt;
** [[RadioWave]] aggregates schedules for different radio stations to allow listeners to browse all shows across stations by day or hour.&lt;br /&gt;
** [[EtherTV]] allows you to create and share streaming video stations by aggregating videos from web sites like YouTube.&lt;br /&gt;
** [[EventNett]] is an events calendar modeled after the openness of Wikipedia.&lt;br /&gt;
* Web services&lt;br /&gt;
** [[ContentMetrics]] is an open service that allows web developers to add content voting to their web sites.&lt;br /&gt;
&lt;br /&gt;
Topics include help with general navigation along with details on using any of the APIs that access the data.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Contact information]]&lt;br /&gt;
* [[Credits]]&lt;br /&gt;
* [[Privacy policy]]&lt;br /&gt;
* [[Server status]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2094</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2094"/>
				<updated>2024-08-22T20:58:46Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WebSiteStatus}}&lt;br /&gt;
&lt;br /&gt;
Welcome to &amp;#039;&amp;#039;&amp;#039;EtherWiki&amp;#039;&amp;#039;&amp;#039;. This wiki contains information and help topics for [[:Category:Projects|projects]] and [[:Category:Web sites|web sites]] I had created.&lt;br /&gt;
&lt;br /&gt;
* Android apps&lt;br /&gt;
** [[Phonebot]] for Android allows you to create applications directly from your phone.&lt;br /&gt;
** [[Argot]] (pronounced &amp;#039;are-go) is a free Android application that allows you to bookmark locations using GPS.&lt;br /&gt;
* Web sites&lt;br /&gt;
** [[The Barbarella Library]]&lt;br /&gt;
** [[RadioWave]] aggregates schedules for different radio stations to allow listeners to browse all shows across stations by day or hour.&lt;br /&gt;
** [[EtherTV]] allows you to create and share streaming video stations by aggregating videos from web sites like YouTube.&lt;br /&gt;
** [[EventNett]] is an events calendar modeled after the openness of Wikipedia.&lt;br /&gt;
* Web services&lt;br /&gt;
** [[ContentMetrics]] is an open service that allows web developers to add content voting to their web sites.&lt;br /&gt;
&lt;br /&gt;
Topics include help with general navigation along with details on using any of the APIs that access the data.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Contact information]]&lt;br /&gt;
* [[Credits]]&lt;br /&gt;
* [[Privacy policy]]&lt;br /&gt;
* [[Server status]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=The_Barbarella_Library&amp;diff=2093</id>
		<title>The Barbarella Library</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=The_Barbarella_Library&amp;diff=2093"/>
				<updated>2024-08-21T22:55:51Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: Created page with &amp;quot;[https://thebarbarellalibrary.com/ The Barbarella Library] is a website that documents and organizes every edition of the Barbarella comics along with related material such as...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://thebarbarellalibrary.com/ The Barbarella Library] is a website that documents and organizes every edition of the Barbarella comics along with related material such as magazines and artwork.&lt;br /&gt;
&lt;br /&gt;
[[Category: Projects]]&lt;br /&gt;
[[Category: Web sites]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2092</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2092"/>
				<updated>2024-08-21T22:15:44Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WebSiteStatus}}&lt;br /&gt;
&lt;br /&gt;
Welcome to &amp;#039;&amp;#039;&amp;#039;EtherWiki&amp;#039;&amp;#039;&amp;#039;. This wiki contains information and help topics for [[:Category:Projects|projects]] and [[:Category:Web sites|web sites]] I had created.&lt;br /&gt;
&lt;br /&gt;
* [[Phonebot]] for Android allows you to create applications directly from your phone.&lt;br /&gt;
* [[RadioWave]] aggregates schedules for different radio stations to allow listeners to browse all shows across stations by day or hour.&lt;br /&gt;
* [[Argot]] (pronounced &amp;#039;are-go) is a free Android application that allows you to bookmark locations using GPS.&lt;br /&gt;
* [[ContentMetrics]] is an open service that allows web developers to add content voting to their web sites.&lt;br /&gt;
* [[EtherTV]] allows you to create and share streaming video stations by aggregating videos from web sites like YouTube.&lt;br /&gt;
* [[EventNett]] is an events calendar modeled after the openness of Wikipedia.&lt;br /&gt;
&lt;br /&gt;
Topics include help with general navigation along with details on using any of the APIs that access the data.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Contact information]]&lt;br /&gt;
* [[Credits]]&lt;br /&gt;
* [[Privacy policy]]&lt;br /&gt;
* [[Server status]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2091</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Main_Page&amp;diff=2091"/>
				<updated>2024-08-21T22:12:27Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WebSiteStatus}}&lt;br /&gt;
&lt;br /&gt;
Welcome to &amp;#039;&amp;#039;&amp;#039;EtherWiki&amp;#039;&amp;#039;&amp;#039;. This wiki contains information and help topics for [[:Category:Projects|projects]] and [[:Category:Web sites|web sites]] including:&lt;br /&gt;
&lt;br /&gt;
* [[Phonebot]] for Android allows you to create applications directly from your phone.&lt;br /&gt;
* [[Argot]] (pronounced &amp;#039;are-go) is a free Android application that allows you to bookmark locations using GPS.&lt;br /&gt;
* [[ContentMetrics]] is an open service that allows web developers to add content voting to their web sites.&lt;br /&gt;
* The [[EtherTV]], [[EventNett]], and [[RadioWave]] web sites&lt;br /&gt;
&lt;br /&gt;
Topics include help with general navigation along with details on using any of the APIs that access the data.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Contact information]]&lt;br /&gt;
* [[Credits]]&lt;br /&gt;
* [[Privacy policy]]&lt;br /&gt;
* [[Server status]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Contact_information&amp;diff=2090</id>
		<title>Contact information</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Contact_information&amp;diff=2090"/>
				<updated>2022-01-19T14:59:03Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [mailto:sstrader.home@gmail.com Email]&lt;br /&gt;
* [[EtherTV]] on [http://twitter.com/ethertvtuner Twitter]&lt;br /&gt;
* [[Phonebot]]&lt;br /&gt;
** [mailto:gophonebot@gmail.com Email]&lt;br /&gt;
** [http://twitter.com/gophonebot Twitter]&lt;br /&gt;
* [[RadioWave]] on [http://twitter.com/radiowavetuner Twitter]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2089</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2089"/>
				<updated>2014-11-08T11:44:03Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|2 Nov 2014&lt;br /&gt;
|1.1.22&lt;br /&gt;
|2.0.22&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Web_view|WebView]] control to display HTML content.&lt;br /&gt;
|-&lt;br /&gt;
|9 Nov 2012&lt;br /&gt;
|1.1.21&lt;br /&gt;
|2.0.21&lt;br /&gt;
|Added: Support for [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|sending SMS messages]].&lt;br /&gt;
|-&lt;br /&gt;
|27 Oct 2012&lt;br /&gt;
|1.1.20&lt;br /&gt;
|2.0.20&lt;br /&gt;
|Added: Tablet support. Single [[Phonebot properties|autostart app]] will run on device reboot. Special [[Phonebot_developer%27s_reference/Script_language#Operators_and_literals|escape characters]] supported in code (e.g. quote and newline).&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;br /&gt;
[[Category:Release schedule]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2088</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2088"/>
				<updated>2014-11-05T02:48:01Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Web view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; web_view ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
The initial URL to load can be set using the [[Using Phonebot display properties|image source property]]. Calling &amp;lt;code&amp;gt;my_web_view.set_display(&amp;quot;image&amp;quot;, &amp;quot;source&amp;quot;, url)&amp;lt;/code&amp;gt; loads a new URL. The image storage and scale properties are not yet supported.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resource loaded for the page. This will be updated each time &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;back()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the previous page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;forward()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the next page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reload()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Reload the current page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|The web view is clicked.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|A web resource is being loaded. The &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of the control is the URL of that resource. Setting &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; while a resource is being loaded overrides the original resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2087</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2087"/>
				<updated>2014-11-05T02:47:34Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Web view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; web_view ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
The initial URL to load can be set using the [[Using Phonebot display properties|image source property]]. Calling &amp;lt;code&amp;gt;set_display(&amp;quot;image&amp;quot;, &amp;quot;source&amp;quot;, url)&amp;lt;/code&amp;gt; loads a new URL. The image storage and scale properties are not yet supported.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resource loaded for the page. This will be updated each time &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;back()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the previous page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;forward()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the next page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reload()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Reload the current page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|The web view is clicked.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|A web resource is being loaded. The &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of the control is the URL of that resource. Setting &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; while a resource is being loaded overrides the original resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2086</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2086"/>
				<updated>2014-11-02T22:27:11Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Visual types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; web_view ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
The initial URL can be set using the [[Using Phonebot display properties|image source property]]. The storage and scale properties are not yet supported.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resources loaded for the page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;back()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the previous page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;forward()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the next page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reload()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Reload the current page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|A web resource is being loaded. The &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of the control is the URL of that resource. Setting &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; while a resource is being loaded overrides the original resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2085</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2085"/>
				<updated>2014-11-02T22:25:56Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Web view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
The initial URL can be set using the [[Using Phonebot display properties|image source property]]. The storage and scale properties are not yet supported.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resources loaded for the page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;back()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the previous page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;forward()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Go to the next page in the history.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reload()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Reload the current page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|A web resource is being loaded. The &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of the control is the URL of that resource. Setting &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; while a resource is being loaded overrides the original resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2084</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2084"/>
				<updated>2014-11-02T22:18:48Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|2 Nov 2014&lt;br /&gt;
|1.1.22&lt;br /&gt;
|2.0.22&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Web_view|WebView]] control to display HTML content.&lt;br /&gt;
|-&lt;br /&gt;
|9 Nov 2012&lt;br /&gt;
|1.1.21&lt;br /&gt;
|2.0.21&lt;br /&gt;
|Added: Support for [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|sending SMS messages]].&lt;br /&gt;
|-&lt;br /&gt;
|27 Oct 2012&lt;br /&gt;
|1.1.20&lt;br /&gt;
|2.0.20&lt;br /&gt;
|Added: Tablet support. Single [[Phonebot properties|autostart app]] will run on device reboot. Special [[Phonebot_developer%27s_reference/Script_language#Operators_and_literals|escape characters]] supported in code (e.g. quote and newline).&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2083</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2083"/>
				<updated>2014-11-02T21:38:42Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Web view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resources loaded for the page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;back()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;forward()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reload()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|A web resource is being loaded. The &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of the control is the URL of that resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2082</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2082"/>
				<updated>2014-11-02T21:36:53Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Visual types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|The last URL resources loaded for the page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2081</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2081"/>
				<updated>2014-11-02T21:35:29Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Visual types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web view ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2080</id>
		<title>Phonebot developer&#039;s reference/Script language</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2080"/>
				<updated>2014-07-21T21:33:19Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Variables and basic types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Operators and literals ==&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Operator&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;+ - * /&amp;lt;/code&amp;gt;&lt;br /&gt;
|Numeric&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
|String concatenation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;== != &amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;lt;/code&amp;gt;&lt;br /&gt;
|Comparison&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;! &amp;amp;&amp;amp; &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Boolean&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Strings:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Delimited by double quotes.&amp;quot;&lt;br /&gt;
 &amp;quot;Allow \&amp;quot;special characters\&amp;quot; with escape sequences.\nA new line.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
--see [http://docs.oracle.com/javase/tutorial/java/data/characters.html Characters] listing valid escape sequences&lt;br /&gt;
&lt;br /&gt;
Numbers (integers and floating-point):&lt;br /&gt;
&lt;br /&gt;
 0 1 2 3.14 9.9999&lt;br /&gt;
&lt;br /&gt;
Boolean keywords:&lt;br /&gt;
&lt;br /&gt;
 true false&lt;br /&gt;
&lt;br /&gt;
== Variables and basic types ==&lt;br /&gt;
&lt;br /&gt;
Variables are created the first time they are referenced. The first reference must be a write action as opposed to a read action. The first two lines are valid and the third is not:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 control1.text = temp1&lt;br /&gt;
 control1.text = temp2 /* invalid: temp2 was never initialized */&lt;br /&gt;
&lt;br /&gt;
Variables are dynamically typed and so can hold a value for any intrinsic data type. All below are valid:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 temp1 = 12 / 4&lt;br /&gt;
 temp1 = 12.0 / 5.0                /* temp1 = 2.4 */&lt;br /&gt;
 temp1 = &amp;quot;Result is: &amp;quot; &amp;amp; (12 / 4)  /* temp1 = &amp;quot;Result is: 3&amp;quot; */&lt;br /&gt;
 temp1 = (12 / 4) + &amp;quot;9&amp;quot;            /* temp1 = 12 */&lt;br /&gt;
 temp1 = false&lt;br /&gt;
 temp1 = (12 / 4) == 3             /* temp1 = true */&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;intrinsic data types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Intrinsic type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
|No decimal places&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;&lt;br /&gt;
|Floating-point&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
|true or false, non-empty strings and non-zero numbers evaluated as true&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Coersion to boolean can be used as a shorthand to test if values are present:&lt;br /&gt;
&lt;br /&gt;
 if (name)&lt;br /&gt;
     // the variable contains data&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if (values:array.size)&lt;br /&gt;
     // the array contains items&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Complex types ===&lt;br /&gt;
&lt;br /&gt;
Variables can be [http://en.wikipedia.org/wiki/Type_conversion coerced into different types]. This means that a variable must be told it&amp;#039;s a specific type in order to use the type&amp;#039;s properties and methods. The second and third lines below show the variable &amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; being coerced into a database type:&lt;br /&gt;
&lt;br /&gt;
 temp1 = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db_size = temp1:database.size&lt;br /&gt;
 new_record = temp1:database.add_record()&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;coercible types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Coercible type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Array|array]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A persistent data store&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A date and time&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#File|file]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A file or folder&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as a [http://en.wikipedia.org/wiki/JSON JSON] data structure&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of associated values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Number|number]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|An integer or double&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Record|record]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of related data from a database&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#String|string]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#XML|xml]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as [http://en.wikipedia.org/wiki/XML XML]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Use uncoerced variables to access the intrinsic value of the variable. A variable must be coerced to a type in order to use the type&amp;#039;s properties and methods.&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;A string value.&amp;quot;&lt;br /&gt;
 temp2 = temp1              /* copy the intrinsic value, temp2 = &amp;quot;A string value.&amp;quot; */&lt;br /&gt;
 temp2 = temp1:string.size  /* coerce to access the string size, temp2 = 15 */&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables are defined within a specific &amp;#039;&amp;#039;&amp;#039;scope&amp;#039;&amp;#039;&amp;#039;. A variable&amp;#039;s scope determines where it can be accessed.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Scope&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Local&lt;br /&gt;
|Visible only within the current script.&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|Visible within any events on the module and any events on controls within the module.&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|Visible within any events on the application and any events across all modules, controls, and services.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By default, variables are in local scope and can only be accessed from the event where they are defined. Variables in module and application scope can be used to pass data between scripts. For example, a button&amp;#039;s OnClick event could set the value of a module variable, and a different button&amp;#039;s OnClick event could read that value to perform a calculation. Similarly, a module could store the value of an edit control within an application variable, and a different module could read that value to display in a label.&lt;br /&gt;
&lt;br /&gt;
The following script illustrates the syntax for the three scope levels:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 module1.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = module1.temp1&lt;br /&gt;
 application1.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = application1.temp1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; can be referenced only within the current script. &amp;lt;code&amp;gt;module1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the module and will retain the last value set. &amp;lt;code&amp;gt;application1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the application and will retain the last value set.&lt;br /&gt;
&lt;br /&gt;
== Visual and container types ==&lt;br /&gt;
&lt;br /&gt;
Visual and container objects are anything that the user interacts with. &amp;#039;&amp;#039;&amp;#039;Visual types&amp;#039;&amp;#039;&amp;#039; include items such as buttons and edit controls; &amp;#039;&amp;#039;&amp;#039;container types&amp;#039;&amp;#039;&amp;#039; consist of modules and applications. Visual types are also called controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Container_types|Container type]]&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Application|Application]]&lt;br /&gt;
|Contains modules and databases&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Module|Module]]&lt;br /&gt;
|Contains controls&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual type]]/Control&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Button&lt;br /&gt;
|Responds to a user click&lt;br /&gt;
|-&lt;br /&gt;
|Check box&lt;br /&gt;
|Displayed as checked or unchecked&lt;br /&gt;
|-&lt;br /&gt;
|Drop down list&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Edit box&lt;br /&gt;
|Accepts typed text&lt;br /&gt;
|-&lt;br /&gt;
|Image&lt;br /&gt;
|Displays an image&lt;br /&gt;
|-&lt;br /&gt;
|Label&lt;br /&gt;
|Displays a message&lt;br /&gt;
|-&lt;br /&gt;
|List&lt;br /&gt;
|Contains a vertical list of text&lt;br /&gt;
|-&lt;br /&gt;
|Radio button&lt;br /&gt;
|Grouped in two or more to offer a single selection&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:Note: In computer science, &amp;#039;&amp;#039;type&amp;#039;&amp;#039;, &amp;#039;&amp;#039;class&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;object&amp;#039;&amp;#039; all have specific definitions. Here, they will be used in the following more general sense:&lt;br /&gt;
:*&amp;#039;&amp;#039;Type&amp;#039;&amp;#039; - A distinct data item with specific characteristics. Integers, strings, databases, and edit boxes are all types. Some types may share characteristics: both edit boxes and labels can display text. Others have unique characteristics: integers can be added together but databases cannot.&lt;br /&gt;
:*&amp;#039;&amp;#039;Object&amp;#039;&amp;#039; - An object is an instance of a type. A specific integer object may equal &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and because it is an integer type, it can be added to another integer. A specific label object may have its text property set to &amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition to properties and methods, visual and container types have events. Events can contain script to be executed when something happens to the object. Visual types have &amp;lt;code&amp;gt;OnClick&amp;lt;/code&amp;gt;. Container types have &amp;lt;code&amp;gt;OnOpen&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnClose&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== The this keywords ===&lt;br /&gt;
&lt;br /&gt;
Within an event, the object whose event is being fired can be referred to by its name or with the special keyword &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; enables you to copy the same code to different objects&amp;#039; events and have it perform the same.&lt;br /&gt;
&lt;br /&gt;
 /* in button1.on_click, updates button1 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 /* in button2.on_click, updates button2 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; can be used within any object&amp;#039;s events including those of applications, services, modules, and controls. In addition, &amp;lt;code&amp;gt;thisapp&amp;lt;/code&amp;gt; can be used as a synonym for the currently running application, and &amp;lt;code&amp;gt;thismod&amp;lt;/code&amp;gt; can be used for the currently loaded module. These are useful if you want to copy a module from one application to another.&lt;br /&gt;
&lt;br /&gt;
The previous example showing scoped variables could be rewritten as follows:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 thismod.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = thismod.temp1&lt;br /&gt;
 thisapp.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = thisapp.temp1&lt;br /&gt;
&lt;br /&gt;
=== Object name collisions ===&lt;br /&gt;
&lt;br /&gt;
Object names are restricted to avoid duplicates based on where they are contained.&lt;br /&gt;
&lt;br /&gt;
* Application names must be unique across all other applications.&lt;br /&gt;
* Within an application, module names must be different than the application name, and unique across other modules and services.&lt;br /&gt;
* Within an application, service names must be different than the application name, and unique across modules and other services.&lt;br /&gt;
* Within a module, control names must be different than the application and module names, and unique across other controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Applications&lt;br /&gt;
|Modules&lt;br /&gt;
|Services&lt;br /&gt;
|Controls&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Service&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Control&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control structures ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Assignments&amp;#039;&amp;#039;&amp;#039; copy one value to a variable or object property. The right-hand side of assignments can use variables, object properties, literals, or complex expressions.&lt;br /&gt;
&lt;br /&gt;
 temp1 = temp2 /* assumes temp2 was defined elsewhere */&lt;br /&gt;
 temp1 = application1.name&lt;br /&gt;
 temp1 = 5&lt;br /&gt;
 temp1 = (12 / 4) * temp2&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Methods&amp;#039;&amp;#039;&amp;#039; take zero or more arguments and request an object to perform an action. A method may return a value or object as a result.&lt;br /&gt;
&lt;br /&gt;
 application1.open_module(&amp;quot;module1&amp;quot;)&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)   /* store the database into a variable */&lt;br /&gt;
 db_size = db:database.size                   /* coerce db into a database object and store the size */&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus also provides [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined methods]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Conditionals&amp;#039;&amp;#039;&amp;#039; test one or more expressions and process a block of script based on the first test that returned true.&lt;br /&gt;
&lt;br /&gt;
 if (temp1 &amp;lt; 0)&lt;br /&gt;
     msg = &amp;quot;Negative number&amp;quot;&lt;br /&gt;
 elseif (temp1 == 0)&lt;br /&gt;
     msg = &amp;quot;Zero&amp;quot;&lt;br /&gt;
 elseif (temp1 &amp;lt; 10)&lt;br /&gt;
     msg = &amp;quot;Positive number, less than 10&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
     msg = &amp;quot;Positive number, 10 or greater&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039; process a block of script zero or more times based on the value of a counter.&lt;br /&gt;
&lt;br /&gt;
 msg = &amp;quot;List of numbers zero through nine: &amp;quot;&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     msg = msg &amp;amp; &amp;quot; &amp;quot; &amp;amp; index&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Comments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Both C-style block comments and C++ style inline comments:&lt;br /&gt;
&lt;br /&gt;
 /* Test for:&lt;br /&gt;
    zero&lt;br /&gt;
    one&lt;br /&gt;
 */&lt;br /&gt;
 if (x == 0 || x == 1)&lt;br /&gt;
     // Display results&lt;br /&gt;
     edit.text = &amp;quot;Success!&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2079</id>
		<title>Phonebot developer&#039;s reference/Script language</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2079"/>
				<updated>2012-11-16T14:37:36Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Variables and basic types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Operators and literals ==&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Operator&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;+ - * /&amp;lt;/code&amp;gt;&lt;br /&gt;
|Numeric&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
|String concatenation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;== != &amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;lt;/code&amp;gt;&lt;br /&gt;
|Comparison&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;! &amp;amp;&amp;amp; &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Boolean&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Strings:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Delimited by double quotes.&amp;quot;&lt;br /&gt;
 &amp;quot;Allow \&amp;quot;special characters\&amp;quot; with escape sequences.\nA new line.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
--see [http://docs.oracle.com/javase/tutorial/java/data/characters.html Characters] listing valid escape sequences&lt;br /&gt;
&lt;br /&gt;
Numbers (integers and floating-point):&lt;br /&gt;
&lt;br /&gt;
 0 1 2 3.14 9.9999&lt;br /&gt;
&lt;br /&gt;
Boolean keywords:&lt;br /&gt;
&lt;br /&gt;
 true false&lt;br /&gt;
&lt;br /&gt;
== Variables and basic types ==&lt;br /&gt;
&lt;br /&gt;
Variables are created the first time they are referenced. The first reference must be a write action as opposed to a read action. The first two lines are valid and the third is not:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 control1.text = temp1&lt;br /&gt;
 control1.text = temp2 /* invalid: temp2 was never initialized */&lt;br /&gt;
&lt;br /&gt;
Variables are dynamically typed and so can hold a value for any intrinsic data type. All below are valid:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 temp1 = 12 / 4&lt;br /&gt;
 temp1 = 12.0 / 5.0                /* temp1 = 2.4 */&lt;br /&gt;
 temp1 = &amp;quot;Result is: &amp;quot; &amp;amp; (12 / 4)  /* temp1 = &amp;quot;Result is: 3&amp;quot; */&lt;br /&gt;
 temp1 = (12 / 4) + &amp;quot;9&amp;quot;            /* temp1 = 12 */&lt;br /&gt;
 temp1 = false&lt;br /&gt;
 temp1 = (12 / 4) == 3             /* temp1 = true */&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;intrinsic data types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Intrinsic type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
|No decimal places&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;&lt;br /&gt;
|Floating-point&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
|true or false, non-empty strings and non-zero numbers evaluated as true&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Coersion to boolean can be used as a shorthand to test if values are present:&lt;br /&gt;
&lt;br /&gt;
 if (name) {&lt;br /&gt;
     // the variable contains data&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 if (values:array.size) {&lt;br /&gt;
     // the array contains items&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Complex types ===&lt;br /&gt;
&lt;br /&gt;
Variables can be [http://en.wikipedia.org/wiki/Type_conversion coerced into different types]. This means that a variable must be told it&amp;#039;s a specific type in order to use the type&amp;#039;s properties and methods. The second and third lines below show the variable &amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; being coerced into a database type:&lt;br /&gt;
&lt;br /&gt;
 temp1 = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db_size = temp1:database.size&lt;br /&gt;
 new_record = temp1:database.add_record()&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;coercible types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Coercible type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Array|array]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A persistent data store&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A date and time&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#File|file]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A file or folder&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as a [http://en.wikipedia.org/wiki/JSON JSON] data structure&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of associated values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Number|number]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|An integer or double&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Record|record]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of related data from a database&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#String|string]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#XML|xml]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as [http://en.wikipedia.org/wiki/XML XML]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Use uncoerced variables to access the intrinsic value of the variable. A variable must be coerced to a type in order to use the type&amp;#039;s properties and methods.&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;A string value.&amp;quot;&lt;br /&gt;
 temp2 = temp1              /* copy the intrinsic value, temp2 = &amp;quot;A string value.&amp;quot; */&lt;br /&gt;
 temp2 = temp1:string.size  /* coerce to access the string size, temp2 = 15 */&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables are defined within a specific &amp;#039;&amp;#039;&amp;#039;scope&amp;#039;&amp;#039;&amp;#039;. A variable&amp;#039;s scope determines where it can be accessed.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Scope&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Local&lt;br /&gt;
|Visible only within the current script.&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|Visible within any events on the module and any events on controls within the module.&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|Visible within any events on the application and any events across all modules, controls, and services.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By default, variables are in local scope and can only be accessed from the event where they are defined. Variables in module and application scope can be used to pass data between scripts. For example, a button&amp;#039;s OnClick event could set the value of a module variable, and a different button&amp;#039;s OnClick event could read that value to perform a calculation. Similarly, a module could store the value of an edit control within an application variable, and a different module could read that value to display in a label.&lt;br /&gt;
&lt;br /&gt;
The following script illustrates the syntax for the three scope levels:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 module1.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = module1.temp1&lt;br /&gt;
 application1.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = application1.temp1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; can be referenced only within the current script. &amp;lt;code&amp;gt;module1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the module and will retain the last value set. &amp;lt;code&amp;gt;application1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the application and will retain the last value set.&lt;br /&gt;
&lt;br /&gt;
== Visual and container types ==&lt;br /&gt;
&lt;br /&gt;
Visual and container objects are anything that the user interacts with. &amp;#039;&amp;#039;&amp;#039;Visual types&amp;#039;&amp;#039;&amp;#039; include items such as buttons and edit controls; &amp;#039;&amp;#039;&amp;#039;container types&amp;#039;&amp;#039;&amp;#039; consist of modules and applications. Visual types are also called controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Container_types|Container type]]&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Application|Application]]&lt;br /&gt;
|Contains modules and databases&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Module|Module]]&lt;br /&gt;
|Contains controls&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual type]]/Control&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Button&lt;br /&gt;
|Responds to a user click&lt;br /&gt;
|-&lt;br /&gt;
|Check box&lt;br /&gt;
|Displayed as checked or unchecked&lt;br /&gt;
|-&lt;br /&gt;
|Drop down list&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Edit box&lt;br /&gt;
|Accepts typed text&lt;br /&gt;
|-&lt;br /&gt;
|Image&lt;br /&gt;
|Displays an image&lt;br /&gt;
|-&lt;br /&gt;
|Label&lt;br /&gt;
|Displays a message&lt;br /&gt;
|-&lt;br /&gt;
|List&lt;br /&gt;
|Contains a vertical list of text&lt;br /&gt;
|-&lt;br /&gt;
|Radio button&lt;br /&gt;
|Grouped in two or more to offer a single selection&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:Note: In computer science, &amp;#039;&amp;#039;type&amp;#039;&amp;#039;, &amp;#039;&amp;#039;class&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;object&amp;#039;&amp;#039; all have specific definitions. Here, they will be used in the following more general sense:&lt;br /&gt;
:*&amp;#039;&amp;#039;Type&amp;#039;&amp;#039; - A distinct data item with specific characteristics. Integers, strings, databases, and edit boxes are all types. Some types may share characteristics: both edit boxes and labels can display text. Others have unique characteristics: integers can be added together but databases cannot.&lt;br /&gt;
:*&amp;#039;&amp;#039;Object&amp;#039;&amp;#039; - An object is an instance of a type. A specific integer object may equal &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and because it is an integer type, it can be added to another integer. A specific label object may have its text property set to &amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition to properties and methods, visual and container types have events. Events can contain script to be executed when something happens to the object. Visual types have &amp;lt;code&amp;gt;OnClick&amp;lt;/code&amp;gt;. Container types have &amp;lt;code&amp;gt;OnOpen&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnClose&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== The this keywords ===&lt;br /&gt;
&lt;br /&gt;
Within an event, the object whose event is being fired can be referred to by its name or with the special keyword &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; enables you to copy the same code to different objects&amp;#039; events and have it perform the same.&lt;br /&gt;
&lt;br /&gt;
 /* in button1.on_click, updates button1 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 /* in button2.on_click, updates button2 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; can be used within any object&amp;#039;s events including those of applications, services, modules, and controls. In addition, &amp;lt;code&amp;gt;thisapp&amp;lt;/code&amp;gt; can be used as a synonym for the currently running application, and &amp;lt;code&amp;gt;thismod&amp;lt;/code&amp;gt; can be used for the currently loaded module. These are useful if you want to copy a module from one application to another.&lt;br /&gt;
&lt;br /&gt;
The previous example showing scoped variables could be rewritten as follows:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 thismod.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = thismod.temp1&lt;br /&gt;
 thisapp.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = thisapp.temp1&lt;br /&gt;
&lt;br /&gt;
=== Object name collisions ===&lt;br /&gt;
&lt;br /&gt;
Object names are restricted to avoid duplicates based on where they are contained.&lt;br /&gt;
&lt;br /&gt;
* Application names must be unique across all other applications.&lt;br /&gt;
* Within an application, module names must be different than the application name, and unique across other modules and services.&lt;br /&gt;
* Within an application, service names must be different than the application name, and unique across modules and other services.&lt;br /&gt;
* Within a module, control names must be different than the application and module names, and unique across other controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Applications&lt;br /&gt;
|Modules&lt;br /&gt;
|Services&lt;br /&gt;
|Controls&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Service&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Control&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control structures ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Assignments&amp;#039;&amp;#039;&amp;#039; copy one value to a variable or object property. The right-hand side of assignments can use variables, object properties, literals, or complex expressions.&lt;br /&gt;
&lt;br /&gt;
 temp1 = temp2 /* assumes temp2 was defined elsewhere */&lt;br /&gt;
 temp1 = application1.name&lt;br /&gt;
 temp1 = 5&lt;br /&gt;
 temp1 = (12 / 4) * temp2&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Methods&amp;#039;&amp;#039;&amp;#039; take zero or more arguments and request an object to perform an action. A method may return a value or object as a result.&lt;br /&gt;
&lt;br /&gt;
 application1.open_module(&amp;quot;module1&amp;quot;)&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)   /* store the database into a variable */&lt;br /&gt;
 db_size = db:database.size                   /* coerce db into a database object and store the size */&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus also provides [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined methods]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Conditionals&amp;#039;&amp;#039;&amp;#039; test one or more expressions and process a block of script based on the first test that returned true.&lt;br /&gt;
&lt;br /&gt;
 if (temp1 &amp;lt; 0)&lt;br /&gt;
     msg = &amp;quot;Negative number&amp;quot;&lt;br /&gt;
 elseif (temp1 == 0)&lt;br /&gt;
     msg = &amp;quot;Zero&amp;quot;&lt;br /&gt;
 elseif (temp1 &amp;lt; 10)&lt;br /&gt;
     msg = &amp;quot;Positive number, less than 10&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
     msg = &amp;quot;Positive number, 10 or greater&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039; process a block of script zero or more times based on the value of a counter.&lt;br /&gt;
&lt;br /&gt;
 msg = &amp;quot;List of numbers zero through nine: &amp;quot;&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     msg = msg &amp;amp; &amp;quot; &amp;quot; &amp;amp; index&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Comments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Both C-style block comments and C++ style inline comments:&lt;br /&gt;
&lt;br /&gt;
 /* Test for:&lt;br /&gt;
    zero&lt;br /&gt;
    one&lt;br /&gt;
 */&lt;br /&gt;
 if (x == 0 || x == 1)&lt;br /&gt;
     // Display results&lt;br /&gt;
     edit.text = &amp;quot;Success!&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2078</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2078"/>
				<updated>2012-11-10T16:38:24Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* email - Send email&lt;br /&gt;
* http - Make web requests and retrieve response&lt;br /&gt;
* phone - Monitor phone events and send SMS messages&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;. Email is sent using the Postmark Web service. Refer to their [http://postmarkapp.com/privacy-policy privacy policy] for information on how information is used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; - SMS address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; - the SMS content&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; is set, the contents of &amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; will be sent via SMS. Returns two events in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 sms_sent,error_code,error_description&lt;br /&gt;
 sms_received,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If error_code is 0, error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_delivered&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;error_code,error_description&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when a sent SMS messages is delivered&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when an SMS messages is received&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_sent&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;error_code,error_description&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when an SMS messages is sent&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2077</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2077"/>
				<updated>2012-11-10T00:40:37Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Phone events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* email - Send email&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;. Email is sent using the Postmark Web service. Refer to their [http://postmarkapp.com/privacy-policy privacy policy] for information on how information is used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; - SMS address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; - the SMS content&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; is set, the contents of &amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; will be sent via SMS. Returns two events in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 sms_sent,error_code,error_description&lt;br /&gt;
 sms_received,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If error_code is 0, error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_delivered&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;error_code,error_description&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when a sent SMS messages is delivered&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when an SMS messages is received&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_sent&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;error_code,error_description&amp;lt;/code&amp;gt;&lt;br /&gt;
|Generated when an SMS messages is sent&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2076</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2076"/>
				<updated>2012-11-10T00:37:31Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|9 Nov 2012&lt;br /&gt;
|1.1.21&lt;br /&gt;
|2.0.21&lt;br /&gt;
|Added: Support for [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|sending SMS messages]].&lt;br /&gt;
|-&lt;br /&gt;
|27 Oct 2012&lt;br /&gt;
|1.1.20&lt;br /&gt;
|2.0.20&lt;br /&gt;
|Added: Tablet support. Single [[Phonebot properties|autostart app]] will run on device reboot. Special [[Phonebot_developer%27s_reference/Script_language#Operators_and_literals|escape characters]] supported in code (e.g. quote and newline).&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2075</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2075"/>
				<updated>2012-11-08T04:06:15Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Service properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* email - Send email&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;. Email is sent using the Postmark Web service. Refer to their [http://postmarkapp.com/privacy-policy privacy policy] for information on how information is used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; - SMS address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; - the SMS content&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;sms_to&amp;lt;/code&amp;gt; is set, the contents of &amp;lt;code&amp;gt;sms_text&amp;lt;/code&amp;gt; will be sent via SMS. Returns two events in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 sms_sent,error_code,error_description&lt;br /&gt;
 sms_received,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If error_code is 0, error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_properties&amp;diff=2074</id>
		<title>Phonebot properties</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_properties&amp;diff=2074"/>
				<updated>2012-10-28T23:16:02Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Auto-start&amp;#039;&amp;#039;&amp;#039; configures one or more applications to start when Phonebot starts. If more than one are selected, a menu will display first. When only one application is selected, its [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|autostart system services]] will be started whenever the device is rebooted.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Cache&amp;#039;&amp;#039;&amp;#039; configures when scripts are parsed when running an application. Applications with long scripts run more responsively if they are compiled before use. The settings are:&lt;br /&gt;
&lt;br /&gt;
* Compile on each use - Turn of compiler caching&lt;br /&gt;
* On demand (default) - Compile and cache scripts the first time they run, use the cache on subsequent runs&lt;br /&gt;
* Precompile on module open - Compile and cache every script in a module when the module first opens&lt;br /&gt;
* Precompile on application open - Compile and cache every script in an application when the application first opens&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Timeout&amp;#039;&amp;#039;&amp;#039; configures the longest that a script can run. If a script runs longer that the timeout, Phonebot will end execution on the current statement.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Sensor buffer&amp;#039;&amp;#039;&amp;#039; configures the maximum number of sensor events that will be retained in the [[Using Phonebot services|sensor service]] queue. When the queue is filled and new events are added, the oldest events will be deleted from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Retention&amp;#039;&amp;#039;&amp;#039; configures the maximum number of log messages that will be kept across all applications.&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_properties&amp;diff=2073</id>
		<title>Phonebot properties</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_properties&amp;diff=2073"/>
				<updated>2012-10-28T23:04:33Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Auto-start&amp;#039;&amp;#039;&amp;#039; configures one or more applications to start when Phonebot starts. If more than one are selected, a menu will display first. When only one application is selected, its autostart system services will be started whenever the device is rebooted.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Cache&amp;#039;&amp;#039;&amp;#039; configures when scripts are parsed when running an application. Applications with long scripts run more responsively if they are compiled before use. The settings are:&lt;br /&gt;
&lt;br /&gt;
* Compile on each use - Turn of compiler caching&lt;br /&gt;
* On demand (default) - Compile and cache scripts the first time they run, use the cache on subsequent runs&lt;br /&gt;
* Precompile on module open - Compile and cache every script in a module when the module first opens&lt;br /&gt;
* Precompile on application open - Compile and cache every script in an application when the application first opens&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Timeout&amp;#039;&amp;#039;&amp;#039; configures the longest that a script can run. If a script runs longer that the timeout, Phonebot will end execution on the current statement.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Sensor buffer&amp;#039;&amp;#039;&amp;#039; configures the maximum number of sensor events that will be retained in the [[Using Phonebot services|sensor service]] queue. When the queue is filled and new events are added, the oldest events will be deleted from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Retention&amp;#039;&amp;#039;&amp;#039; configures the maximum number of log messages that will be kept across all applications.&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2072</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2072"/>
				<updated>2012-10-27T19:43:18Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|27 Oct 2012&lt;br /&gt;
|1.1.20&lt;br /&gt;
|2.0.20&lt;br /&gt;
|Added: Tablet support. Single [[Phonebot properties|autostart app]] will run on device reboot. Special [[Phonebot_developer%27s_reference/Script_language#Operators_and_literals|escape characters]] supported in code (e.g. quote and newline).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2071</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2071"/>
				<updated>2012-10-27T19:42:56Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|27 Oct 2012&lt;br /&gt;
|1.1.20&lt;br /&gt;
|2.0.20&lt;br /&gt;
|Added: 1.1.20 - Added: Tablet support. Single [[Phonebot properties|autostart app]] will run on device reboot. Special [[Phonebot_developer%27s_reference/Script_language#Operators_and_literals|escape characters]] supported in code (e.g. quote and newline).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2070</id>
		<title>Phonebot developer&#039;s reference/Script language</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2070"/>
				<updated>2012-10-27T19:42:34Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Operators and literals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Operators and literals ==&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Operator&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;+ - * /&amp;lt;/code&amp;gt;&lt;br /&gt;
|Numeric&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
|String concatenation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;== != &amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;lt;/code&amp;gt;&lt;br /&gt;
|Comparison&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;! &amp;amp;&amp;amp; &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Boolean&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Strings:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Delimited by double quotes.&amp;quot;&lt;br /&gt;
 &amp;quot;Allow \&amp;quot;special characters\&amp;quot; with escape sequences.\nA new line.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
--see [http://docs.oracle.com/javase/tutorial/java/data/characters.html Characters] listing valid escape sequences&lt;br /&gt;
&lt;br /&gt;
Numbers (integers and floating-point):&lt;br /&gt;
&lt;br /&gt;
 0 1 2 3.14 9.9999&lt;br /&gt;
&lt;br /&gt;
Boolean keywords:&lt;br /&gt;
&lt;br /&gt;
 true false&lt;br /&gt;
&lt;br /&gt;
== Variables and basic types ==&lt;br /&gt;
&lt;br /&gt;
Variables are created the first time they are referenced. The first reference must be a write action as opposed to a read action. The first two lines are valid and the third is not:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 control1.text = temp1&lt;br /&gt;
 control1.text = temp2 /* invalid: temp2 was never initialized */&lt;br /&gt;
&lt;br /&gt;
Variables are dynamically typed and so can hold a value for any intrinsic data type. All below are valid:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 temp1 = 12 / 4&lt;br /&gt;
 temp1 = 12.0 / 5.0                /* temp1 = 2.4 */&lt;br /&gt;
 temp1 = &amp;quot;Result is: &amp;quot; &amp;amp; (12 / 4)  /* temp1 = &amp;quot;Result is: 3&amp;quot; */&lt;br /&gt;
 temp1 = (12 / 4) + &amp;quot;9&amp;quot;            /* temp1 = 12 */&lt;br /&gt;
 temp1 = false&lt;br /&gt;
 temp1 = (12 / 4) == 3             /* temp1 = true */&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;intrinsic data types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Intrinsic type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
|No decimal places&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;&lt;br /&gt;
|Floating-point&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
|true or false, non-empty strings and non-zero numbers evaluated as true&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Complex types ===&lt;br /&gt;
&lt;br /&gt;
Variables can be [http://en.wikipedia.org/wiki/Type_conversion coerced into different types]. This means that a variable must be told it&amp;#039;s a specific type in order to use the type&amp;#039;s properties and methods. The second and third lines below show the variable &amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; being coerced into a database type:&lt;br /&gt;
&lt;br /&gt;
 temp1 = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db_size = temp1:database.size&lt;br /&gt;
 new_record = temp1:database.add_record()&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;coercible types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Coercible type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Array|array]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A persistent data store&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A date and time&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#File|file]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A file or folder&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as a [http://en.wikipedia.org/wiki/JSON JSON] data structure&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of associated values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Number|number]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|An integer or double&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Record|record]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of related data from a database&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#String|string]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#XML|xml]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as [http://en.wikipedia.org/wiki/XML XML]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Use uncoerced variables to access the intrinsic value of the variable. A variable must be coerced to a type in order to use the type&amp;#039;s properties and methods.&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;A string value.&amp;quot;&lt;br /&gt;
 temp2 = temp1              /* copy the intrinsic value, temp2 = &amp;quot;A string value.&amp;quot; */&lt;br /&gt;
 temp2 = temp1:string.size  /* coerce to access the string size, temp2 = 15 */&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables are defined within a specific &amp;#039;&amp;#039;&amp;#039;scope&amp;#039;&amp;#039;&amp;#039;. A variable&amp;#039;s scope determines where it can be accessed.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Scope&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Local&lt;br /&gt;
|Visible only within the current script.&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|Visible within any events on the module and any events on controls within the module.&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|Visible within any events on the application and any events across all modules, controls, and services.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By default, variables are in local scope and can only be accessed from the event where they are defined. Variables in module and application scope can be used to pass data between scripts. For example, a button&amp;#039;s OnClick event could set the value of a module variable, and a different button&amp;#039;s OnClick event could read that value to perform a calculation. Similarly, a module could store the value of an edit control within an application variable, and a different module could read that value to display in a label.&lt;br /&gt;
&lt;br /&gt;
The following script illustrates the syntax for the three scope levels:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 module1.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = module1.temp1&lt;br /&gt;
 application1.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = application1.temp1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; can be referenced only within the current script. &amp;lt;code&amp;gt;module1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the module and will retain the last value set. &amp;lt;code&amp;gt;application1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the application and will retain the last value set.&lt;br /&gt;
&lt;br /&gt;
== Visual and container types ==&lt;br /&gt;
&lt;br /&gt;
Visual and container objects are anything that the user interacts with. &amp;#039;&amp;#039;&amp;#039;Visual types&amp;#039;&amp;#039;&amp;#039; include items such as buttons and edit controls; &amp;#039;&amp;#039;&amp;#039;container types&amp;#039;&amp;#039;&amp;#039; consist of modules and applications. Visual types are also called controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Container_types|Container type]]&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Application|Application]]&lt;br /&gt;
|Contains modules and databases&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Module|Module]]&lt;br /&gt;
|Contains controls&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual type]]/Control&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Button&lt;br /&gt;
|Responds to a user click&lt;br /&gt;
|-&lt;br /&gt;
|Check box&lt;br /&gt;
|Displayed as checked or unchecked&lt;br /&gt;
|-&lt;br /&gt;
|Drop down list&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Edit box&lt;br /&gt;
|Accepts typed text&lt;br /&gt;
|-&lt;br /&gt;
|Image&lt;br /&gt;
|Displays an image&lt;br /&gt;
|-&lt;br /&gt;
|Label&lt;br /&gt;
|Displays a message&lt;br /&gt;
|-&lt;br /&gt;
|List&lt;br /&gt;
|Contains a vertical list of text&lt;br /&gt;
|-&lt;br /&gt;
|Radio button&lt;br /&gt;
|Grouped in two or more to offer a single selection&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:Note: In computer science, &amp;#039;&amp;#039;type&amp;#039;&amp;#039;, &amp;#039;&amp;#039;class&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;object&amp;#039;&amp;#039; all have specific definitions. Here, they will be used in the following more general sense:&lt;br /&gt;
:*&amp;#039;&amp;#039;Type&amp;#039;&amp;#039; - A distinct data item with specific characteristics. Integers, strings, databases, and edit boxes are all types. Some types may share characteristics: both edit boxes and labels can display text. Others have unique characteristics: integers can be added together but databases cannot.&lt;br /&gt;
:*&amp;#039;&amp;#039;Object&amp;#039;&amp;#039; - An object is an instance of a type. A specific integer object may equal &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and because it is an integer type, it can be added to another integer. A specific label object may have its text property set to &amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition to properties and methods, visual and container types have events. Events can contain script to be executed when something happens to the object. Visual types have &amp;lt;code&amp;gt;OnClick&amp;lt;/code&amp;gt;. Container types have &amp;lt;code&amp;gt;OnOpen&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnClose&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== The this keywords ===&lt;br /&gt;
&lt;br /&gt;
Within an event, the object whose event is being fired can be referred to by its name or with the special keyword &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; enables you to copy the same code to different objects&amp;#039; events and have it perform the same.&lt;br /&gt;
&lt;br /&gt;
 /* in button1.on_click, updates button1 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 /* in button2.on_click, updates button2 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; can be used within any object&amp;#039;s events including those of applications, services, modules, and controls. In addition, &amp;lt;code&amp;gt;thisapp&amp;lt;/code&amp;gt; can be used as a synonym for the currently running application, and &amp;lt;code&amp;gt;thismod&amp;lt;/code&amp;gt; can be used for the currently loaded module. These are useful if you want to copy a module from one application to another.&lt;br /&gt;
&lt;br /&gt;
The previous example showing scoped variables could be rewritten as follows:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 thismod.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = thismod.temp1&lt;br /&gt;
 thisapp.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = thisapp.temp1&lt;br /&gt;
&lt;br /&gt;
=== Object name collisions ===&lt;br /&gt;
&lt;br /&gt;
Object names are restricted to avoid duplicates based on where they are contained.&lt;br /&gt;
&lt;br /&gt;
* Application names must be unique across all other applications.&lt;br /&gt;
* Within an application, module names must be different than the application name, and unique across other modules and services.&lt;br /&gt;
* Within an application, service names must be different than the application name, and unique across modules and other services.&lt;br /&gt;
* Within a module, control names must be different than the application and module names, and unique across other controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Applications&lt;br /&gt;
|Modules&lt;br /&gt;
|Services&lt;br /&gt;
|Controls&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Service&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Control&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control structures ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Assignments&amp;#039;&amp;#039;&amp;#039; copy one value to a variable or object property. The right-hand side of assignments can use variables, object properties, literals, or complex expressions.&lt;br /&gt;
&lt;br /&gt;
 temp1 = temp2 /* assumes temp2 was defined elsewhere */&lt;br /&gt;
 temp1 = application1.name&lt;br /&gt;
 temp1 = 5&lt;br /&gt;
 temp1 = (12 / 4) * temp2&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Methods&amp;#039;&amp;#039;&amp;#039; take zero or more arguments and request an object to perform an action. A method may return a value or object as a result.&lt;br /&gt;
&lt;br /&gt;
 application1.open_module(&amp;quot;module1&amp;quot;)&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)   /* store the database into a variable */&lt;br /&gt;
 db_size = db:database.size                   /* coerce db into a database object and store the size */&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus also provides [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined methods]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Conditionals&amp;#039;&amp;#039;&amp;#039; test one or more expressions and process a block of script based on the first test that returned true.&lt;br /&gt;
&lt;br /&gt;
 if (temp1 &amp;lt; 0)&lt;br /&gt;
     msg = &amp;quot;Negative number&amp;quot;&lt;br /&gt;
 elseif (temp1 == 0)&lt;br /&gt;
     msg = &amp;quot;Zero&amp;quot;&lt;br /&gt;
 elseif (temp1 &amp;lt; 10)&lt;br /&gt;
     msg = &amp;quot;Positive number, less than 10&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
     msg = &amp;quot;Positive number, 10 or greater&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039; process a block of script zero or more times based on the value of a counter.&lt;br /&gt;
&lt;br /&gt;
 msg = &amp;quot;List of numbers zero through nine: &amp;quot;&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     msg = msg &amp;amp; &amp;quot; &amp;quot; &amp;amp; index&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Comments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Both C-style block comments and C++ style inline comments:&lt;br /&gt;
&lt;br /&gt;
 /* Test for:&lt;br /&gt;
    zero&lt;br /&gt;
    one&lt;br /&gt;
 */&lt;br /&gt;
 if (x == 0 || x == 1)&lt;br /&gt;
     // Display results&lt;br /&gt;
     edit.text = &amp;quot;Success!&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Comparing_time_value_formats&amp;diff=2069</id>
		<title>Comparing time value formats</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Comparing_time_value_formats&amp;diff=2069"/>
				<updated>2012-10-06T02:19:30Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;[[Phonebot_developer%27s_reference/Object_reference#Application|Application]] object&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt; method returns the current time and is a synonym for &amp;lt;code&amp;gt;datetime.now()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Phonebot_developer%27s_reference/Object_reference#Datetime|Datetime]] object&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;add_duration()&amp;lt;/code&amp;gt; method takes a parameter that represents a duration in a single unit of time as &amp;lt;code&amp;gt;DURATION[y|M|d|h|m|s]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;format()&amp;lt;/code&amp;gt; method takes a parameter that uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax].&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt; method formats the datetime value as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Using_Phonebot_services#Object_reference|Services]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The sensor service &amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; property takes an integer value in milliseconds.&lt;br /&gt;
&lt;br /&gt;
The timer service &amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; property takes a value formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2068</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2068"/>
				<updated>2012-10-06T02:17:08Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2067</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2067"/>
				<updated>2012-10-06T02:16:52Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Datetime */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Application|application.now()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2066</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2066"/>
				<updated>2012-10-06T02:16:06Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Current time. See also [[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime.now()]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2065</id>
		<title>Phonebot developer&#039;s reference/Script language</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2065"/>
				<updated>2012-08-22T03:34:52Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* The this keywords */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Operators and literals ==&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Operator&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;+ - * /&amp;lt;/code&amp;gt;&lt;br /&gt;
|Numeric&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
|String concatenation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;== != &amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;lt;/code&amp;gt;&lt;br /&gt;
|Comparison&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;! &amp;amp;&amp;amp; &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Boolean&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Strings:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Delimited by double quotes.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Numbers (integers and floating-point):&lt;br /&gt;
&lt;br /&gt;
 0 1 2 3.14 9.9999&lt;br /&gt;
&lt;br /&gt;
Boolean keywords:&lt;br /&gt;
&lt;br /&gt;
 true false&lt;br /&gt;
&lt;br /&gt;
== Variables and basic types ==&lt;br /&gt;
&lt;br /&gt;
Variables are created the first time they are referenced. The first reference must be a write action as opposed to a read action. The first two lines are valid and the third is not:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 control1.text = temp1&lt;br /&gt;
 control1.text = temp2 /* invalid: temp2 was never initialized */&lt;br /&gt;
&lt;br /&gt;
Variables are dynamically typed and so can hold a value for any intrinsic data type. All below are valid:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 temp1 = 12 / 4&lt;br /&gt;
 temp1 = 12.0 / 5.0                /* temp1 = 2.4 */&lt;br /&gt;
 temp1 = &amp;quot;Result is: &amp;quot; &amp;amp; (12 / 4)  /* temp1 = &amp;quot;Result is: 3&amp;quot; */&lt;br /&gt;
 temp1 = (12 / 4) + &amp;quot;9&amp;quot;            /* temp1 = 12 */&lt;br /&gt;
 temp1 = false&lt;br /&gt;
 temp1 = (12 / 4) == 3             /* temp1 = true */&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;intrinsic data types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Intrinsic type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
|No decimal places&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;&lt;br /&gt;
|Floating-point&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
|true or false, non-empty strings and non-zero numbers evaluated as true&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Complex types ===&lt;br /&gt;
&lt;br /&gt;
Variables can be [http://en.wikipedia.org/wiki/Type_conversion coerced into different types]. This means that a variable must be told it&amp;#039;s a specific type in order to use the type&amp;#039;s properties and methods. The second and third lines below show the variable &amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; being coerced into a database type:&lt;br /&gt;
&lt;br /&gt;
 temp1 = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db_size = temp1:database.size&lt;br /&gt;
 new_record = temp1:database.add_record()&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;coercible types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Coercible type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Array|array]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A persistent data store&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A date and time&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#File|file]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A file or folder&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as a [http://en.wikipedia.org/wiki/JSON JSON] data structure&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of associated values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Number|number]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|An integer or double&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Record|record]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of related data from a database&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#String|string]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#XML|xml]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as [http://en.wikipedia.org/wiki/XML XML]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Use uncoerced variables to access the intrinsic value of the variable. A variable must be coerced to a type in order to use the type&amp;#039;s properties and methods.&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;A string value.&amp;quot;&lt;br /&gt;
 temp2 = temp1              /* copy the intrinsic value, temp2 = &amp;quot;A string value.&amp;quot; */&lt;br /&gt;
 temp2 = temp1:string.size  /* coerce to access the string size, temp2 = 15 */&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables are defined within a specific &amp;#039;&amp;#039;&amp;#039;scope&amp;#039;&amp;#039;&amp;#039;. A variable&amp;#039;s scope determines where it can be accessed.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Scope&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Local&lt;br /&gt;
|Visible only within the current script.&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|Visible within any events on the module and any events on controls within the module.&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|Visible within any events on the application and any events across all modules, controls, and services.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By default, variables are in local scope and can only be accessed from the event where they are defined. Variables in module and application scope can be used to pass data between scripts. For example, a button&amp;#039;s OnClick event could set the value of a module variable, and a different button&amp;#039;s OnClick event could read that value to perform a calculation. Similarly, a module could store the value of an edit control within an application variable, and a different module could read that value to display in a label.&lt;br /&gt;
&lt;br /&gt;
The following script illustrates the syntax for the three scope levels:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 module1.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = module1.temp1&lt;br /&gt;
 application1.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = application1.temp1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; can be referenced only within the current script. &amp;lt;code&amp;gt;module1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the module and will retain the last value set. &amp;lt;code&amp;gt;application1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the application and will retain the last value set.&lt;br /&gt;
&lt;br /&gt;
== Visual and container types ==&lt;br /&gt;
&lt;br /&gt;
Visual and container objects are anything that the user interacts with. &amp;#039;&amp;#039;&amp;#039;Visual types&amp;#039;&amp;#039;&amp;#039; include items such as buttons and edit controls; &amp;#039;&amp;#039;&amp;#039;container types&amp;#039;&amp;#039;&amp;#039; consist of modules and applications. Visual types are also called controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Container_types|Container type]]&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Application|Application]]&lt;br /&gt;
|Contains modules and databases&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Module|Module]]&lt;br /&gt;
|Contains controls&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual type]]/Control&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Button&lt;br /&gt;
|Responds to a user click&lt;br /&gt;
|-&lt;br /&gt;
|Check box&lt;br /&gt;
|Displayed as checked or unchecked&lt;br /&gt;
|-&lt;br /&gt;
|Drop down list&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Edit box&lt;br /&gt;
|Accepts typed text&lt;br /&gt;
|-&lt;br /&gt;
|Image&lt;br /&gt;
|Displays an image&lt;br /&gt;
|-&lt;br /&gt;
|Label&lt;br /&gt;
|Displays a message&lt;br /&gt;
|-&lt;br /&gt;
|List&lt;br /&gt;
|Contains a vertical list of text&lt;br /&gt;
|-&lt;br /&gt;
|Radio button&lt;br /&gt;
|Grouped in two or more to offer a single selection&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:Note: In computer science, &amp;#039;&amp;#039;type&amp;#039;&amp;#039;, &amp;#039;&amp;#039;class&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;object&amp;#039;&amp;#039; all have specific definitions. Here, they will be used in the following more general sense:&lt;br /&gt;
:*&amp;#039;&amp;#039;Type&amp;#039;&amp;#039; - A distinct data item with specific characteristics. Integers, strings, databases, and edit boxes are all types. Some types may share characteristics: both edit boxes and labels can display text. Others have unique characteristics: integers can be added together but databases cannot.&lt;br /&gt;
:*&amp;#039;&amp;#039;Object&amp;#039;&amp;#039; - An object is an instance of a type. A specific integer object may equal &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and because it is an integer type, it can be added to another integer. A specific label object may have its text property set to &amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition to properties and methods, visual and container types have events. Events can contain script to be executed when something happens to the object. Visual types have &amp;lt;code&amp;gt;OnClick&amp;lt;/code&amp;gt;. Container types have &amp;lt;code&amp;gt;OnOpen&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnClose&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== The this keywords ===&lt;br /&gt;
&lt;br /&gt;
Within an event, the object whose event is being fired can be referred to by its name or with the special keyword &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; enables you to copy the same code to different objects&amp;#039; events and have it perform the same.&lt;br /&gt;
&lt;br /&gt;
 /* in button1.on_click, updates button1 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 /* in button2.on_click, updates button2 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; can be used within any object&amp;#039;s events including those of applications, services, modules, and controls. In addition, &amp;lt;code&amp;gt;thisapp&amp;lt;/code&amp;gt; can be used as a synonym for the currently running application, and &amp;lt;code&amp;gt;thismod&amp;lt;/code&amp;gt; can be used for the currently loaded module. These are useful if you want to copy a module from one application to another.&lt;br /&gt;
&lt;br /&gt;
The previous example showing scoped variables could be rewritten as follows:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 thismod.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = thismod.temp1&lt;br /&gt;
 thisapp.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = thisapp.temp1&lt;br /&gt;
&lt;br /&gt;
=== Object name collisions ===&lt;br /&gt;
&lt;br /&gt;
Object names are restricted to avoid duplicates based on where they are contained.&lt;br /&gt;
&lt;br /&gt;
* Application names must be unique across all other applications.&lt;br /&gt;
* Within an application, module names must be different than the application name, and unique across other modules and services.&lt;br /&gt;
* Within an application, service names must be different than the application name, and unique across modules and other services.&lt;br /&gt;
* Within a module, control names must be different than the application and module names, and unique across other controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Applications&lt;br /&gt;
|Modules&lt;br /&gt;
|Services&lt;br /&gt;
|Controls&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Service&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Control&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control structures ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Assignments&amp;#039;&amp;#039;&amp;#039; copy one value to a variable or object property. The right-hand side of assignments can use variables, object properties, literals, or complex expressions.&lt;br /&gt;
&lt;br /&gt;
 temp1 = temp2 /* assumes temp2 was defined elsewhere */&lt;br /&gt;
 temp1 = application1.name&lt;br /&gt;
 temp1 = 5&lt;br /&gt;
 temp1 = (12 / 4) * temp2&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Methods&amp;#039;&amp;#039;&amp;#039; take zero or more arguments and request an object to perform an action. A method may return a value or object as a result.&lt;br /&gt;
&lt;br /&gt;
 application1.open_module(&amp;quot;module1&amp;quot;)&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)   /* store the database into a variable */&lt;br /&gt;
 db_size = db:database.size                   /* coerce db into a database object and store the size */&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus also provides [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined methods]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Conditionals&amp;#039;&amp;#039;&amp;#039; test one or more expressions and process a block of script based on the first test that returned true.&lt;br /&gt;
&lt;br /&gt;
 if (temp1 &amp;lt; 0)&lt;br /&gt;
     msg = &amp;quot;Negative number&amp;quot;&lt;br /&gt;
 elseif (temp1 == 0)&lt;br /&gt;
     msg = &amp;quot;Zero&amp;quot;&lt;br /&gt;
 elseif (temp1 &amp;lt; 10)&lt;br /&gt;
     msg = &amp;quot;Positive number, less than 10&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
     msg = &amp;quot;Positive number, 10 or greater&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039; process a block of script zero or more times based on the value of a counter.&lt;br /&gt;
&lt;br /&gt;
 msg = &amp;quot;List of numbers zero through nine: &amp;quot;&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     msg = msg &amp;amp; &amp;quot; &amp;quot; &amp;amp; index&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Comments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Both C-style block comments and C++ style inline comments:&lt;br /&gt;
&lt;br /&gt;
 /* Test for:&lt;br /&gt;
    zero&lt;br /&gt;
    one&lt;br /&gt;
 */&lt;br /&gt;
 if (x == 0 || x == 1)&lt;br /&gt;
     // Display results&lt;br /&gt;
     edit.text = &amp;quot;Success!&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2064</id>
		<title>Phonebot developer&#039;s reference/Script language</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Script_language&amp;diff=2064"/>
				<updated>2012-08-22T03:32:51Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Complex types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Operators and literals ==&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Operator&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;+ - * /&amp;lt;/code&amp;gt;&lt;br /&gt;
|Numeric&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
|String concatenation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;== != &amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;lt;/code&amp;gt;&lt;br /&gt;
|Comparison&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;! &amp;amp;&amp;amp; &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Boolean&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Strings:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Delimited by double quotes.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Numbers (integers and floating-point):&lt;br /&gt;
&lt;br /&gt;
 0 1 2 3.14 9.9999&lt;br /&gt;
&lt;br /&gt;
Boolean keywords:&lt;br /&gt;
&lt;br /&gt;
 true false&lt;br /&gt;
&lt;br /&gt;
== Variables and basic types ==&lt;br /&gt;
&lt;br /&gt;
Variables are created the first time they are referenced. The first reference must be a write action as opposed to a read action. The first two lines are valid and the third is not:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 control1.text = temp1&lt;br /&gt;
 control1.text = temp2 /* invalid: temp2 was never initialized */&lt;br /&gt;
&lt;br /&gt;
Variables are dynamically typed and so can hold a value for any intrinsic data type. All below are valid:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;New variable.&amp;quot;&lt;br /&gt;
 temp1 = 12 / 4&lt;br /&gt;
 temp1 = 12.0 / 5.0                /* temp1 = 2.4 */&lt;br /&gt;
 temp1 = &amp;quot;Result is: &amp;quot; &amp;amp; (12 / 4)  /* temp1 = &amp;quot;Result is: 3&amp;quot; */&lt;br /&gt;
 temp1 = (12 / 4) + &amp;quot;9&amp;quot;            /* temp1 = 12 */&lt;br /&gt;
 temp1 = false&lt;br /&gt;
 temp1 = (12 / 4) == 3             /* temp1 = true */&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;intrinsic data types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Intrinsic type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
|No decimal places&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;&lt;br /&gt;
|Floating-point&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
|true or false, non-empty strings and non-zero numbers evaluated as true&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Complex types ===&lt;br /&gt;
&lt;br /&gt;
Variables can be [http://en.wikipedia.org/wiki/Type_conversion coerced into different types]. This means that a variable must be told it&amp;#039;s a specific type in order to use the type&amp;#039;s properties and methods. The second and third lines below show the variable &amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; being coerced into a database type:&lt;br /&gt;
&lt;br /&gt;
 temp1 = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db_size = temp1:database.size&lt;br /&gt;
 new_record = temp1:database.add_record()&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;coercible types&amp;#039;&amp;#039;&amp;#039; are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Coercible type name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Array|array]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A persistent data store&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A date and time&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#File|file]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A file or folder&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as a [http://en.wikipedia.org/wiki/JSON JSON] data structure&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of associated values&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Number|number]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|An integer or double&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Record|record]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|A collection of related data from a database&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#String|string]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Double-quote delimited&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#XML|xml]]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Data formatted as [http://en.wikipedia.org/wiki/XML XML]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Use uncoerced variables to access the intrinsic value of the variable. A variable must be coerced to a type in order to use the type&amp;#039;s properties and methods.&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;A string value.&amp;quot;&lt;br /&gt;
 temp2 = temp1              /* copy the intrinsic value, temp2 = &amp;quot;A string value.&amp;quot; */&lt;br /&gt;
 temp2 = temp1:string.size  /* coerce to access the string size, temp2 = 15 */&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables are defined within a specific &amp;#039;&amp;#039;&amp;#039;scope&amp;#039;&amp;#039;&amp;#039;. A variable&amp;#039;s scope determines where it can be accessed.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Scope&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Local&lt;br /&gt;
|Visible only within the current script.&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|Visible within any events on the module and any events on controls within the module.&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|Visible within any events on the application and any events across all modules, controls, and services.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By default, variables are in local scope and can only be accessed from the event where they are defined. Variables in module and application scope can be used to pass data between scripts. For example, a button&amp;#039;s OnClick event could set the value of a module variable, and a different button&amp;#039;s OnClick event could read that value to perform a calculation. Similarly, a module could store the value of an edit control within an application variable, and a different module could read that value to display in a label.&lt;br /&gt;
&lt;br /&gt;
The following script illustrates the syntax for the three scope levels:&lt;br /&gt;
&lt;br /&gt;
 temp1 = &amp;quot;local scope&amp;quot;&lt;br /&gt;
 edit1.text = temp1&lt;br /&gt;
 module1.temp1 = &amp;quot;module scope&amp;quot;&lt;br /&gt;
 edit1.text = module1.temp1&lt;br /&gt;
 application1.temp1 = &amp;quot;application scope&amp;quot;&lt;br /&gt;
 edit1.text = application1.temp1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;temp1&amp;lt;/code&amp;gt; can be referenced only within the current script. &amp;lt;code&amp;gt;module1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the module and will retain the last value set. &amp;lt;code&amp;gt;application1.temp1&amp;lt;/code&amp;gt; can be referenced within any script within the application and will retain the last value set.&lt;br /&gt;
&lt;br /&gt;
== Visual and container types ==&lt;br /&gt;
&lt;br /&gt;
Visual and container objects are anything that the user interacts with. &amp;#039;&amp;#039;&amp;#039;Visual types&amp;#039;&amp;#039;&amp;#039; include items such as buttons and edit controls; &amp;#039;&amp;#039;&amp;#039;container types&amp;#039;&amp;#039;&amp;#039; consist of modules and applications. Visual types are also called controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Container_types|Container type]]&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Application|Application]]&lt;br /&gt;
|Contains modules and databases&lt;br /&gt;
|-&lt;br /&gt;
|[[Phonebot_developer%27s_reference/Object_reference#Module|Module]]&lt;br /&gt;
|Contains controls&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
![[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual type]]/Control&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Button&lt;br /&gt;
|Responds to a user click&lt;br /&gt;
|-&lt;br /&gt;
|Check box&lt;br /&gt;
|Displayed as checked or unchecked&lt;br /&gt;
|-&lt;br /&gt;
|Drop down list&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Edit box&lt;br /&gt;
|Accepts typed text&lt;br /&gt;
|-&lt;br /&gt;
|Image&lt;br /&gt;
|Displays an image&lt;br /&gt;
|-&lt;br /&gt;
|Label&lt;br /&gt;
|Displays a message&lt;br /&gt;
|-&lt;br /&gt;
|List&lt;br /&gt;
|Contains a vertical list of text&lt;br /&gt;
|-&lt;br /&gt;
|Radio button&lt;br /&gt;
|Grouped in two or more to offer a single selection&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:Note: In computer science, &amp;#039;&amp;#039;type&amp;#039;&amp;#039;, &amp;#039;&amp;#039;class&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;object&amp;#039;&amp;#039; all have specific definitions. Here, they will be used in the following more general sense:&lt;br /&gt;
:*&amp;#039;&amp;#039;Type&amp;#039;&amp;#039; - A distinct data item with specific characteristics. Integers, strings, databases, and edit boxes are all types. Some types may share characteristics: both edit boxes and labels can display text. Others have unique characteristics: integers can be added together but databases cannot.&lt;br /&gt;
:*&amp;#039;&amp;#039;Object&amp;#039;&amp;#039; - An object is an instance of a type. A specific integer object may equal &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and because it is an integer type, it can be added to another integer. A specific label object may have its text property set to &amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition to properties and methods, visual and container types have events. Events can contain script to be executed when something happens to the object. Visual types have &amp;lt;code&amp;gt;OnClick&amp;lt;/code&amp;gt;. Container types have &amp;lt;code&amp;gt;OnOpen&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnClose&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== The this keywords ===&lt;br /&gt;
&lt;br /&gt;
Within an event, the object whose event is being fired can be referred to by its name or with the special keyword &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; enables you to copy the same code to different objects&amp;#039; events and have it perform the same.&lt;br /&gt;
&lt;br /&gt;
 /* in button1.on_click, updates button1 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 /* in button2.on_click, updates button2 */&lt;br /&gt;
 this.text = &amp;quot;clicked!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; can be used within any object&amp;#039;s events including those of applications, services, modules, and controls. In addition, &amp;lt;code&amp;gt;thisapp&amp;lt;/code&amp;gt; can be used as a synonym for the currently running application, and &amp;lt;code&amp;gt;thismod&amp;lt;/code&amp;gt; can be used for the currently loaded module. These are useful if you want to copy a module from one application to another.&lt;br /&gt;
&lt;br /&gt;
=== Object name collisions ===&lt;br /&gt;
&lt;br /&gt;
Object names are restricted to avoid duplicates based on where they are contained.&lt;br /&gt;
&lt;br /&gt;
* Application names must be unique across all other applications.&lt;br /&gt;
* Within an application, module names must be different than the application name, and unique across other modules and services.&lt;br /&gt;
* Within an application, service names must be different than the application name, and unique across modules and other services.&lt;br /&gt;
* Within a module, control names must be different than the application and module names, and unique across other controls.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Applications&lt;br /&gt;
|Modules&lt;br /&gt;
|Services&lt;br /&gt;
|Controls&lt;br /&gt;
|-&lt;br /&gt;
|Application&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Module&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Service&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|Control&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|X&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control structures ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Assignments&amp;#039;&amp;#039;&amp;#039; copy one value to a variable or object property. The right-hand side of assignments can use variables, object properties, literals, or complex expressions.&lt;br /&gt;
&lt;br /&gt;
 temp1 = temp2 /* assumes temp2 was defined elsewhere */&lt;br /&gt;
 temp1 = application1.name&lt;br /&gt;
 temp1 = 5&lt;br /&gt;
 temp1 = (12 / 4) * temp2&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Methods&amp;#039;&amp;#039;&amp;#039; take zero or more arguments and request an object to perform an action. A method may return a value or object as a result.&lt;br /&gt;
&lt;br /&gt;
 application1.open_module(&amp;quot;module1&amp;quot;)&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)   /* store the database into a variable */&lt;br /&gt;
 db_size = db:database.size                   /* coerce db into a database object and store the size */&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus also provides [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined methods]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Conditionals&amp;#039;&amp;#039;&amp;#039; test one or more expressions and process a block of script based on the first test that returned true.&lt;br /&gt;
&lt;br /&gt;
 if (temp1 &amp;lt; 0)&lt;br /&gt;
     msg = &amp;quot;Negative number&amp;quot;&lt;br /&gt;
 elseif (temp1 == 0)&lt;br /&gt;
     msg = &amp;quot;Zero&amp;quot;&lt;br /&gt;
 elseif (temp1 &amp;lt; 10)&lt;br /&gt;
     msg = &amp;quot;Positive number, less than 10&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
     msg = &amp;quot;Positive number, 10 or greater&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039; process a block of script zero or more times based on the value of a counter.&lt;br /&gt;
&lt;br /&gt;
 msg = &amp;quot;List of numbers zero through nine: &amp;quot;&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     msg = msg &amp;amp; &amp;quot; &amp;quot; &amp;amp; index&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Comments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Both C-style block comments and C++ style inline comments:&lt;br /&gt;
&lt;br /&gt;
 /* Test for:&lt;br /&gt;
    zero&lt;br /&gt;
    one&lt;br /&gt;
 */&lt;br /&gt;
 if (x == 0 || x == 1)&lt;br /&gt;
     // Display results&lt;br /&gt;
     edit.text = &amp;quot;Success!&amp;quot;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference&amp;diff=2063</id>
		<title>Phonebot developer&#039;s reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference&amp;diff=2063"/>
				<updated>2012-08-22T03:30:16Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A reference guide for developing applications with the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
# [[Phonebot developer&amp;#039;s reference/Creating applications|Creating applications]] - An overview of the development environment&lt;br /&gt;
# [[Phonebot developer&amp;#039;s reference/Script language|Script language]] - Details on what the script language provides&lt;br /&gt;
# [[Phonebot developer&amp;#039;s reference/Object reference|Object reference]] - A catalog of all object properties, methods, and events, including tools such as:&lt;br /&gt;
## [[Phonebot_developer%27s_reference/Object_reference#Visual_types|Visual controls]] such as buttons, edit boxes, and lists&lt;br /&gt;
## [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services|Hardware services]] such as email, GPS, phone, and Web requests&lt;br /&gt;
## [[Managing_databases_in_Phonebot_applications#Database|Database]] and [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] objects for persistent storage&lt;br /&gt;
## [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects accessing Web service data&lt;br /&gt;
# [[Phonebot developer&amp;#039;s reference/Sample applications|Sample applications]] - A description of what is contained in each sample application, including:&lt;br /&gt;
## Examples of how to use all Phonebot script object types&lt;br /&gt;
## An email client&lt;br /&gt;
## A Google New and Twitter Web service client&lt;br /&gt;
# [[Phonebot developer&amp;#039;s reference/Advanced tools|Advanced tools]] - Features available only in Phonebot Plus&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2062</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2062"/>
				<updated>2012-08-19T15:43:18Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Service properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* email - Send email&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;. Email is sent using the Postmark Web service. Refer to their [http://postmarkapp.com/privacy-policy privacy policy] for information on how information is used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2061</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2061"/>
				<updated>2012-08-19T14:45:01Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* email - Send email&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2060</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2060"/>
				<updated>2012-08-18T20:46:35Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Deleting variables and layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2059</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2059"/>
				<updated>2012-08-18T20:39:55Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Service properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] array containing a JSON object with a name and a data or path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents retrieved by calling any of the [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file.read()]] methods. Path contains the local path to the file. If path is present, data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - email addresses separated by commas&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a [[Phonebot_developer%27s_reference/Object_reference#Map|map]] of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2058</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2058"/>
				<updated>2012-08-18T20:30:31Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Service properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - JSON array containing a JSON object with a Name and a Data or Path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents. Path contains the local path to the file. If Path is present, Data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Emails will be received from the address &amp;lt;code&amp;gt;&amp;quot;Phonebot Email Service&amp;quot; pbot.email@gophonebot.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a map of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Sample_applications&amp;diff=2057</id>
		<title>Phonebot developer&#039;s reference/Sample applications</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Sample_applications&amp;diff=2057"/>
				<updated>2012-08-18T20:26:37Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Calculator */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Agent ==&lt;br /&gt;
&lt;br /&gt;
* Uses &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Application|application.open_application(name)]]&amp;lt;/code&amp;gt; to open external processes&lt;br /&gt;
* Creates a user &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt; to save previous commands&lt;br /&gt;
&lt;br /&gt;
== Calculator ==&lt;br /&gt;
&lt;br /&gt;
* Each number key contains the same script in its OnClick event by using [[Phonebot_developer%27s_reference/Script_language#The_this_keywords|the &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; keyword]].&lt;br /&gt;
&lt;br /&gt;
== Email client ==&lt;br /&gt;
&lt;br /&gt;
* Uses [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service to send emails with attachments.&lt;br /&gt;
* Uses [[Phonebot_developer%27s_reference/Object_reference#Module|file dialog]] to browse for attachments from the file system and the [[Phonebot_developer%27s_reference/Object_reference#File|file]] object to read the file.&lt;br /&gt;
&lt;br /&gt;
== Notepad ==&lt;br /&gt;
&lt;br /&gt;
* Creates a user &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt; to save notes&lt;br /&gt;
* Uses the &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Map|map]]&amp;lt;/code&amp;gt; object to sort notes&lt;br /&gt;
* Uses [[Phonebot_developer%27s_reference/Object_reference#List|&amp;lt;code&amp;gt;list&amp;lt;/code&amp;gt; named objects]] to store database records within the visual list&lt;br /&gt;
* Uses a [[Phonebot_developer%27s_reference/Advanced_tools#User-defined_methods|user-defined method]] to load notes into the list&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
* Contains several examples of each type of &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Services|service]]&amp;lt;/code&amp;gt;&lt;br /&gt;
* The &amp;quot;Twitter feed&amp;quot; module uses an http service object to make a request to the Twitter [https://dev.twitter.com/docs/api/1/get/search search Web service]. When the [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s [[Phonebot_developer%27s_reference/Creating_applications#Services|&amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event]] fires, the &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Json|json]]&amp;lt;/code&amp;gt; object is used to parse the event data and fill a [[Phonebot_developer%27s_reference/Object_reference#List|list]] with the search results.&lt;br /&gt;
&lt;br /&gt;
Depending on the hardware, sensors can produce a large number of events. If the application freezes when reading sensor data, try setting the Phonebot &amp;quot;Sensor buffer&amp;quot; to a lower value.&lt;br /&gt;
&lt;br /&gt;
== Time tracker ==&lt;br /&gt;
&lt;br /&gt;
Keep track of how much time you spend on different tasks. Create task types to categorize tasks. Use timer to start and stop tasks. View a list of every task or a summary of how much time was spent on each task type.&lt;br /&gt;
&lt;br /&gt;
* Creates two user &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Database|database]]&amp;lt;/code&amp;gt;s&lt;br /&gt;
* Uses &amp;lt;code&amp;gt;[[Phonebot_developer%27s_reference/Object_reference#Datetime|datetime]]&amp;lt;/code&amp;gt; objects to manage timestamps and durations&lt;br /&gt;
* The application contains [[Phonebot_developer%27s_reference/Script_language#Scope|application scoped variables]]&lt;br /&gt;
* The &amp;quot;Menu&amp;quot; module uses module scoped variables&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2056</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2056"/>
				<updated>2012-08-18T20:23:22Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|18 Aug 2012&lt;br /&gt;
|1.1.19&lt;br /&gt;
|2.0.19&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services#Service_properties|Email]] service for sending emails with attachments. HTTP service supports the POST method. Fixed: Layout issues with Script Manager. Sped up [[Phonebot_developer%27s_reference/Object_reference/Using_the_Phonebot_file_object|file]] object read methods. [[Phonebot_developer%27s_reference/Object_reference#Module|Module]] event size now returns the correct value.&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2055</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2055"/>
				<updated>2012-08-18T20:22:15Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2054</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2054"/>
				<updated>2012-08-18T20:14:09Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Object reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Service properties ===&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - JSON array containing a JSON object with a Name and a Data or Path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents. Path contains the local path to the file. If Path is present, Data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a map of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2053</id>
		<title>Phonebot developer&#039;s reference/Object reference/Using Phonebot services</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Using_Phonebot_services&amp;diff=2053"/>
				<updated>2012-08-18T20:13:16Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Object reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Services are non-visual components that monitor different environment states and trigger an event when the state changes. The available services are:&lt;br /&gt;
&lt;br /&gt;
* http - Make web requests&lt;br /&gt;
* phone - Monitor phone events&lt;br /&gt;
* sensor - Monitor hardware sensors&lt;br /&gt;
* timer - Alert at specific intervals&lt;br /&gt;
&lt;br /&gt;
When a service is updated, events are fired in the following order:&lt;br /&gt;
&lt;br /&gt;
# The service&amp;#039;s &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The [[Phonebot_developer%27s_reference/Object_reference#Application|application]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
# The current [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event fires&lt;br /&gt;
&lt;br /&gt;
Each Service stores its update data in a queue. The methods &amp;lt;code&amp;gt;get_event()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pop_event()&amp;lt;/code&amp;gt; access the next event in the queue; &amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt; returns how many events exist; &amp;lt;code&amp;gt;clear_events()&amp;lt;/code&amp;gt; clears the queue.&lt;br /&gt;
&lt;br /&gt;
The maximum number of sensor events that will be retained in the queue is controlled by the &amp;quot;Sensor buffer&amp;quot; [[Phonebot properties|Phonebot property]]. The &amp;quot;Sensor buffer&amp;quot; value, the sensor service&amp;#039;s &amp;quot;Minimum update frequency&amp;quot; value, and the amount of script within each &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OnService&amp;lt;/code&amp;gt; event will determine how responsive your application is when reading sensor data. If updates are sluggish, try reducing the buffer size.&lt;br /&gt;
&lt;br /&gt;
A [[Phonebot_developer%27s_reference/Object_reference#Module|module]]&amp;#039;s show_file_dialog() method can be considered a module-level service.&lt;br /&gt;
&lt;br /&gt;
== Service lifecycle ==&lt;br /&gt;
&lt;br /&gt;
A service&amp;#039;s properties, methods, and the application state affect that service&amp;#039;s lifetime as the following diagram illustrates:&lt;br /&gt;
&lt;br /&gt;
[[Image:phonebot.service-lifecycle.png]]&lt;br /&gt;
&lt;br /&gt;
A service will start running:&lt;br /&gt;
&lt;br /&gt;
* When its start() method is called&lt;br /&gt;
* If its autostart property is set to true, immediately after the application starts&lt;br /&gt;
&lt;br /&gt;
A service will stop running:&lt;br /&gt;
&lt;br /&gt;
* When its stop() method is called&lt;br /&gt;
* If its system property is set to false, when the application loses focus&lt;br /&gt;
* If its system property is set to true, when the application exits&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;auto_start&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to start the service as soon as the application starts.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The number of events in the queue. When monitoring multiple services, this property can be used in &amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt; events to determine which service was updated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only boolean. Set to true to have the service run even when the application has lost focus.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_property(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_property(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the value of a custom property (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Start the service.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Stop the service.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In addition to the common properties, methods, and events, each service may have custom properties accessible from the get_property() and set_property() methods:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Service&lt;br /&gt;
!Properties&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;attachments&amp;lt;/code&amp;gt; - JSON array containing a JSON object with a Name and a Data or Path field. Name contains the file name with an extension denoting the content type. Data contains the byte array of the file contents. Path contains the local path to the file. If Path is present, Data will be ignored. Either of the following is valid:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;path&amp;quot;:&amp;quot;%path%&amp;quot;}&lt;br /&gt;
 {&amp;quot;name&amp;quot;:&amp;quot;%name%&amp;quot;, &amp;quot;data&amp;quot;:&amp;quot;%data%&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cc&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reply_to&amp;lt;/code&amp;gt; - a single email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;to&amp;lt;/code&amp;gt; - a single email address or an array of email addresses&lt;br /&gt;
|Send an email. Returns a single event in the queue containing the following values:&lt;br /&gt;
&lt;br /&gt;
 http_response,error_code,error_description&lt;br /&gt;
&lt;br /&gt;
If http_response is 200, error_code will be 0 and error_description will be &amp;quot;OK&amp;quot;. Any other response will provide error values.&lt;br /&gt;
&lt;br /&gt;
The following restrictions are put on sending emails:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Restriction&lt;br /&gt;
!Phonebot&lt;br /&gt;
!Phonebot Plus&lt;br /&gt;
|-&lt;br /&gt;
|Number of emails in past 24 hour&lt;br /&gt;
|5&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|Number of recipients per email&lt;br /&gt;
|1&lt;br /&gt;
|20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;http&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; - the data sent for a POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; - a map of header names to values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; - the request method: GET or POST&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; - the URL&lt;br /&gt;
|Makes a request to a URL. Returns a single event in the queue containing the response.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;phone&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;events&amp;lt;/code&amp;gt; - array of event names&lt;br /&gt;
|Monitors one or more phone events. Returns an event containing a comma-delimited list of values beginning with the event name (e.g. &amp;lt;code&amp;gt;data_activity,4&amp;lt;/code&amp;gt;). The range of each value is dependent on the event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sensor&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;minimum_update&amp;lt;/code&amp;gt; - time between updates in milliseconds&lt;br /&gt;
&amp;lt;code&amp;gt;sensors&amp;lt;/code&amp;gt; - array of sensor names&lt;br /&gt;
|Monitors one or more hardware sensors. Returns an event containing a comma-delimited list of values beginning with the sensor name (e.g. &amp;lt;code&amp;gt;orientation,60.0,-28.0,3.0&amp;lt;/code&amp;gt;). The range of each value is dependent on the sensor.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;duration&amp;lt;/code&amp;gt; - time between updates, formatted as &amp;lt;code&amp;gt;h:m:s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m:s&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fire the update events at regular intervals. The event will first fire immediately after the service is started. Returns an event containing the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value when the update happened.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events can be accessed and parsed in the following manner:&lt;br /&gt;
&lt;br /&gt;
HTTP:&lt;br /&gt;
&lt;br /&gt;
 event = http_service.pop_event()&lt;br /&gt;
 // query with XPath&lt;br /&gt;
 items = event:xml.query(&amp;quot;//root/item&amp;quot;)&lt;br /&gt;
 // read json data&lt;br /&gt;
 root = event:json.get_element(&amp;quot;root&amp;quot;)&lt;br /&gt;
 items = event:json.get_element(&amp;quot;item&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
&lt;br /&gt;
 event = sensor_service.pop_event()&lt;br /&gt;
 event = event:string.split(&amp;quot;,&amp;quot;)&lt;br /&gt;
 name = event:array.get_element(0)&lt;br /&gt;
 // get values from index 1 and greater&lt;br /&gt;
&lt;br /&gt;
Timer:&lt;br /&gt;
&lt;br /&gt;
 event = timer_service.pop_event()&lt;br /&gt;
 event = event:datetime.format(&amp;quot;HH:mm:ss&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Phone events ===&lt;br /&gt;
&lt;br /&gt;
The phone service can be configured to return any combination of phone events. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_forwarding&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cfi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;call_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,incoming_number&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - idle, 1 - ringing, 2 - off hook&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;cell_location&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;cdma&amp;quot;,base_station_id,base_station_latitude,base_station_longitude,system_id,network_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;gsm&amp;quot;,lac,cid&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_activity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 - none, 1 - in, 2 - out, 3 - in/out, 4 - dormant&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;data_connection_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;state,network_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - disconnected, 1 - connecting, 2 - connected, 3 - suspended&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;message_waiting&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;mwi&amp;lt;/code&amp;gt;&lt;br /&gt;
|boolean&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;service_state&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;is_manual_selection,operator_alpha_long,operator_alpha_short,operator_numeric,roaming,state&amp;lt;/code&amp;gt;&lt;br /&gt;
|state: 0 - in service, 1 - out of service, 2 - emergency only, 3 - power off&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;signal_strengths&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;cdma_ecio,evdo_dbm,evdo_ecio,evdo_snr,gsm_bit_error_rate,gsm_signal_strength,is_gsm&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sms_received&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;timestamp,originating_address,message_body&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/telephony/PhoneStateListener.html PhoneStateListener]&lt;br /&gt;
&lt;br /&gt;
=== Sensor events ===&lt;br /&gt;
&lt;br /&gt;
The sensor service can be configured to return any combination of sensor types. Each type has its own name and data format as described below:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Structure of event value&lt;br /&gt;
(actual values are prefixed with the name, i.e. &amp;lt;code&amp;gt;name,value1,value2,...&amp;lt;/code&amp;gt;)&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;accelerometer&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gps&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;latitude,longitude,accuracy,altitude,bearing,speed&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Gravity in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gyroscope&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Angular speed in radian/second&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;light&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Ambient light in [http://en.wikipedia.org/wiki/Lux lux units]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;linear_acceleration&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|Acceleration in meters/second^2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;magnetic_field&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt;&lt;br /&gt;
|Magnetic field in [http://en.wikipedia.org/wiki/Tesla_(unit) micro-Teslas]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;azimuth,pitch,roll&amp;lt;/code&amp;gt;&lt;br /&gt;
|Measured in degrees. 0=North, 90=East, 180=South, 270=West; -180..180; -90..90&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;pressure&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Atmospheric pressure in [http://en.wikipedia.org/wiki/Bar_(unit) millibars]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;proximity&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;&lt;br /&gt;
|Proximity in centimeters&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;rotation_vector&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;temperature&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
--[http://developer.android.com/reference/android/hardware/SensorEvent.html#values SensorEvent values]&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Managing_databases_in_Phonebot_applications&amp;diff=2051</id>
		<title>Phonebot developer&#039;s reference/Object reference/Managing databases in Phonebot applications</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference/Managing_databases_in_Phonebot_applications&amp;diff=2051"/>
				<updated>2012-08-07T11:29:10Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: Managing databases in Phonebot applications moved to Phonebot developer&amp;#039;s reference/Object reference/Managing databases in Phonebot applications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A [[Phonebot]] database is a collection of data accessed by a unique name. Databases map to tables in SQL. Database records are accessed by their zero-based index. Fields within records are accessed by their zero-based index or by their field name.&lt;br /&gt;
&lt;br /&gt;
* Use the [[Phonebot_developer%27s_reference/Object_reference#Application|Application]] object to manage databases in an application&lt;br /&gt;
** database_exists(), delete_database(), get_database(), and get_database_names()&lt;br /&gt;
* Use the [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object to manage fields and records in a database&lt;br /&gt;
* Use the [[Phonebot_developer%27s_reference/Object_reference#Record|Record]] object to manage field values in a record&lt;br /&gt;
&lt;br /&gt;
Phonebot Plus provides a [[Phonebot_developer%27s_reference/Advanced_tools#Database_browser|database browser]] to manage schema and data.&lt;br /&gt;
&lt;br /&gt;
== Object reference ==&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;exists&amp;lt;/code&amp;gt;&lt;br /&gt;
|True if the database has fields defined.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;field_size&amp;lt;/code&amp;gt;&lt;br /&gt;
|The number of fields in the database.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|The number of records in the database.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_field(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns zero-based index. -1 if the field cannot be added.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;record = add_record()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_field(index &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the field. The values in the associated field in every record in the database will be deleted. This includes those records currently referenced by variables. The index value of the remaining fields will change if those fields have a higher index value than the field being deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_record(index &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; record)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_field_info(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index = get_field_info(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Logs error if index or name does not exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_field_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;record = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Logs error if no record exits at the zero-based index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;record = get_record_by_id(id)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the record based on its unique ID. Retrieved from &amp;lt;code&amp;gt;record.id&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
Represents a record in a specific database.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;&lt;br /&gt;
|The unique ID for the record. Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;field = get_field(index &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_fields()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_field(index &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
 /* Create a database and record */&lt;br /&gt;
 db = application1.get_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
 db:database.add_field(&amp;quot;name&amp;quot;)&lt;br /&gt;
 db:database.add_field(&amp;quot;email&amp;quot;)&lt;br /&gt;
 first_rec = db:database.add_record()&lt;br /&gt;
 first_rec:record.set_field(&amp;quot;name&amp;quot;, &amp;quot;Joe Bot&amp;quot;)&lt;br /&gt;
 first_rec:record.set_field(&amp;quot;email&amp;quot;, &amp;quot;jbot@android.com&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 /* Loop through all fields in the database */&lt;br /&gt;
 for (field_index = 0; field_index &amp;lt; db:database.field_size; field_index = field_index + 1)&lt;br /&gt;
     field_name = db:database.get_field(field_index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Loop through all records in a database */&lt;br /&gt;
 for (index = 0; index &amp;lt; db:database.size; index = index + 1)&lt;br /&gt;
     rec = db:database.get_record(index)&lt;br /&gt;
     name = rec:record.get_field(&amp;quot;name&amp;quot;)&lt;br /&gt;
     email = rec:record.get_field(&amp;quot;email&amp;quot;)&lt;br /&gt;
     for (field_index = 0; field_index &amp;lt; db:database.field_size; field_index = field_index + 1)&lt;br /&gt;
         field_value = rec:record.get_field(field_index)&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Delete the new record and database */&lt;br /&gt;
 db:database.delete_record(first_rec)&lt;br /&gt;
 application1.delete_database(&amp;quot;contacts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Managing_databases_in_Phonebot_applications&amp;diff=2052</id>
		<title>Managing databases in Phonebot applications</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Managing_databases_in_Phonebot_applications&amp;diff=2052"/>
				<updated>2012-08-07T11:29:10Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: Managing databases in Phonebot applications moved to Phonebot developer&amp;#039;s reference/Object reference/Managing databases in Phonebot applications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Phonebot developer&amp;#039;s reference/Object reference/Managing databases in Phonebot applications]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2050</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2050"/>
				<updated>2012-08-04T17:03:43Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the XML as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create an empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2049</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2049"/>
				<updated>2012-08-04T17:00:14Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = add_child(xml)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Append the xml as the last child and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = create_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Create and empty element and return true/false.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_attribute(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the named attribute and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = delete_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the child at the specified index and return its value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2048</id>
		<title>Phonebot developer&#039;s reference/Object reference</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_developer%27s_reference/Object_reference&amp;diff=2048"/>
				<updated>2012-08-04T16:52:24Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: /* Json */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Container types ==&lt;br /&gt;
&lt;br /&gt;
=== Application ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;startup&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_application()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;close_module()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = database_exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns true if the database exists&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes the [[Phonebot_developer%27s_reference/Object_reference#Database|database]] and all records in it.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;database = get_database(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the database and create if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_database_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;log(message)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Log a user event.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;notify(title, text, module)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a status bar notification. The &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; will be used as the ticker text and title. The &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; is the name of the module to open when the users selects the notification.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_application(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Open a Phonebot application by passing &amp;lt;code&amp;gt;pbot:APPLICATION_NAME&amp;lt;/code&amp;gt;. Open other Android applications using their Intent URI:&lt;br /&gt;
* [http://developer.android.com/guide/appendix/g-app-intents.html Intents List: Invoking Google Applications on Android Devices]&lt;br /&gt;
* [http://developer.android.com/guide/publishing/publishing.html#UriSummary Summary of URI formats] for the Android market&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;open_module(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Module ===&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;gravity [ bottom &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; left &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; right &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; top ]&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;center_horizontal &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; center_vertical&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only array&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;orientation [ vertical &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; horizontal ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size = clear_events()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete all events and return how many were deleted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = get_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;event = pop_event()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Retrieve and delete the next event in the queue.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;show_file_dialog(path, filter, includeFiles)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Display a file browser dialog. If an item is selected, the module&amp;#039;s on_service event will fire. The selected item will be contained in the module&amp;#039;s event queue.&lt;br /&gt;
* path - the path to the initial folder or file&lt;br /&gt;
* filter - an array of file masks, values can be:&lt;br /&gt;
** *xxx - match the end of a file name&lt;br /&gt;
** xxx* - match the beginning of a file name&lt;br /&gt;
** xxx - match the file name exactly&lt;br /&gt;
* includeFile - boolean, true to list files, false to exclude files and ignore the filter&lt;br /&gt;
&lt;br /&gt;
See [[Using the Phonebot file object]] for managing files.&lt;br /&gt;
&lt;br /&gt;
See [[Using Phonebot services]] for information on application-level services.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_open&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_close&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any service&amp;#039;s &amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt; fires.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Visual types ==&lt;br /&gt;
&lt;br /&gt;
See [[Using display properties]] for details on accessing display properties.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_height [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;layout_width [ fill_container &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; wrap_content ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;type [ button &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; check &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; drop_down_list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; edit &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; image &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; label &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; list &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; radio ]&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;visible&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_click&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
=== Check box ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drop down list ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot_developer%27s_reference/Object_reference#List|List]].&lt;br /&gt;
&lt;br /&gt;
=== Edit box ===&lt;br /&gt;
&lt;br /&gt;
Events&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;on_update&amp;lt;/code&amp;gt;&lt;br /&gt;
|Fires after any change to the contents&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Image ===&lt;br /&gt;
&lt;br /&gt;
The image control uses the [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|display properties]] configure what image is displayed and how it is displayed.&lt;br /&gt;
&lt;br /&gt;
=== Label ===&lt;br /&gt;
&lt;br /&gt;
=== List ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
The text property can contain a semi-colon-delimited list of values to populate the list.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_index&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;selected_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. The text of column zero of the selected row&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;col&amp;lt;/code&amp;gt; values can be either zero, for the display value, or a non-numeric value to retrieve the previously set named data value.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_item(item)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add and item to the list and return the index of the added item.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_item(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;item = get_item(row, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_items(col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_item(row, col, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type, col)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 /* Add 10 rows */&lt;br /&gt;
 for (index = 0; index &amp;lt; 10; index = index + 1)&lt;br /&gt;
     list1.add_item(&amp;quot;New item &amp;quot; &amp;amp; index)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the string displayed in the 5th row */&lt;br /&gt;
 list1.set_item(4, 0, &amp;quot;New text for the row&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, 0)                   /* will retrieve &amp;quot;New item 4&amp;quot; */&lt;br /&gt;
 &lt;br /&gt;
 /* Set and get the a named data value for the 5th row */&lt;br /&gt;
 list1.set_item(4, &amp;quot;my data&amp;quot;, &amp;quot;hidden value&amp;quot;)     /* Note: the row must already exist. */&lt;br /&gt;
 list1.set_item(4, &amp;quot;more data&amp;quot;, &amp;quot;another value&amp;quot;)  /* Note: the row must already exist. */&lt;br /&gt;
 row_val = list1.get_item(4, &amp;quot;my data&amp;quot;)           /* will retrieve &amp;quot;hidden value&amp;quot; */&lt;br /&gt;
&lt;br /&gt;
=== Radio button ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|true/false&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using Phonebot services#Object_reference|Using Phonebot services: Object reference]]&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Tacit, set/return value by default&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Array ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of values. Values are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_element(element)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = byte_to_string()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert an array of bytes to a string. C.f. [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;element = get_element(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the array elements with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;unique()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete any duplicate values. The first value will be retained and subsequent duplicates will be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Database|Managing databases: Database]].&lt;br /&gt;
&lt;br /&gt;
=== Datetime ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_duration(formatted_value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add a duration to the datetime. Values are strings in the format:&lt;br /&gt;
 DURATION[y|M|d|h|m|s]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;datetime = difference(datetime)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Calculates the difference between the two &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;s.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = format(format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Uses the Java [http://download.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html#datepattern date format pattern syntax]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;format_difference()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Formats the &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; value returned by &amp;lt;code&amp;gt;difference()&amp;lt;/code&amp;gt;. Formatted as &amp;lt;code&amp;gt;HH:mm:ss&amp;lt;/code&amp;gt;. The result is only valid within a 24 hour range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;now()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;parse(value, format)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the datetime to the string &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; formatted as &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
See [[Phonebot developer&amp;#039;s reference/Object reference/Using the Phonebot file object|Using the Phonebot file object]]&lt;br /&gt;
&lt;br /&gt;
=== Json ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt; &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; &lt;br /&gt;
|Read-only. Returns the size of the JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the name/value pair and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = delete_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Delete the JSON object at the specified index and return the deleted object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns the named value or a JSON array.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = get_record(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Returns a value or JSON object at the index.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the name/value pair to the JSON object.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = set_record(index, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add the JSON value to a JSON array at the specified index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Map ===&lt;br /&gt;
&lt;br /&gt;
Manage a collection of names mapped to values. Pairs are stored in the order they are added; sorting reorders and eliminates the original order.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = add_named_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Add an element to the end of the collection.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;add_names(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;delete_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;boolean = exists(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_element(name)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value mapped by &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name = get_name(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the name at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_names()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;value = get_value(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get the value at &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = get_values()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_names(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the names with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = join_values(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Join the values with delimiter and return the string.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;reverse()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = set_element(name, value)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Set the element. Log runtime error if it doesn&amp;#039;t exist.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;sort(type)&amp;lt;/code&amp;gt;&lt;br /&gt;
|0 = alpha-numeric by value, 1 = numeric by value, 2 = alpha-numeric by name, 3 = numeric by name&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Number ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = average(array)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Sets the value to the average and returns that value.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = fraction()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns 0.y&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = integer()&amp;lt;/code&amp;gt;&lt;br /&gt;
|x.y returns x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;TBD&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;number = random(min, max)&amp;lt;/code&amp;gt;&lt;br /&gt;
|A random number between min and max&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;number = round()&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt; x.5 returns x; &amp;gt;= x.5 returns x + 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Record ===&lt;br /&gt;
&lt;br /&gt;
See [[Managing_databases_in_Phonebot_applications#Record|Managing databases: Record]].&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;index = index_of(string)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = replace_all(value, replacement)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = split(delimiter)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;string = substring(start_index, end_index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;array = to_byte_array()&amp;lt;/code&amp;gt;&lt;br /&gt;
|Convert the string to an array of their decimal value representation. C.f. [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]].&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== XML ===&lt;br /&gt;
&lt;br /&gt;
Parse and query XML and HTML data.&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;is_valid&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Element name.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Number of children.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
|Read-only. Text content.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Methods&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Syntax&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;map = get_attributes()&amp;lt;/code&amp;gt;&lt;br /&gt;
|The element&amp;#039;s attribute names mapped to their values.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml = get_child(index)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;xml &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; array = query(xpath)&amp;lt;/code&amp;gt;&lt;br /&gt;
|Query the document using [http://www.w3.org/TR/xpath/ XPath] and return XML or an array of attribute values. Use &amp;lt;code&amp;gt;xml.is_valid&amp;lt;/code&amp;gt; to determine whether XML or an array has been returned. Uses a subset of the syntax supported by the [http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html Java XPath library]. The following location path expressions are supported:&lt;br /&gt;
 /foo/bar&lt;br /&gt;
 //bar&lt;br /&gt;
 /foo/bar/*&lt;br /&gt;
 /for/@id (returns array)&lt;br /&gt;
 /foo/bar/text() (returns array)&lt;br /&gt;
Predicates are not supported:&lt;br /&gt;
 /foo[@bar=&amp;#039;bat&amp;#039;]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	<entry>
		<id>http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2047</id>
		<title>Phonebot release schedule</title>
		<link rel="alternate" type="text/html" href="http://ether.scottdstrader.com/index.php?title=Phonebot_release_schedule&amp;diff=2047"/>
				<updated>2012-08-04T16:46:22Z</updated>
		
		<summary type="html">&lt;p&gt;Sstrader: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Changes made for each version of the [[Phonebot]] Android app.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Date&lt;br /&gt;
!Phonebot version&lt;br /&gt;
!Phonebot Plus version&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|4 Aug 2012&lt;br /&gt;
|1.1.18&lt;br /&gt;
|2.0.18&lt;br /&gt;
|Added: Edit methods added to the [[Phonebot_developer%27s_reference/Object_reference#Json|JSON]] and [[Phonebot_developer%27s_reference/Object_reference#XML|XML]] objects. Easily create and update these formats to use for internal storage or with Web service calls.&lt;br /&gt;
|-&lt;br /&gt;
|19 Jul 2012&lt;br /&gt;
|1.1.17&lt;br /&gt;
|2.0.17&lt;br /&gt;
|Added: [[Using the Phonebot file object|File object]] to manage files and folders, supports create, delete, copy, move, and multiple forms of read and write; added [[Phonebot_developer%27s_reference/Object_reference#Array|array.byte_to_string()]] and [[Phonebot_developer%27s_reference/Object_reference#String|string.to_byte_array()]] to convert binary data; Fixed: local variable sometime not initialized when method called multiple times.&lt;br /&gt;
|-&lt;br /&gt;
|29 Jun 2012&lt;br /&gt;
|1.1.16&lt;br /&gt;
|2.0.16&lt;br /&gt;
|Added: Inserting controls, display icons in graph when the [[Phonebot_developer%27s_reference/Object_reference#Application|application]] or [[Phonebot_developer%27s_reference/Object_reference#Module|module]] is closed from script, context menu item to set startup module; Fixed: title in property pages, script not displaying in [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus).&lt;br /&gt;
|-&lt;br /&gt;
|24 Jun 2012&lt;br /&gt;
|1.1.15&lt;br /&gt;
|2.0.15&lt;br /&gt;
|Added: module with controls larger than screen will scroll; Fixed: logging filter not updating, pasted controls missing their script events, writeable script builder not scrolling.&lt;br /&gt;
|-&lt;br /&gt;
|20 Jun 2012&lt;br /&gt;
|1.1.14&lt;br /&gt;
|2.0.14&lt;br /&gt;
|Fixed: Crash when running in the background and memory is cleared; [[Phonebot_developer%27s_reference/Object_reference#Application|notifications]] with different modules opening the same module; [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] sometimes not getting created.&lt;br /&gt;
|-&lt;br /&gt;
|7 Jun 2012&lt;br /&gt;
|1.1.13&lt;br /&gt;
|2.0.13&lt;br /&gt;
|Added: Show startup module as application icon; report when empty events fire during [[Phonebot_developer%27s_reference/Advanced_tools#Script_debugger|debug]] (Phonebot Plus). Fixed: Crash when using non-system [[Using Phonebot services|services]] with a [[Phonebot_developer%27s_reference/Object_reference#Application|notification]].&lt;br /&gt;
|-&lt;br /&gt;
|2 Jun 2012&lt;br /&gt;
|1.1.12&lt;br /&gt;
|2.0.12&lt;br /&gt;
|Added: File dialog for setting an [[Phonebot_developer%27s_reference/Object_reference#Image|image]] control&amp;#039;s image source (Phonebot Plus only); &amp;lt;code&amp;gt;show_file_dialog()&amp;lt;/code&amp;gt; method for [[Phonebot_developer%27s_reference/Object_reference#Module|module]]s.&lt;br /&gt;
|-&lt;br /&gt;
|22 May 2012&lt;br /&gt;
|1.1.11&lt;br /&gt;
|2.0.11&lt;br /&gt;
|Added: [[Phonebot properties|Auto-start property]] for specifying applications to run on startup. Fixed: Intermittent crash when debugging applications with services.&lt;br /&gt;
|-&lt;br /&gt;
|7 May 2012&lt;br /&gt;
|1.1.10&lt;br /&gt;
|2.0.10&lt;br /&gt;
|Fixed: Parser errors; deprecated properties displaying in script builders.&lt;br /&gt;
|-&lt;br /&gt;
|1 May 2012&lt;br /&gt;
|1.1.9&lt;br /&gt;
|2.0.9&lt;br /&gt;
|Added: Database script generation for Phonebot Plus. Fixed: Parser errors on some [[Phonebot_developer%27s_reference/Script_language#Scope|scoped variables]] and some [[Phonebot_developer%27s_reference/Script_language#Complex_types|coerced]] method calls.&lt;br /&gt;
|-&lt;br /&gt;
|29 Apr 2012&lt;br /&gt;
|1.1.8&lt;br /&gt;
|2.0.8&lt;br /&gt;
|Added: get_display() and set_display() methods for modules and controls (see [[Using display properties]] on the wiki), clipboard menu for layout editor. Fixed: parsing negative numbers.&lt;br /&gt;
|-&lt;br /&gt;
|21 Apr 2012&lt;br /&gt;
|1.1.7&lt;br /&gt;
|2.0.7&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Advanced_tools#Display_properties|image control]]. Fixed: module not displaying correctly when opened from [[Phonebot_developer%27s_reference/Object_reference#Application|notify() method]], hiding invisible controls&lt;br /&gt;
|-&lt;br /&gt;
|9 Apr 2012&lt;br /&gt;
|&lt;br /&gt;
|2.0.6&lt;br /&gt;
|Fixed: crash when using the application list clipboard menu.&lt;br /&gt;
|-&lt;br /&gt;
|5 Apr 2012&lt;br /&gt;
|1.1.6&lt;br /&gt;
|2.0.5&lt;br /&gt;
|Added: [[Using_Phonebot_services#Phone_events|phone service]] to monitor phone and SMS events; [[Phonebot_developer%27s_reference/Object_reference#Application|application]].database_exists() method and [[Phonebot_developer%27s_reference/Object_reference#Database|database]].exists property.&lt;br /&gt;
|-&lt;br /&gt;
|31 Mar 2012&lt;br /&gt;
|1.1.5&lt;br /&gt;
|2.0.4&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#Application|application]].notify() method to create status bar notifications. Fixed: running modules from edit mode.&lt;br /&gt;
|-&lt;br /&gt;
|28 Mar 2012&lt;br /&gt;
|1.1.4&lt;br /&gt;
|2.0.3&lt;br /&gt;
|Updated: services can now run when the application loses focus. See &amp;quot;[[Using Phonebot services]]&amp;quot; in the wiki. [[Phonebot_developer%27s_reference/Object_reference#Database|Database]] object delete fixed and clear added.&lt;br /&gt;
&lt;br /&gt;
Note: The service lifecycle has changed and has been more fully defined in this version. Some existing applications may need to be updated.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.3&lt;br /&gt;
|2.0.2&lt;br /&gt;
|Added: add, edit, and toggle [[Phonebot_developer%27s_reference/Script_language#Control_structures|comments]] in script. Fixed: crash when parsing invalid script.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1.1.2&lt;br /&gt;
|2.0.1&lt;br /&gt;
|Added: [[Phonebot_developer%27s_reference/Object_reference#List|list]].get_items(); [[Phonebot_developer%27s_reference/Object_reference#Array|array]].exists(). Fixed: property and method sorting in script builders; saving list control padding.&lt;br /&gt;
|-&lt;br /&gt;
|7 Mar 2012&lt;br /&gt;
|1.1.1&lt;br /&gt;
|2.0.0&lt;br /&gt;
|Release of [[Phonebot developer&amp;#039;s reference/Advanced tools|Phonebot Plus]]. Merge functionality with Phonebot.&lt;br /&gt;
|-&lt;br /&gt;
|29 Oct 2011&lt;br /&gt;
|1.0.0&lt;br /&gt;
|&lt;br /&gt;
|Release of Phonebot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Phonebot]]&lt;/div&gt;</summary>
		<author><name>Sstrader</name></author>	</entry>

	</feed>