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

<channel>
	<title>coding &#187; dbus</title>
	<atom:link href="http://www.coding.com.br/tag/dbus/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coding.com.br</link>
	<description>have you coded today?</description>
	<lastBuildDate>Thu, 18 Aug 2011 17:29:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>idéia inspiradas por applescript, kde e d-bus</title>
		<link>http://www.coding.com.br/usabilidade/ideia-inspiradas-por-applescript-kde-e-d-bus/</link>
		<comments>http://www.coding.com.br/usabilidade/ideia-inspiradas-por-applescript-kde-e-d-bus/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 23:32:19 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[usabilidade]]></category>
		<category><![CDATA[apple script]]></category>
		<category><![CDATA[dbus]]></category>
		<category><![CDATA[kde]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1033</guid>
		<description><![CDATA[Tudo começou numa tentativa que fiz para automatizar uma tarefa - reiniciar o AirPort no MacOSX - em 10 minutos no Google consegui as informações necessárias para fazer um script na linguagem AppleScript. Isso me fez pensar em algumas coisas sobre a interatividade que obtemos nos ambientes atuais e as possibilidades nos ambientes livres. 

Veja um exemplo [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><em>Tudo começou numa tentativa que fiz para automatizar uma tarefa - reiniciar o AirPort no MacOSX - em 10 minutos no Google consegui as informações necessárias para fazer um script na linguagem AppleScript. Isso me fez pensar em algumas coisas sobre a interatividade que obtemos nos ambientes atuais e as possibilidades nos ambientes livres. </em></p>
<p style="text-align: justify;">
<p style="text-align: justify;">Veja um exemplo feito no <em><a href="http://developer.apple.com/applescript/" target="_blank">AppleScript</a></em> simples para mostrar a janela com as preferências de rede (<em>System Preferences -&gt; Network</em>).</p>
<h5>Nota: (1) se o você for testar e seu sistema estiver em Português, lembre-se de traduzir os nomes entre aspas.  (2) Para rodar os scripts é preciso marcar a opção <em>Enable access for assistive Devices em System Preferences -&gt; Universal Access</em></h5>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Preferences&quot;</span>
	<span style="color: #0066ff;">activate</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> current pane <span style="color: #ff0033; font-weight: bold;">to</span> pane <span style="color: #009900;">&quot;com.apple.preference.network&quot;</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p>Para desligar/ligar o AirPort:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">tell</span> process <span style="color: #009900;">&quot;System Preferences&quot;</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">window</span> <span style="color: #009900;">&quot;Network&quot;</span>
			<span style="color: #ff0033; font-weight: bold;">tell</span> group <span style="color: #000000;">1</span>
				<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">exists</span> button <span style="color: #009900;">&quot;Turn Airport Off&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					click button <span style="color: #009900;">&quot;Turn AirPort Off&quot;</span>
					delay <span style="color: #000000;">3</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
				<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">exists</span> button <span style="color: #009900;">&quot;Turn Airport On&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					click button <span style="color: #009900;">&quot;Turn AirPort On&quot;</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
			<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p style="text-align: justify;">Veja que é uma tradução em palavras (praticamente verbos no imperativo) do que seria o processo feito no modo gráfico. Se você programa em Python, existe um <a href="http://aurelio.net/doc/as4pp.html" target="_blank">comparativo</a>.</p>
<p style="text-align: justify;"><strong>Ambientes livres</strong></p>
<p style="text-align: justify;">E é justamente com Python que vejo uma alternativa interessante para controlar as aplicações como o <em>System Settings. <span style="font-style: normal;">Talvez o jeito mais fácil de fazer isso seria através de uma comunicação IPC como o <a href="http://techbase.kde.org/Development/Tutorials/D-Bus/Introduction" target="_blank">D-BUS</a> . Inclusive o system settings é exportado em</span> org.kde.systemsettings<span style="font-style: normal;">.</span></em></p>
<pre>$ qdbus org.kde.systemsettings</pre>
<p style="text-align: justify;">Resumindo, o acesso pode<strong> não</strong> ser tão fácil quanto no <em>AppleScript </em>mas o &#8220;meio&#8221; já existe em ambiente gráficos tal como KDE e  GNOME. O Python lida muito bem com este tipo de comunicação e é uma saída para quem está procurando um jeito para controlar seu ambiente de forma automatizada.</p>
<p style="text-align: justify;"><strong>Futuro</strong></p>
<p style="text-align: justify;">Na minha opinião há uma deficiência para (A) pessoas leigas, se quiserem, controlar seus aplicativos de forma automatizada e (B) melhorar as formas de usabilidade nas interfaces <strong>já</strong> existentes.</p>
<p style="text-align: justify;">Fico imaginando se não seria interessante um investimento (e pesquisa) para criar linguagens de programação que herdem construções da &#8220;fala&#8221; para acessar aplicativos, para no futuro utilizar da &#8220;voz&#8221; humana para controlar o computador.</p>
<p>O software livre é um terreno vasto para esse tipo de experiência. Cito algumas tecnologias que tornaria isso possível:</p>
<ul>
<li><a href="http://dbus.freedesktop.org" target="_blank">D-bus</a> para comunicação entre os aplicativos</li>
<li><a href="http://www.python.org" target="_blank">Python</a> como linguagem de programação para construir as &#8220;amarras&#8221;</li>
<li><a href="http://www.nltk.org" target="_blank">NTLK </a> (<em>N</em><em>atural Language Toolkit</em>) para processar a linguagem</li>
</ul>
<p>Se você trabalhar com algum tipo de pesquisa na área ou tem experiência, por favor, deixe um comentário.</p>
<p>Bom começo de semana a todos.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/usabilidade/ideia-inspiradas-por-applescript-kde-e-d-bus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
