<?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>Paper Jammed &#187; Macros</title>
	<atom:link href="http://paperjammed.com/tag/macros/feed/" rel="self" type="application/rss+xml" />
	<link>http://paperjammed.com</link>
	<description>Has paper taken over your life?</description>
	<lastBuildDate>Tue, 17 Aug 2010 00:01:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A handful of sweet freebie tools to save the day</title>
		<link>http://paperjammed.com/2010/03/16/a-handful-of-sweet-freebie-tools-to-save-the-day/</link>
		<comments>http://paperjammed.com/2010/03/16/a-handful-of-sweet-freebie-tools-to-save-the-day/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 03:31:14 +0000</pubDate>
		<dc:creator>Tad</dc:creator>
				<category><![CDATA[Searching and Indexing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Macros]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://paperjammed.com/?p=930</guid>
		<description><![CDATA[It so happens that my employer has made a most welcome decision to replace the aging creaky old Novell GroupWise mail software with Microsoft Outlook, joining the rest of the modern corporate world. Now, there is little love in my heart for GroupWise, but it does have one feature that the new Outlook configuration will [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-935" title="iStock_000000846660XSmall" src="http://paperjammed.com/wp-content/uploads/2010/03/iStock_000000846660XSmall-300x199.jpg" alt="" width="300" height="199" />It so happens that my employer has made a most welcome decision to replace the aging creaky old Novell GroupWise mail software with Microsoft Outlook, joining the rest of the modern corporate world. Now, there is little love in my heart for GroupWise, but it does have one feature that the new Outlook configuration will lack: you can keep as many emails as you want, just like Gmail.</p>
<p>The problem is this: with Outlook we will be limited to 1000 messages in our in-box; sadly, many of us have tens of thousands of emails in our old GroupWise mail. Even after a fairly rigorous slash and burn mission, hacking out all of the low hanging fruit, there will be many thousands remaining and I don&#8217;t want to lose that information. It might be useful to search and find how I set up a Zebra bar code printer in 2003, no?</p>
<p>A bundle of different freeware glue tools came to my rescue. Read on to hear about the toolset that has made it so I can keep those messages for years to come.<span id="more-930"></span></p>
<p><strong>Possible Solutions</strong></p>
<p>Right out of the gate, I began looking for ways to migrate messages from one mail client to the other. Some apps have this built right in, and if not, there are scripts and utilities out there to do this; but I was hampered by a few key facts:</p>
<ul>
<li>I have no control over the email clients and their configuration. Even if there is a menu option for exporting GroupWise messages from version 7.2, I&#8217;m stuck at 6.4 and cannot use that option.</li>
<li>GroupWise is a minor player in the email world. I&#8217;m not sure if Outlook would import from GroupWise, but I doubt it.</li>
<li>They are <em>replacing</em> the client in one shot. There will be no interim period where both GroupWise and Outlook will be available.</li>
<li>There is no getting around the hard limit of 1000 messages.</li>
<li>I don&#8217;t want to spend money on this.</li>
</ul>
<p>With these constraints in mind, I immediately thought about PDF documents. I then considered the following questions:</p>
<ul>
<li>How do I convert my email to PDF?</li>
<li>How can I do this automatically with thousands of emails?</li>
<li>Once I&#8217;m done, how do I search these documents?</li>
</ul>
<p>Here&#8217;s what I did:</p>
<p><strong>Conversion to PDF</strong></p>
<p>The first part was easy. I downloaded one of the many free print-to-PDF products available.</p>
<p>I chose <a href="http://sourceforge.net/projects/pdfcreator/">PDFCreator</a>, because I am familiar with its use and I know that it <a href="http://paperjammed.com/2009/10/27/dodged-the-corrupt-document-bullet-this-time-just-barely/">does not munge the fonts</a>.</p>
<p>Like many other PDF generation utilities, PDFCreator functions by providing a virtual printer to which any application can print. For example, to make a PDF of a web page, you use the Firefox <strong>Print</strong> menu and select <strong>PDFCreator</strong> from the drop-down list of available printers.</p>
<p>You are provided with a list of metadata fields that you can fill in, and these fields are used in the PDF generation.</p>
<p>Here&#8217;s what the PDFCreator screen looks like:</p>
<p><img class="alignnone size-full wp-image-931" title="20100316-pdfcreator1" src="http://paperjammed.com/wp-content/uploads/2010/03/20100316-pdfcreator1.gif" alt="" width="500" height="367" /></p>
<p><strong>A word of caution:</strong> PDF Creator is free, but you must be careful to deselect their spammy toolbar options in two different places during the installation process. I don&#8217;t like software that comes with preselected toolbars to install (even nice ones like Google&#8217;s) because I&#8217;m certain that 95% of the folks who actually install the toolbar would never have chosen to do so if it were unchecked by default.</p>
<p><strong>Running Everything Automatically</strong></p>
<p>This was the interesting bit. I work with Windows machines at work, so there was no AppleScript option available. So I did the next best thing: I used <a href="http://www.autoitscript.com/autoit3/index.shtml">AutoIT</a>.</p>
<p>I will warn you that AutoIT is pretty much the Windows analog of AppleScript, without the cutesy pseudo English syntax. In other words, you will need to roll up your sleeves and get your hands a little dirty in order to put together a decent AutoIT script.</p>
<p>The payoff comes when you finish your work and compile it into a tight executable that you can share with your friends, allowing them to automate some complex series of button clicks and copy/paste operations.</p>
<p>I walked through the manual process of exporting an email to PDF and listed each action:</p>
<ul>
<li>Get the date, sender, and subject</li>
<li>Create a filename based on date + sender + subject</li>
<li>Launch the <strong>Print</strong> dialog</li>
<li>Select <strong>PDFCreator</strong></li>
<li>Fill in the <strong>Document Title</strong>, <strong>Creation Date</strong>, and <strong>Subject</strong> in the PDFCreator dialog</li>
<li>Fill in the full file path in the Save dialog</li>
</ul>
<p>In addition, I wanted to make the script a little better by adding the following:</p>
<ul>
<li>Check that user has PDFCreator installed</li>
<li>Verify that GroupWise is running and that the user has selected one or more messages</li>
<li>Prompt the user for a target directory before processing the messages</li>
<li>Sanitize the filenames by replacing illegal characters with underscores and truncating to meet maximum filename and path length in Windows</li>
<li>Skip over files that have already been generated, quickly, so that one doesn&#8217;t need to worry about accidentally selecting messages that were already printed</li>
</ul>
<p>There were other adjustments needed, but the process was the same: run the script, hit a problem, tweak the script a little to address the problem, and repeat.</p>
<p>Here&#8217;s a little bit of the AutoIT script:</p>
<p><img class="size-full wp-image-943 alignnone" title="20100316-autoit" src="http://paperjammed.com/wp-content/uploads/2010/03/20100316-autoit.gif" alt="" width="500" height="345" /></p>
<p>You can see that it is a bit more intense than AppleScript, but remember that the full script wasn&#8217;t written in one go. I had a little short ten-line script that I kept tweaking as small problems cropped up until I had adjusted things to my liking.</p>
<p>Note that this is a GUI macro language. The machine starts clicking and typing away right in front of you and you probably shouldn&#8217;t interfere until your script finishes.</p>
<p>As of this afternoon, I have generated around 4,000 PDF documents for my email messages.</p>
<p><strong>Searching All of Those Documents</strong></p>
<p>This was the easiest part. These days there is an excellent tool available for searching documents on your desktop: <a href="http://desktop.google.com/">Google Desktop</a>. This product indexes every useful file on your desktop and provides a full Google search with a quick double-tap of the &lt;control&gt; key.</p>
<p>So you can enter a search like &#8220;Zebra bar code&#8221;</p>
<p><img class="alignnone size-full wp-image-944" title="20100316-google1" src="http://paperjammed.com/wp-content/uploads/2010/03/20100316-google1.gif" alt="" width="300" height="205" /></p>
<p>And the results look exactly like a Google web search, but it&#8217;s showing your desktop files. And you can see inline previews too.</p>
<p><img class="alignnone size-full wp-image-945" title="20100316-google2" src="http://paperjammed.com/wp-content/uploads/2010/03/20100316-google2.gif" alt="" width="500" height="443" /></p>
<p>Macintosh users can install Google Desktop as well, but all of these files should already be indexed and searchable by Spotlight.</p>
<p><strong>Closing Thoughts</strong></p>
<p>Whenever I reach for tools like this I feel a twinge of guilt—it&#8217;s outright hackery, isn&#8217;t it?</p>
<p>But there is a place for quick and dirty jobs in every workplace. I needed to get my files from one place to another, one time only. It just didn&#8217;t make sense to spend money or time on a more elegant solution.</p>
<p>Play around with each of these tools a little. Especially AutoIT—it&#8217;s a handy Swiss Army Knife to have at your disposal.</p>
]]></content:encoded>
			<wfw:commentRss>http://paperjammed.com/2010/03/16/a-handful-of-sweet-freebie-tools-to-save-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smooth out the bumps in your workflow with desktop scripting tools</title>
		<link>http://paperjammed.com/2009/03/10/smooth-out-the-bumps-in-your-workflow-with-desktop-scripting-tools/</link>
		<comments>http://paperjammed.com/2009/03/10/smooth-out-the-bumps-in-your-workflow-with-desktop-scripting-tools/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 02:06:05 +0000</pubDate>
		<dc:creator>Tad</dc:creator>
				<category><![CDATA[Scanning]]></category>
		<category><![CDATA[Searching and Indexing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tools of the Trade]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[Macros]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://paperjammed.com/?p=339</guid>
		<description><![CDATA[Work flow is inherent in the kind of work that we do when scanning, indexing, searching, filing, tagging, and backing up all of our documents, photos, music, and video. Once you are committed to digital media, you will find that you often need to cobble together different programs in order to do away with some of the tedious manual labor.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-340" src="http://paperjammed.com/wp-content/uploads/2009/03/istock_000004776175xsmall.jpg" alt="" width="341" height="226" />I love new software—when I order something new, such as the latest iLife suite, I eagerly check the UPS website to see if the package has been delivered, and I race home to try it out.</p>
<p>Of course, it is only a matter of days, or even hours, before the new glow has worn off and I begin to grouse about the things I wish they had done and I grumble about the nit-picky little bugs that are always there.</p>
<p>Even when the program works perfectly, we often want to use it in a work flow, using each program for what it does best.</p>
<p>Work flow is inherent in the kind of work that we do when scanning, indexing, searching, filing, tagging, and backing up all of our documents, photos, music, and video. Once you are committed to digital media, you will find that you often need to cobble together different programs in order to do away with some of the tedious manual labor.</p>
<p>Scripting tools can be as simple as macro recorders, as fancy as drag-and-drop pipelining tools, and as complex as full programming languages. Choose one that fits you and use it to bridge the gaps in your work flow.<span id="more-339"></span></p>
<p><strong>An Example</strong></p>
<p>I have never had a harsh thought about my sheet-fed scanner, the venerable <a href="http://www.fujitsu.com/us/services/computing/peripherals/scanners/scansnap/s510m.html">ScanSnap S510m</a>. But one thing has always annoyed me about the software package they provide: you can’t start scanning a new document until the OCR process is complete on the first.</p>
<p>What happens is this: you scan in a document; ScanSnap Manager receives it as a PDF and immediately passes it to Abbyy FineReader for OCR. All is good at this point.</p>
<p>But, the OCR process can take anywhere from 10 seconds to a few minutes, and if you were to scan in another document, FineReader complains:</p>
<p><img class="alignnone size-full wp-image-341" src="http://paperjammed.com/wp-content/uploads/2009/03/20090310-finereader.gif" alt="" width="434" height="199" /></p>
<p>This is where a little bit of AppleScript magic smoothed over this minor work flow annoyance.</p>
<p>I found that you can attach a bit of AppleScript as a “folder action” to a folder, and when a file appears in that folder, your AppleScript gets called. All I needed to do was figure out a way to get AppleScript to do the following:</p>
<ul>
<li>Wake up when a file appears</li>
<li>Grab the first unprocessed PDF file</li>
<li>Tell FineReader to start up, if it isn&#8217;t running</li>
<li>Tell FineReader to open the file</li>
<li>Wait for the processing to finish</li>
<li>Go back to step 2 until all files are done.</li>
</ul>
<p>It wasn’t exactly trivial—FineReader doesn’t actually have any special AppleScript support built in. But after a few experiments (i.e. a full weekend of fussing around) it was working smoothly.</p>
<p>Now I can scan as many documents as I want, knowing that OCR is happening at its own pace in a totally different flow.</p>
<p>Some day, when I have cleaned up the embarrassing bits of the code, I will share it here for fellow ScanSnap users.</p>
<p><strong>What scripting tools are out there</strong></p>
<p>The automation tools you use will depend on what software you are working with and what operating system you are using. On the Macintosh side, AppleScript and Automator will probably cover the bases. Things aren’t so pretty on the Windows side, but if you are willing to get a little dirty, Windows scripting can work miracles.</p>
<p>Whatever tool you use, I recommend finding as many simple examples on the Web as you can and running them and tweaking them slightly until you make them do what you want.</p>
<p>I am not an AppleScript programmer; I simply downloaded other people’s sample scripts that did file manipulations and poked and prodded them into shape.</p>
<p><strong>AppleScript</strong></p>
<p>In the Macintosh world, the old standby has always been AppleScript, with its quirky syntax that attempts to look like English. It is surprisingly easy to do some fairly heavy lifting with a minimal of effort.</p>
<p>In fact, though I find its syntax challenging and condescending at the same time, I heartily recommend AppleScript. The key is that Apple has built in AppleScript support to most of the main Macintosh applications.</p>
<p>For a taste of what AppleScript can do, here’s a whole mess of <a href="http://dougscripts.com/itunes/">cool scripts for automating iTunes</a>.</p>
<p>Imagine running a script that builds playlists for you or tags files automatically or finds duplicates and marks them.</p>
<p>This is the main <a href="http://www.apple.com/applescript/">AppleScript site</a>, and here&#8217;s a <a href="http://www.apple.com/applescript/firsttutorial/index.html">tutorial from Apple</a>.</p>
<p><strong>Automator</strong></p>
<p>Another Macintosh product, that provides a more graphical approach to hooking your apps together, is Automator. Here is an article that gives <a href="http://www.macdevcenter.com/pub/a/mac/2005/09/06/what-is-automator.html?CMP=OTC-13IV03560550">a good overview of the tool</a>.</p>
<p>This is what a simple work flow looks like in designer mode:</p>
<p><img class="alignnone size-full wp-image-343" src="http://paperjammed.com/wp-content/uploads/2009/03/20090310-automator.gif" alt="" width="555" height="375" /></p>
<p>You can see more or less what is going on here: You use a predefined set of actions, on the left side, to build up a pipeline on the right side.</p>
<p>In this case, the new automation action will get the selected documents, sort them, combine them into one PDF document, and then open that document in a PDF viewer.</p>
<p>I have always been a little confused with the utility of this product: it’s great if your application provides Automator actions, but what do you do if your app is like FineReader, with no special hooks built in?</p>
<p>Nevertheless, with Automator, you can do some pretty fancy things with many common tasks such as file management, email, and browsing. And there are plenty of custom Automator actions out there for the downloading.</p>
<p>Both Automator and AppleScript are Macintosh OS X built-ins.</p>
<p>For the serious Mac user, there is Bash Unix shell scripting, but that’s all I’m going to say about that. It’s there if you want it!</p>
<p><strong>Windows Scripting</strong></p>
<p>Things are somewhat different on the Windows side.</p>
<p>On the positive side, I believe that Microsoft’s <a href="http://www.microsoft.com/com/default.mspx">COM object architecture</a> makes it possible to script some pretty fancy things using off-the-shelf software.</p>
<p>In addition, the Office suite has amazing macro facilities that have been used by many as a full programming language, as the core of many successful commercial products.</p>
<p>But Windows just doesn’t seem to have anything analogous to AppleScript for gluing things together without getting your hands too dirty.</p>
<p>As a trivial example of the power of the Windows COM architecture, this <a href="http://cwashington.netreach.net/depo/view.asp?Index=142">short script</a> will launch Excel, create a fresh spreadsheet, and automatically feed in some data. To try it out, save the script to your desktop and double click it.</p>
<p>This is what I saw on my machine when I ran the script:</p>
<p><img class="alignnone size-full wp-image-344" src="http://paperjammed.com/wp-content/uploads/2009/03/20090310-excel-spreadsheet.gif" alt="" width="520" height="226" /><br />
Just like AppleScript on the Macintosh side, many Windows applications provide hooks for scripting.</p>
<p>The down side is that the scripting language is much more like a programming language, so it’s more comparable to writing shell scripts than to using a drag-and-drop automation tool like Automator.</p>
<p>But when you do the same thing over and over every day, it may be worth it to roll up your sleeves and get down and dirty with some VBScript.</p>
<p>An added benefit of this approach is that the language shares much of its functionality with Visual Basic for Applications, found in Word and Excel macros. If you are writing standalone Windows scripts, you can also write very complex Word and Excel macros. You also have the ability to do much of the same application automation within Word/Excel macros.</p>
<p><strong>AutoIT</strong></p>
<p>This is a freeware tool that many use for scripting their applications.</p>
<p>From the <a href="http://www.autoitscript.com/autoit3/">product website</a>:</p>
<ul>
<li>Easy to learn BASIC-like syntax</li>
<li>Simulate keystrokes and mouse movements</li>
<li>Manipulate windows and processes</li>
<li>Interact with all standard windows controls</li>
<li>Scripts can be compiled into standalone executables</li>
<li>Create Graphical User Interfaces (GUIs)</li>
</ul>
<p>What more could you ask for?</p>
<p><strong>Closing Thoughts</strong></p>
<p>There are other tools out there; don’t be afraid to check them out and try some of the examples. If you can automate just one annoying task that you do every day, it may be worth the hassle of spending a weekend writing the script.</p>
<p><strong>Epilogue</strong></p>
<p>Yesterday at work I finally rolled up my sleeves at work to tackle a nagging document problem that had been lingering for months.</p>
<p>We have a large quantity of PowerPoint slide decks that have critical company information embedded within. I work in the pharmaceutical industry, so many of those PowerPoint slides had chemical structures for various drug molecules embedded within as OLE objects.</p>
<p>The problem was that we wanted to extract that knowledge (the molecule files) electronically and text mine the slides, but our tools did not support PowerPoint. They did, however, support Microsoft Word.</p>
<p>How could I convert the slides to Word documents? There are dozens of ways on the Net to go in the other direction, but the only way to do what I wanted resulted in the OLE objects being converted to pictures—no good for my purpose. I did find that a copy/paste of each molecule from PowerPoint to Word worked correctly, but who wants to do that by hand with hundreds of documents?</p>
<p>After weeks of trying to find a real Microsoft developer at work to do the task, I finally gave in and tried my hand using VBScript and the Windows Scripting Host. In four hours I had the basics of a script going.</p>
<p>My simple VBScript file does the following:</p>
<ul>
<li>Prompt the user for a PowerPoint file and target directory</li>
<li>Launch PowerPoint and Word in the background</li>
<li>Loop through every slide, inspecting any OLE objects found within to see if it was created by ChemDraw or IsisBase Sketch, two common chemistry editor tools</li>
<li>If any such molecules are found, the following happens:
<ul>
<li>All of the &#8220;shapes&#8221; on the slide are copied to the clipboard</li>
<li>A new Word document is created with &#8220;Slide (1..n)&#8221; appended to the file name</li>
<li>The clipboard contents are pasted into the document</li>
</ul>
</li>
</ul>
<p>Sure, there are plenty of warts to work out, but I was happy to be able to run my script and watch as it magically consumed huge slide decks and spit out Word documents containing the exact data I was looking for. Windows Scripting Host is a powerful tool, as good as, if not better than AppleScript.</p>
<p>[Update: Added epilogue singing the joys of Windows Scripting Host]</p>
]]></content:encoded>
			<wfw:commentRss>http://paperjammed.com/2009/03/10/smooth-out-the-bumps-in-your-workflow-with-desktop-scripting-tools/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
