<?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>ThePemberton.com &#187; Scripts</title>
	<atom:link href="http://www.thepemberton.com/posts/archives/category/scripts/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thepemberton.com/posts</link>
	<description>Thoughts and discussions on topics that interest me</description>
	<lastBuildDate>Thu, 17 Jun 2010 20:45:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Reading PDFs on Kindle for free</title>
		<link>http://www.thepemberton.com/posts/archives/26</link>
		<comments>http://www.thepemberton.com/posts/archives/26#comments</comments>
		<pubDate>Mon, 04 Jan 2010 15:34:58 +0000</pubDate>
		<dc:creator>elip</dc:creator>
				<category><![CDATA[All Blogs]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[Etcetera]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://thepemberton.com/posts/archives/26</guid>
		<description><![CDATA[After much anticipation, I have finally received my new Kindle 2 in the mail. Before I purchased the Kindle, I was assured by Amazon&#8217;s Kindle purchase page that PDF was natively supported. As I have a rather large collection of PDF eBooks and documents from Project Gutenberg and more, I was sold. Having my entire [...]]]></description>
			<content:encoded><![CDATA[<div class="digg_button" style="float: left; padding-right: 5px; "><a class="DiggThisButton" href="http://digg.com/submit?url=http%3A%2F%2Fwww.thepemberton.com%2Fposts%2Farchives%2F26" rel="external" rev=", programming"><img src="http://widgets.digg.com/img/button/diggThisCompact.png" alt="DiggThis" /></a></div><p>After much anticipation, I have finally received my new Kindle 2 in the mail. Before I purchased the Kindle, I was assured by Amazon&#8217;s <a href="http://www.amazon.com/gp/product/B0015T963C?ie=UTF8&amp;tag=thepembecom-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=B0015T963C">Kindle purchase page</a> that PDF was natively supported. As I have a rather large collection of PDF eBooks and documents from <a href="http://www.gutenberg.org/browse/authors/d">Project Gutenberg</a> and more, I was sold. Having my entire library with me (which would weigh a few metric tons if printed to paper) would now weigh only 10 ounces and fit in the palm of my hand. Brilliant!<span id="more-26"></span></p>
<p><a href="http://www.amazon.com/gp/product/B0015T963C?ie=UTF8&amp;tag=thepembecom-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=B0015T963C"><img src="http://thepemberton.com/posts/wp-content/uploads/image/kindle2.jpg" border="0" alt="" align="middle" /></a></p>
<div></div>
<div>
<p>Upon receiving the Kindle, I immediately opened it up and tested out the included dictionary (this is going to be awesome for <a href="http://www.amazon.com/gp/product/B001LX4BN2?ie=UTF8&amp;tag=thepembecom-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=B001LX4BN2">Scrabble</a>), the free (yes, FREE) global 3g internet access, and the user guide. With lifetime free 3g internet access to web pages and Wikipedia, this thing is <a href="http://www.amazon.com/gp/product/0345453743?ie=UTF8&amp;tag=thepembecom-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0345453743">The Hitchhiker&#8217;s Guide to the Galaxy</a> incarnate.</p>
</div>
<div>I was afraid the screen would make my eyes tired after reading for a while, but it&#8217;s just like reading a paperback, only without the grainy texture.  The Kindle uses a new technology called E-Ink electronic paper to electronically manipulate ink at blazing fast speeds. Text size can be increased or decreased on-the-fly too, allowing me to take my glasses off for a change. It even has text-to-speech if you&#8217;re able to tolerate the lack of character in the Kindle&#8217;s voice.</div>
<p>After playing with all of the features, I immediately plugged my new Kindle in to my PC&#8217;s USB cable and transferred a few PDFs to the Documents folder of the Kindle. Nothing happened at first, but a little snooping around showed me that <a href="http://www.amazon.com/gp/help/customer/display.html?nodeId=200375430">I just needed an update to the latest Kindle firmware</a>. Once updated, I could view my PDFs, but the text was very small, and I was unable to scale it! Oh no! It appears only the Amazon (.azw), .TXT, and .MOBI files allow for text scaling.</p>
<p>After some searching around I found that you can email yourself (account_name@kindle.amazon.com) your PDFs and have them converted and delivered wirelessly to your kindle at $0.10 per document, but I also found a free way to do this and put together a few steps to make it easy. I hope this helps!</p>
<div>
<ol>
<li>Download and install the Auto Kindle eBook Converter open source software from:
<ul>
<li><a href="http://sourceforge.net/projects/autokindle/">http://sourceforge.net/projects/autokindle/</a></li>
<li>The Auto Kindle eBook Converter app is really just a set of <a href="http://www.amazon.com/gp/product/B001O7HEPC?ie=UTF8&amp;tag=thepembecom-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=B001O7HEPC">AutoIT macros</a> and other freeware and/or open source apps to automate the conversion of PDF to HTML, and HTML to .MOBI, which is natively supported by the Kindle.</li>
</ul>
</li>
<li>Open your registry (Start -&gt; Run, type &#8220;regedit&#8221;) and under<strong> HKEY_CLASSES_ROOT/*/Shell</strong> add a new key called &#8220;<strong>Convert to Kindle format</strong>&#8220;.</li>
<li>Add another key to this called &#8220;command&#8221; and double-click &#8220;Default&#8221; and set the value to:
<ul>
<li>&#8220;C:\Program Files\Kindle Auto eBook Converter\Auto Kindle.exe&#8221; %1</li>
<li>It should look something like this:</li>
</ul>
<p><img src="http://thepemberton.com/posts/wp-content/uploads/image/registry_kindle_1.jpg" border="1" alt="" width="874" height="249" /></p>
<div style="page-break-after: always;"><span style="display: none;"> </span></div>
</li>
<li>Now, when you right click any PDF, LIT, CHM, or HTML file in Explorer, you can choose &#8220;Convert to Kindle format&#8221; without having to do them one at a time!<br />
<img src="http://thepemberton.com/posts/wp-content/uploads/image/registry_kindle_2.jpg" border="1" alt="" width="656" height="162" /></p>
<div style="page-break-after: always;"><span style="display: none;"> </span></div>
</li>
</ol>
</div>
<p><strong>Tips: </strong></p>
<div>
<ul>
<li>If you select multiple books it&#8217;ll likely take some time between each of them. I noticed up to a 20 second wait between two PDFs where nothing happened. Rest assured it will resume though. If you have a large collection, try letting it run overnight.</li>
<li>To speed up conversion time, in the Auto Kindle Config program (Start -&gt; All Programs -&gt; Auto Kindle eBook Converter), disable conversion of images (uncheck &#8220;Process PDF Images&#8221;). I set mine to look like this to also ensure that the .MOBI file will end up in the same directory as my PDF, for easy finding:<br />
<img src="http://thepemberton.com/posts/wp-content/uploads/image/registry_kindle_3.jpg" border="1" alt="" width="501" height="180" /></p>
<div style="page-break-after: always;"><span style="display: none;"> </span></div>
</li>
<li>Some of the programs that the Auto Kindle eBook Converter macro set uses include nag text when converting some document types. For example the <a href="http://www.processtext.com/abclit.html">ABC Amber LIT Converter</a> program (used to convert LIT to other formats) will insert their URL on each page of your document. To remove this &#8220;Amber line&#8221; go to &#8220;C:\Program Files\Kindle Auto eBook Converter\app\&#8221; and double-click &#8220;abcpalm.exe&#8221;. At the top, click T, then O (for Options) and uncheck the &#8220;add Amber Line&#8221; checkbox, and click OK.<br />
<img src="http://thepemberton.com/posts/wp-content/uploads/image/registry_kindle_4.jpg" border="1" alt="" width="652" height="585" /></p>
<div style="page-break-after: always;"><span style="display: none;"> </span></div>
</li>
</ul>
</div>
<p>Found a better way? Leave a comment and I&#8217;ll be sure to review it! I&#8217;m especially looking for something that will retain the Table of Contents for PDFs!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepemberton.com/posts/archives/26/feed</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>How to use proxies in iMacros Firefox plugin, and adjust firefox settings on the fly!</title>
		<link>http://www.thepemberton.com/posts/archives/23</link>
		<comments>http://www.thepemberton.com/posts/archives/23#comments</comments>
		<pubDate>Thu, 23 Jul 2009 10:14:41 +0000</pubDate>
		<dc:creator>elip</dc:creator>
				<category><![CDATA[All Blogs]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://thepemberton.com/posts/archives/23</guid>
		<description><![CDATA[If you haven&#8217;t used iMacros for Firefox yet, you&#8217;re missing out. You can do things like record your browsing habbits (button clicks, entered text, responses to dialogs, etc) to automate them. It has CSV support, so you can even use stored data to dynamically execute macros, directly from Firefox on Windows, Mac, and Linux. The [...]]]></description>
			<content:encoded><![CDATA[<div class="digg_button" style="float: left; padding-right: 5px; "><a class="DiggThisButton" href="http://digg.com/submit?url=http%3A%2F%2Fwww.thepemberton.com%2Fposts%2Farchives%2F23" rel="external" rev=", programming"><img src="http://widgets.digg.com/img/button/diggThisCompact.png" alt="DiggThis" /></a></div><p>If you haven&#8217;t used <a href="https://addons.mozilla.org/en-US/firefox/addon/3863" target="_blank">iMacros for Firefox</a> yet, you&#8217;re missing out. You can do things like record your browsing habbits (button clicks, entered text, responses to dialogs, etc) to automate them. It has CSV support, so you can even use stored data to dynamically execute macros, directly from Firefox on Windows, Mac, and Linux.<span id="more-23"></span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/nLLaQywneE0&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/nLLaQywneE0&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The iMacros Firefox plugin is free, but the  Pro edition is the best. It supports proxies natively, is much faster, and has many other functions not available to Firefox. <a href="https://www.plimus.com//jsp/redirect.jsp?contractId=1677905&amp;referrer=scriptamp" target="_blank">Click here to check it out.</a></p>
<p>But if you&#8217;re looking to try it out before buying (or are too broke to get the Pro edition), you might want to keep reading. I&#8217;ll show you how to add proxy support to the Firefox plugin, and really change any Firefox config option you want with iMacros!</p>
<p>A little backstory:</p>
<p>I was searching for the ability to use proxies in macros for my own personal use, and wanted an easy language to learn. I spent a few hours searching, and iMacros seemed to be the best. The macro scripting language is super easy to learn, and there&#8217;s a ton of examples on their site. So I installed the plugin for Firefox, and started creating my macro.</p>
<p>I quickly discovered that the Firefox plugin doesn&#8217;t support proxies! After hours of searching for some other free macro engine that&#8217;s web-centric, I found nothing. I thought about writing a Firefox plugin to allow typed addresses in the URL bar to change info in Firefox&#8217;s about:config page. That could be bad though. Real bad. If users started installing it, it would only be a matter of time until someone used a hrefs maliciously and there was an epidemic of broken Firefoxes. What to do&#8230;</p>
<p>And then, epiphany. I recall some time ago a friend sent me a silly snippet of JavaScript code that you could paste into the address bar, and it would replace all the images with his own. Kind of rude, actually. Funny, but rude.</p>
<p>So, I opened up <a href="http://thepemberton.com/posts/archives/24">about:config</a>. If you&#8217;re not aware, about:config lets you tweak almost every aspect of Firefox&#8217;s behavior and communications. <a href="http://thepemberton.com/posts/archives/24" target="_blank">Click here to read about it.</a></p>
<p>I had to use a few tools to get the source and general idea of what was happening in about:config, since I had never written a Firefox plugin or done any scripting with Firefox. After a few moments, I was able to construct a line of Javascript that changed one of the integer settings in about:config. Awesome! As it turns out, changing string settings is a bit more complicated to do via address bar JavaScript, but after digging deeper into the FireFox chrome source for about:config, I found a way.</p>
<p>If you don&#8217;t have FireFox iMacros installed, now would be the time to get it: <a href="https://addons.mozilla.org/en-US/firefox/addon/3863" target="_blank">https://addons.mozilla.org/en-US/firefox/addon/3863</a></p>
<p>To change a setting in about:config from iMacros (or any other macro engine for Firefox I suppose &#8211; just change the syntax), here&#8217;s the javascript:</p>
<p>For integer values:</p>
<p><span style="background-color: #c0c0c0; font-family: Courier New;">URL GOTO=about:config<br />
URL GOTO=javascript:gPrefBranch.setIntPref(&#8220;SETTING.NAME&#8221;,INTEGER_VALUE);</span></p>
<p>Just change &#8220;SETTING.NAME&#8221; to the name of the setting, like layout.spellcheckDefault, and INTEGER_VALUE to the desired integer value <img src='http://www.thepemberton.com/posts/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For string values, this gets a little more complicated:</p>
<p style="background-color: #c0c0c0;"><span style="font-family: Courier New;">URL GOTO=about:config<br />
URL GOTO=javascript:var&lt;SP&gt;prefb&lt;SP&gt;=&lt;SP&gt;Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);var&lt;SP&gt;str&lt;SP&gt;=&lt;SP&gt;Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);str.data&lt;SP&gt;=&lt;SP&gt;&#8221;STRING VALUE&#8221;;prefb.setComplexValue(&#8220;SETTING.NAME&#8221;,&lt;SP&gt;Components.interfaces.nsISupportsString,&lt;SP&gt;str);</span></p>
<p>Change &#8220;STRING VALUE&#8221; to the desired value, and &#8220;SETTING.NAME&#8221; to the setting name.</p>
<p>And for boolean values:</p>
<p style="background-color: #c0c0c0;"><span style="font-family: Courier New;">URL GOTO=about:config<br />
URL GOTO=gPrefBranch.setBoolPref(&#8220;SETTING.NAME&#8221;, true or false);</span></p>
<p>Once again, change &#8220;SETTING.NAME&#8221; to the desired Boolean variable, and &#8220;true or false&#8221; to either true or false.</p>
<p>So, now on to the fun stuff. Using it in a macro to change the proxy. For this example, I created a csv file at C:\sample.csv</p>
<p>In that csv file, I specified the following:</p>
<p>&#8220;ExampleURLtoVisit&#8221;,&#8221;proxyIP&#8221;,&#8221;proxyPort&#8221;<br />
&#8220;http://whatismyip.com&#8221;,&#8221;192.168.1.1&#8243;, 8080<br />
&#8220;http://whatismyip.com&#8221;,&#8221;10.10.36.1&#8243;, 3128</p>
<p>Here&#8217;s the code to use it::</p>
<p><span style="background-color: #c0c0c0; font-family: Courier New;">VERSION BUILD=6240709 RECORDER=FX<br />
TAB T=1<br />
SET !DATASOURCE example.csv<br />
SET !DATASOURCE_COLUMNS 4<br />
PROMPT Enter&lt;SP&gt;the&lt;SP&gt;App&lt;SP&gt;OAuth&lt;SP&gt;URL: !VAR1<br />
&#8216;Increase the current position in the file with each loop<br />
SET !LOOP 2<br />
SET !DATASOURCE_LINE {{!LOOP}}<br />
&#8216;clear cookies and cache:<br />
CLEAR<br />
URL GOTO=about:config<br />
&#8216;some proxies are slow, set the timeout to 90 seconds:<br />
URL GOTO=javascript:gPrefBranch.setIntPref(&#8220;network.http.keep-alive.timeout&#8221;,900);<br />
URL GOTO=about:config<br />
&#8216;set the proxy URL<br />
URL GOTO=javascript:var&lt;SP&gt;prefb&lt;SP&gt;=&lt;SP&gt;Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);var&lt;SP&gt;str&lt;SP&gt;=&lt;SP&gt;Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);str.data&lt;SP&gt;=&lt;SP&gt;&#8221;{{!COL2}}&#8221;;prefb.setComplexValue(&#8220;network.proxy.http&#8221;,&lt;SP&gt;Components.interfaces.nsISupportsString,&lt;SP&gt;str);<br />
URL GOTO=about:config<br />
&#8216;set the proxy port:<br />
URL GOTO=javascript:gPrefBranch.setIntPref(&#8220;network.proxy.http_port&#8221;,{{!COL3}});<br />
URL GOTO=about:config<br />
&#8216;turn the proxy on<br />
URL GOTO=javascript:gPrefBranch.setIntPref(&#8220;network.proxy.type&#8221;,1);<br />
&#8216;log in:<br />
URL GOTO={{!COL1}}<br />
&#8216;see:<br />
WAIT SECONDS=5<br />
&#8216;disable proxy:<br />
URL GOTO=about:config<br />
URL GOTO=javascript:gPrefBranch.setIntPref(&#8220;network.proxy.type&#8221;,0);</span></p>
<p>Obviously the possibilities here are near limitless. Do a few google searches, this can be used for a TON of things. Some ideas:</p>
<ul>
<li>Change the user agent (general.useragent.override)</li>
<li>Stop sending referer headers: (network.http.sendRefererHeader)</li>
<li>Disable images on the fly for the purpose of faster macros (permissions.default.image)</li>
</ul>
<p><strong>Note: This is what&#8217;s used in the free script on <a href="http://www.scriptamp.com/myspaceappsmogul" target="_blank">http://www.scriptamp.com/myspaceappsmogul</a></strong></p>
<p>Have fun, scripters!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepemberton.com/posts/archives/23/feed</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
	</channel>
</rss>
