<?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>Huddled Masses &#187; Command Line</title>
	<atom:link href="http://huddledmasses.org/tag/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Fri, 27 Apr 2012 05:42:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Clip.exe and the missing Paste.exe</title>
		<link>http://huddledmasses.org/clipexe-and-the-missing-pasteexe/</link>
		<comments>http://huddledmasses.org/clipexe-and-the-missing-pasteexe/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 16:13:23 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=783</guid>
		<description><![CDATA[One of the guys on #PowerShell in IRC was asking about how to get the contents of the clipboard in PowerShell, and after we had tried several different scripts, we realized that in Version 1, because PowerShell runs in an MTA thread, you cannot access the clipboard without creating a new thread (in STA mode). [...]]]></description>
			<content:encoded><![CDATA[	<p>One of the guys on <a href="irc://irc.freenode.net/PowerShell">#PowerShell in IRC</a> was asking about how to <strong>get</strong> the contents of the clipboard in PowerShell, and after we had tried several different scripts, we realized that in Version 1, because PowerShell runs in an <a href="http://support.microsoft.com/kb/150777"><span class="caps">MTA</span> thread</a>, you cannot access the clipboard without creating a new thread (in <span class="caps">STA</span> mode).  After I got done ranting, and pointing out that everyone needs to use PowerShell v2 (yeah, it&#8217;s still in <span class="caps">CTP</span>, so I was mostly kidding) in <a href="http://support.microsoft.com/kb/150777">-STA</a> mode &#8230; I whipped together the C# one liner and stuck it into a class with instructions for compiling, and figured I might as well share.</p>

	<p>The code is <a href="clipexe-and-the-missing-pasteexe#more-783">below</a>. There are two files: Clip.cs and Paste.cs &#8230; you probably only need Paste.cs, because Clip.exe is <a href="http://weblogs.asp.net/owscott/archive/2006/12/15/clip-saving-command-line-and-powershell-output-directly-to-the-clipboard.aspx">already included</a> in Windows <em>after</em> Windows XP, but for the sake of completeness (and because it was just a few lines), I wrote them both.</p>

	<p>To use them, you must compile them using <code>Csc.exe</code>, which is included as part of the .Net Framework.  If it&#8217;s not already on your path, it&#8217;s in the folder for your most recent .Net Framework version (eg: C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe  or C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe). All you have to do is run: <code>csc Paste.cs</code> and <code>csc Clip.cs</code> and you should end up with a <code>Paste.exe</code> and <code>Clip.exe</code> which you can use to copy and paste from the command-line&#8230; <span id="more-783"></span></p>

	<h3>Paste.cs</h3>

	<div class="csharp code csharp" style="font-family:monospace;"><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #0600FF;">namespace</span> Huddled <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Paste <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>STAThread<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> line <span style="color: #0600FF;">in</span> Clipboard.<span style="color: #0000FF;">GetText</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span>,<span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\n</span>&quot;</span><span style="color: #000000;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StringSplitOptions.<span style="color: #0000FF;">None</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> line <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>

	<h3>Clip.cs</h3>

	<div class="csharp code csharp" style="font-family:monospace;"><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #0600FF;">namespace</span> Huddled <span style="color: #000000;">&#123;</span><br />
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Clip <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #000000;">&#91;</span>STAThread<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span> s<span style="color: #008000;">;</span> <br />
&nbsp; &nbsp; &nbsp; StringBuilder output <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StringBuilder<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Join</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot; &quot;</span>, args<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>s <span style="color: #008000;">=</span> Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output.<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span>s<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; Clipboard.<span style="color: #0000FF;">SetText</span><span style="color: #000000;">&#40;</span> output.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/clipexe-and-the-missing-pasteexe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On user interfaces, and command lines</title>
		<link>http://huddledmasses.org/on-user-interfaces-and-command-lines/</link>
		<comments>http://huddledmasses.org/on-user-interfaces-and-command-lines/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 04:11:50 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Composable]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Lab]]></category>
		<category><![CDATA[Ubiquity]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=714</guid>
		<description><![CDATA[I just discovered ubiquity, a Firefox plugin from Mozilla labs which is really just a sort-of alpha concept preview of a new command-line interface for the web browser that they are working on. It&#8217;s extremely cool Ubiquity for Firefox from Aza Raskin on Vimeo. You should watch the video, the stuff they&#8217;re doing already is [...]]]></description>
			<content:encoded><![CDATA[	<p>I just discovered <a href="http://labs.mozilla.com/projects/ubiquity/">ubiquity</a>, a <a href="http://www.mozilla.com/firefox">Firefox</a> plugin from <a href="http://labs.mozilla.com/">Mozilla labs</a> which is really just a sort-of alpha concept <a href="http://labs.mozilla.com/2008/08/introducing-ubiquity/">preview</a> of a new command-line interface for the web browser that they are working on.  </p>

	<h3>It&#8217;s extremely cool</h3>

	<p><object height="298" width="400"><param name="allowfullscreen" value="true" />	<param name="allowscriptaccess" value="always" />	<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1561578&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" />	<embed src="http://vimeo.com/moogaloop.swf?clip_id=1561578&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="298" width="400"></embed></object><br />
<a href="http://vimeo.com/1561578?pg=embed&amp;sec=1561578">Ubiquity for Firefox</a> from <a href="http://vimeo.com/user532161?pg=embed&amp;sec=1561578">Aza Raskin</a> on <a href="http://vimeo.com?pg=embed&amp;sec=1561578">Vimeo</a>.</p>

	<p>You should watch the video, the stuff they&#8217;re doing already is kind-of exciting.  It reminded me a lot of PowerShell, so I started digging around some blogs and trying to figure out where they are going, and what their inspiration is &#8230; and now I&#8217;m <strong>really</strong> quite excited about it  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';-)' class='wp-smiley' />  and you should be too.  Won&#8217;t it be cool when you can tell Firefox something like:</p>

	<blockquote>
		<p> Hey Firefox? Take this text from this page, translate it to Spanish, encrypt it with my mom&#8217;s public key, email it to her &#8230; and oh yeah save this chain of commands as a new command so I can use it later.</p>
	</blockquote>

	<p>That&#8217;s <a href="http://jonoscript.wordpress.com/2008/07/26/why-verbs/">the vision of jono over at Mozilla Labs</a>, and it sounds pretty good to me  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' />  Although I couldn&#8217;t help but think that if I could access PowerShell from my browser and pipe in the selected text, I could do pretty much all of that with existing commands  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';-)' class='wp-smiley' /> </p>

	<p>Anyway, I thought I&#8217;d give you a few links to read about the concepts of <a href="http://portal.acm.org/toc.cfm?id=502348&#38;amp;type=proceeding&#38;amp;coll=GUIDE&#38;amp;dl=GUIDE&#38;amp;CFID=4563485&#38;amp;CFTOKEN=12182147#502368">expressive</a>, <a href="http://en.wikipedia.org/wiki/Composability">composable</a>, <a href="http://mags.acm.org/interactions/20080102/?pg=20&#38;amp;pm=2">linguistic</a>, and <a href="http://blog.mozilla.com/faaborg/2007/07/05/the-graphical-keyboard-user-interface/">partially graphical</a> interfaces. And then later on, I&#8217;ll show you mine.</p>

<h6 class="zemanta-related-title">Related articles by Zemanta</h6><ul class="zemanta-article-ul"><li class="zemanta-article-ul-li"><a href="http://www.gizmodo.com.au/2008/08/mozillas_ubiquity_for_firefox_alpha_01_looks_fantastic.html">Mozilla&#8217;s Ubiquity For Firefox Alpha 0.1 Looks Fantastic</a></li><li class="zemanta-article-ul-li"><a href="http://www.iaconsultants.ca/index.php/2008/09/02/ubiquity-for-fire-fox/">Ubiquity for Firefox</a></li><li class="zemanta-article-ul-li"><a href="http://thenewofficecoach.blogspot.com/2008/08/speaking-coherently.html">Speaking Coherently</a></li><li class="zemanta-article-ul-li"><a href="http://www.finette.co.uk/blog/index.php/2008/08/i-have-seen-the-future-and-it-is-called-ubiquity/">I have seen the future &#8211; and it is called Ubiquity</a></li><li class="zemanta-article-ul-li"><a href="http://www.u-g-h.com/2008/08/27/natural-language-in-your-browser/">Natural Language in your Browser</a></li></ul>

<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/1e94f97f-aa32-4fd7-bc12-1d0f3c0f2877/" title="Zemified by Zemanta"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=1e94f97f-aa32-4fd7-bc12-1d0f3c0f2877" alt="Reblog this post [with Zemanta]" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/on-user-interfaces-and-command-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

