<?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>windows &#8211; Sandy Scott&#039;s Web Spot</title>
	<atom:link href="https://www.sandyscott.net/tag/windows/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sandyscott.net</link>
	<description>My little corner of the web</description>
	<lastBuildDate>Thu, 14 May 2020 07:33:10 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Best ssh setup for windows</title>
		<link>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/</link>
					<comments>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 03 May 2020 15:51:57 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mintty]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Windows Subsystem for Linux]]></category>
		<category><![CDATA[WSL]]></category>
		<category><![CDATA[WSLtty]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=280</guid>

					<description><![CDATA[I&#8217;ve tried quite a few different setups for administering my various linux boxen from Windows, and this is currently my favourite: Mintty for WSL (aka WSLtty). Here&#8217;s how to set it up. Install Windows Subsystem for Linux (WSL): Open Powershell as an administrator Enter this command:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux When...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve tried quite a few different setups for administering my various linux boxen from Windows, and this is currently my favourite: Mintty for WSL (aka WSLtty).</p>



<p>Here&#8217;s how to set it up.</p>



<h2 class="wp-block-heading">Install Windows Subsystem for Linux (WSL):</h2>



<ol class="wp-block-list"><li>Open Powershell as an administrator</li><li>Enter this command:<br><code>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</code></li><li>When it&#8217;s done, restart your computer.</li></ol>



<h2 class="wp-block-heading">Install Linux (on WSL)</h2>



<p>I recommend Debian &#8211; it&#8217;s well supported by the community, and a pretty lightweight install compared to some of the other choices.</p>



<p>For the local windows store</p>



<ol class="wp-block-list"><li>Open the Windows Store</li><li>Search for &#8220;Debian&#8221;</li><li>Click on Get</li><li>Click on Install</li></ol>



<p>Once it&#8217;s installed:</p>



<ol class="wp-block-list"><li>Find and click on the Debian app in your start menu</li><li>Wait for a moment, then set up a username for this local installation of linux. It&#8217;ll be slightly more convenient if you use the same username you have on your remote linux machines.</li><li>Exit the terminal: type:<br><code>exit</code><br>and press enter.</li></ol>



<p>This info came from <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">https://docs.microsoft.com/en-us/windows/wsl/install-win10</a></p>



<h2 class="wp-block-heading">Install WSLtty</h2>



<ol class="wp-block-list"><li>Go to <a href="https://github.com/mintty/wsltty/releases/latest">https://github.com/mintty/wsltty/releases/latest</a></li><li>Choose the right release for your system &#8211; unless you have a fairly old computer it&#8217;ll be the one ending in &#8220;x86_64.exe&#8221;</li><li>Download and install.</li><li>This app isn&#8217;t digitally signed in a way approved by Microsoft, so a warning will pop up (&#8220;Windows protected your PC&#8221;). Click <strong>More info</strong> then <strong>Run anyway</strong>.</li></ol>



<h2 class="wp-block-heading">Run and connect!</h2>



<p>Mintty should have installed a shortcut called &#8220;WSL Terminal&#8221; with the linux penguin icon, click on it and you&#8217;ll get a black terminal windows with prompt in the top left: <code>[your unix username]@[computer name]:~$</code></p>



<p>Let&#8217;s get your local linux system up to date:</p>



<ol class="wp-block-list"><li>Type <code>sudo apt update</code> then press enter.</li><li>Type in your local linux password (that you created earlier)</li><li><code>sudo apt upgrade</code>, then press <code>y</code> and enter when asked if you want to continue</li><li>It may take a little while, depending on the speed of your pc and internet connection.</li><li>Finally lets install ssh:<br><code>sudo apt install ssh</code></li></ol>



<p>Now we can connect to a remote linux computer:</p>



<p>If the username on the remote computer is the same as the one you created earlier, the command is:<br><code>ssh remotelinuxcomputer.example.com</code> or <code>ssh 192.168.2.1</code>, when you put in the computer&#8217;s name or ip address.</p>



<p>If the username is different, no problem, do this:<br><code>ssh joebloggs@remotelinuxcomputer.example.com</code><br>or<br><code>ssh joebloggs@192.168.2.1</code></p>



<p>In either case, you will probably get a warning about &#8220;the authenticity of the host xxxxx can&#8217;t be established&#8221;. Don&#8217;t worry, just type yes, then enter you password for the remote computer, and you&#8217;re in!</p>



<h2 class="wp-block-heading">One final tip</h2>



<p>If ssh into remote computers is all your do with this, then log out, the login command will be remembered by the shell, even if you reboot.<br>Next time you open the WSL terminal, press the &#8220;Up&#8221; as many times as you need to scroll through the command history and find the one you wanted.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Copy Folders without Files</title>
		<link>https://www.sandyscott.net/2017/10/copy-folders-without-files/</link>
					<comments>https://www.sandyscott.net/2017/10/copy-folders-without-files/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 13 Oct 2017 19:06:26 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[robocopy]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=238</guid>

					<description><![CDATA[If you want to copy a complete folder structure, but not the files contained in it, use robocopy from the command line: robocopy "A:\Source folder" "B:\Destination folder" /e /xf * This is lifted straight from https://superuser.com/a/873585/178934, I&#8217;m just putting it here for my quick reference.<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2017/10/copy-folders-without-files/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>If you want to copy a complete folder structure, but not the files contained in it, use robocopy from the command line:</p>
<p><code>robocopy "A:\Source folder" "B:\Destination folder" /e /xf *</code></p>
<p>This is lifted straight from <a href="https://superuser.com/a/873585/178934">https://superuser.com/a/873585/178934</a>, I&#8217;m just putting it here for my quick reference.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2017/10/copy-folders-without-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Windows PowerShell &#8211; get a recursive list of directories</title>
		<link>https://www.sandyscott.net/2016/04/windows-powershell-get-a-recursive-list-of-directories/</link>
					<comments>https://www.sandyscott.net/2016/04/windows-powershell-get-a-recursive-list-of-directories/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sat, 30 Apr 2016 13:12:28 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=203</guid>

					<description><![CDATA[Like this: dir -Directory -Recurse &#124; % { $_.FullName } > list.txt<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2016/04/windows-powershell-get-a-recursive-list-of-directories/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>Like this:<br />
<code>dir -Directory -Recurse | % { $_.FullName } > list.txt</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2016/04/windows-powershell-get-a-recursive-list-of-directories/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SpiderOak Purge Historical versions</title>
		<link>https://www.sandyscott.net/2016/04/spideroak-purge-historical-versions/</link>
					<comments>https://www.sandyscott.net/2016/04/spideroak-purge-historical-versions/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 24 Apr 2016 17:34:23 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SpiderOak]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=198</guid>

					<description><![CDATA[I don&#8217;t like the default for SpiderOak&#8217;s &#8211;purge-historical-versions command, which does this: This allows you to remove historical versions of files in your backup set according to the following schedule, which is to keep one version per hour for the last 24 hours, then one version per day for 30...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2016/04/spideroak-purge-historical-versions/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>I don&#8217;t like the default for SpiderOak&#8217;s &#8211;purge-historical-versions command, which does this:</p>
<blockquote><p>
This allows you to remove historical versions of files in your backup set according to the following schedule, which is to keep one version per hour for the last 24 hours, then one version per day for 30 days, then one version per week thereafter.</p></blockquote>
<p>So here&#8217;s my own version, which does:</p>
<ul>
<li>One version per hour for the last 24 hours</li>
<li>Then one version per day for 14 days</li>
<li>Then one version per week for 8 weeks</li>
<li>Then one version per month thereafter</li>
</ul>
<p>On Windows<br />
<code>"C:\Program Files\SpiderOakONE\SpiderOakONE.exe" --purge-historical-versions h24,d30,w8,m --verbose</code></p>
<p>On Linux<br />
<code>SpiderOakONE --purge-historical-versions h24,d30,w8,m --verbose</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2016/04/spideroak-purge-historical-versions/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Gimp Plugin &#8211; fixed crop</title>
		<link>https://www.sandyscott.net/2016/04/gimp-plugin-fixed-crop/</link>
					<comments>https://www.sandyscott.net/2016/04/gimp-plugin-fixed-crop/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Tue, 12 Apr 2016 13:42:11 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=188</guid>

					<description><![CDATA[This is a simple script to crop a plugin with fixed dimensions &#8211; I used it to crop out the window border from a VNC Client connected to an industrial touchscreen. (script-fu-register "script-fu-crop" ;func name "Screenshot Crop" ;menu label "Crops an image to a fixed size" ;description "Sandy Scott" ;author...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2016/04/gimp-plugin-fixed-crop/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>This is a simple script to crop a plugin with fixed dimensions &#8211; I used it to crop out the window border from a VNC Client connected to an industrial touchscreen.</p>
<pre>(script-fu-register
    "script-fu-crop"                    ;func name
    "Screenshot Crop"                   ;menu label
    "Crops an image to a fixed size"    ;description
    "Sandy Scott"                       ;author
    ""                                  ;copyright notice
    "January 11, 2015"                  ;date created
    ""               ;image type that the script works on
    SF-IMAGE    "Image"                 0
    SF-DRAWABLE "Drawable"              0
)
(script-fu-menu-register "script-fu-crop" "<img>/Filters/Custom/")
(define (script-fu-crop image drawable)

    ; Prep
    (gimp-context-push)
    (gimp-image-undo-group-start image)
    
    ; Crop the image
    (gimp-image-crop image 800 480 8 30)
    
    ; Finishing Off
    (gimp-image-undo-group-end image)
    (gimp-context-pop)
    (gimp-displays-flush)
)
</pre>
<p>Save in the gimp scripts folder, something like <code>C:\Users\JoeBloggs\.gimp-2.8\scripts\</code> on Windows, or <code>/home/JoeBloggs/.gimp-2.8/scripts/</code> on Linux.</p>
<p>It will appear under Filters &gt; Custom</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2016/04/gimp-plugin-fixed-crop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>List all the files in a windows directory</title>
		<link>https://www.sandyscott.net/2013/11/list-all-the-files-in-a-windows-directory/</link>
					<comments>https://www.sandyscott.net/2013/11/list-all-the-files-in-a-windows-directory/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 22 Nov 2013 10:26:02 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=58</guid>

					<description><![CDATA[Ever wanted to list all the files in a directory tree &#8211; I tend to find this useful when checking if there&#8217;s anything in a mass of automatically generated directories Use this command: dir /S /A:-D /B Here&#8217;s what the switches mean: /S Look in all subdirectories /A:-D Don&#8217;t show...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2013/11/list-all-the-files-in-a-windows-directory/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>Ever wanted to list all the files in a directory tree &#8211; I tend to find this useful when checking if there&#8217;s anything in a mass of automatically generated directories</p>
<p>Use this command:</p>
<pre>dir /S /A:-D /B</pre>
<p>Here&#8217;s what the switches mean:</p>
<dl>
<dt>/S</dt>
<dd>Look in all subdirectories</dd>
<dt>/A:-D</dt>
<dd>Don&#8217;t show subdirectories in the list of files</dd>
<dt>/B</dt>
<dd>Bare Format.  Just shows the path, no extra information</dd>
</dl>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2013/11/list-all-the-files-in-a-windows-directory/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>VirtualBox direct access to SD Card in Windows</title>
		<link>https://www.sandyscott.net/2013/08/virtualbox-direct-drive-access/</link>
					<comments>https://www.sandyscott.net/2013/08/virtualbox-direct-drive-access/#comments</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Wed, 14 Aug 2013 15:18:51 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[eGalax Touch]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[virtualbox]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows 7]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=38</guid>

					<description><![CDATA[I&#8217;ve trying to get my Raspberry Pi working with a touchscreen (eGalax Touch). This blog post has been an incredible help, but I stumbled at the very last hurdle &#8211; modifying the contents of the SD card. You see, my compile system (Ubuntu 13.04) was in a virtual machine (VM)...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2013/08/virtualbox-direct-drive-access/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve trying to get my Raspberry Pi working with a touchscreen (eGalax Touch).</p>
<p>This <a href="http://www.engineering-diy.blogspot.ro/2013/01/adding-7inch-display-with-touchscreen.html">blog post</a> has been an incredible help, but I stumbled at the very last hurdle &#8211; modifying the contents of the SD card.</p>
<p>You see, my compile system (Ubuntu 13.04) was in a virtual machine (VM) &#8211; VirtualBox running on Windows 7.</p>
<p>Windows 7 doesn&#8217;t know how to read the various linux filesystems, so they&#8217;re invisible, which means I needed to access to the whole, raw disk directly from the VM.</p>
<p>Here&#8217;s a step-by-step guide to directly mounting raw SD card in your virtual machine, so you can edit it.</p>
<ol>
<li><strong>Get the DeviceID for you SD Card reader</strong></li>
<p>Open a command window as an administrator. (Press Start, type <strong>cmd</strong>, right click on <strong>cmd.exe</strong> in the list, and choose &#8220;Run as administrator&#8221;)</p>
<p>type</p>
<pre>wmic diskdrive list brief
</pre>
<p>and if your system is anything like mine you&#8217;ll get something like this:</p>
<pre>C:\Users\Sandy Scott&gt;wmic diskdrive list brief
Caption                      DeviceID            Model                        Partitions  Size
WDC WD7500BPKT-75PK4T0       \\.\PHYSICALDRIVE0  WDC WD7500BPKT-75PK4T0       3           750153761280
O2Micro SD SCSI Disk Device  \\.\PHYSICALDRIVE1  O2Micro SD SCSI Disk Device  1           3964584960
</pre>
<p>The top item is the main hard drive, the lower one is the SD card.</p>
<p>The bit we&#8217;re interested in is the <strong>DeviceID</strong>, in this case <strong>\\.\PHYSICALDRIVE1</strong></p>
<li><strong>Navigate to the VirtualBox directory</strong></li>
<p>Next thing you&#8217;ll need to find is the installation directory for VirtualBox. This is usually <strong>C:\Program Files\Oracle\VirtualBox\</strong>. You&#8217;ll know it&#8217;s the right one if it has lots of files starting with <strong>VBox</strong> in it.</p>
<p>Go there by entering this command</p>
<pre>cd C:\Program Files\Oracle\VirtualBox
</pre>
<li><strong>Create the link file to the SD card</strong></li>
<pre>VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%/Desktop/sdcard.vmdk" -rawdisk "\\.\PHYSICALDRIVE1"
</pre>
<p>The file you&#8217;ve just created (<strong>sdcard.vmdk</strong>, on your Desktop) is a special link that lets a virtual machine access the SD card.</p>
<li><strong>Connect the VM to the SD card using the link</strong></li>
<p>Now, open VirtualBox <span style="text-decoration: underline;">as Administrator</span>, and open the <strong>Settings</strong> for your virtual machine. Go to <strong>Storage -&gt; Controller: SATA -&gt; (right click) Add Hard Disk -&gt; Choose Existing Disk</strong> and open the file you just created.</p>
<p>Fire up the VM and you should be able to access the SD card in all it&#8217;s glory!</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2013/08/virtualbox-direct-drive-access/feed/</wfw:commentRss>
			<slash:comments>42</slash:comments>
		
		
			</item>
		<item>
		<title>Batch Editing with Gimp Script-fu</title>
		<link>https://www.sandyscott.net/2013/08/batch-editing-with-gimp-script-fu/</link>
					<comments>https://www.sandyscott.net/2013/08/batch-editing-with-gimp-script-fu/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 04 Aug 2013 14:49:07 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[script-fu]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=28</guid>

					<description><![CDATA[A couple of days I posted a short script, that did a few very simple tasks &#8211; that was just a start, to help me get into Gimp Scripting, and help with a little job. Today&#8217;s task is quite a bit meatier. I&#8217;m doing tech for a play, and I...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2013/08/batch-editing-with-gimp-script-fu/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>A couple of days I posted a short script, that did a few very simple tasks &#8211; that was just a start, to help me get into Gimp Scripting, and help with a little job.</p>
<p>Today&#8217;s task is quite a bit meatier.</p>
<p>I&#8217;m doing tech for a play, and I want a copy of the script that I can mark up.  I&#8217;ve scanned the whole thing, but it has all the usual problems with scans &#8211; pages aren&#8217;t aligned, background isn&#8217;t white, and you can see text on the other side of the page showing through.</p>
<p>All these can be fixed, and some even automated.</p>
<p>I&#8217;m not enough of an image processing wizard to fix the alignment automatically, but Gimp&#8217;s rotate and crop tools should do you proud!  I found the <strong>Fixed->Size</strong> option in <strong>Rectangle Select</strong> very useful for getting all the output images the same size.</p>
<p>The script does the rest, read the comments (anything after a &#8220;;&#8221; on a line) to see how it works.</p>
<pre>
(script-fu-register
            "script-fu-scan-text-enhance"  ;func name
            "Scanned Text Enhance"         ;menu label
            "Scanned Text Enhancement"     ;description
            "Sandy Scott"                  ;author
            "Copyright 2013, Sandy Scott"  ;copyright notice
            "August 4, 2013"               ;date created
            "*"                            ;image type that the script works on
            SF-IMAGE       "Input image" 0
            SF-DRAWABLE    "Input drawable" 0 
            )
(script-fu-menu-register "script-fu-scan-text-enhance" "<Image>/Filters/Text")

(define (script-fu-scan-text-enhance image drawable)

    (let* ( )    
        
        ; Prep
        (gimp-context-push)
        (gimp-image-undo-group-start image)
        
        ; Actual work here
        
        ; Duplicate Layer
        (gimp-image-insert-layer image (car (gimp-layer-copy (car (gimp-image-get-active-layer image)) FALSE)) 0 0)
        
        ; Threshold
        (gimp-threshold (car  (gimp-image-get-active-drawable image)) 127 255)
        
        ; Select by Colour
        (gimp-context-set-antialias TRUE)
        (gimp-context-set-feather TRUE)
        (gimp-context-set-feather-radius 1.5 1.5)
        (gimp-context-set-sample-merged FALSE)
        (gimp-context-set-sample-threshold-int 1)
        (gimp-context-set-sample-transparent FALSE)
        (gimp-image-select-color image CHANNEL-OP-REPLACE (car  (gimp-image-get-active-drawable image)) '(0 0 0))
        
        ; Grow Selection
        (gimp-selection-grow image 1)
        (gimp-selection-invert image)
        
        ; Hide Duplicated Layer
        (gimp-item-set-visible (car  (gimp-image-get-active-drawable image)) FALSE)
        
        ; Activate Bottom Layer
        (gimp-image-set-active-layer image (vector-ref (cadr (gimp-image-get-layers image)) (- (vector-length (cadr (gimp-image-get-layers image))) 1)))
        
        
        ; Fill Selection with White
        (gimp-edit-fill (car  (gimp-image-get-active-drawable image)) WHITE-FILL)
        
        ; Clear Selection
        (gimp-selection-none image)
        
        ; Finishing Off
        (gimp-image-undo-group-end image)
        (gimp-context-pop)
        (gimp-displays-flush)
    )
)
</pre>
<p>Save with a <strong>.scm</strong> file extension put this in your scripts Directory (go to <strong>Edit->Preferences->Folders->Scripts</strong> if you don&#8217;t know where that is) then reload scripts (<strong>Filters->Script-Fu->Refresh Scripts</strong>).  It should appear as <strong>Filters->Text->Scanned Text Enhance</strong>.</p>
<p>That&#8217;s all well and good if you&#8217;ve only got one image.  What if you&#8217;ve got 80?  Let&#8217;s automate this with a script.</p>
<p>The above script does the actual work of manipulating the image &#8211; the next one does the donkey work of loading the file, starting the manipulation script, then saving the file.  In this case, it just saves over the old file, so make sure you&#8217;ve got a copy of the original in case it goes wrong.  This should also be saved with a <strong>.scm</strong> extension in your scripts directory.</p>
<pre>
(define (scan-text-enhance filename)
    (let* (
            (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
            (drawable (car (gimp-image-get-active-layer image))) )
        (script-fu-loot-prep2 image drawable)
        (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
        (gimp-image-delete image)
    )
)
</pre>
<p>This has helped a bit &#8211; this script allows us run the text processing with only one piece of information &#8211; the filename, but how do you run it?<br />
Type this into your command line:</p>
<pre>
"C:\Program Files\GIMP 2\bin\gimp-console-2.8.exe" -i -b "(scan-text-enhance \"filename.png\")" -b "(gimp-quit 0)"
</pre>
<p>You might need to change the path to your installation of Gimp, and also filename.png to the path to your image.</p>
<p>Finally, to automate this, I&#8217;m going to use a batch file.  Make a batch file with this text:</p>
<pre>
for %%x in (*.png) do "C:\Program Files\GIMP 2\bin\gimp-console-2.8.exe" -i -b "(script-enhance \"%%x\")" -b "(gimp-quit 0)"
</pre>
<p>This will run our script on all the <strong>.png</strong> images in the current directory.</p>
<p>Thanks to:<br />
<a href="http://www.gimp.org/tutorials/Basic_Batch/" title="Gimp Tutorials: GIMP Batch Mode">Gimp Tutorials: GIMP Batch Mode</a><br />
<a href="http://docs.gimp.org/2.8/en/gimp-using-script-fu-tutorial.html" title="Gimp Docs: A Script-Fu Tutorial">Gimp Docs: A Script-Fu Tutorial</a><br />
<a href="http://superuser.com/questions/536654/windows-batch-processing-images-with-gimp-and-saving-them-to-new-files" title="SuperUser: Windows batch processing images with gimp and saving them to new files" target="_blank">SuperUser: Windows batch processing images with gimp and saving them to new files</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2013/08/batch-editing-with-gimp-script-fu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>A basic Gimp script-fu</title>
		<link>https://www.sandyscott.net/2013/08/a-basic-gimp-script-fu/</link>
					<comments>https://www.sandyscott.net/2013/08/a-basic-gimp-script-fu/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sat, 03 Aug 2013 14:54:38 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[script-fu]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=24</guid>

					<description><![CDATA[I&#8217;ve just been playing with Gimp, and getting to grips with the scripting system. I&#8217;m sharing a very basic script &#8211; it only does two simple tasks: Sets the image to Grayscale Rotates 90 degrees counter-clockwise It doesn&#8217;t need any extra parameters, so I thought I&#8217;d share it as a...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2013/08/a-basic-gimp-script-fu/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve just been playing with Gimp, and getting to grips with the scripting system.</p>
<p>I&#8217;m sharing a very basic script &#8211; it only does two simple tasks:</p>
<ul>
<li>Sets the image to Grayscale</li>
<li>Rotates 90 degrees counter-clockwise</li>
</ul>
<p>It doesn&#8217;t need any extra parameters, so I thought I&#8217;d share it as a very simple example that you can adapt to your needs!</p>
<pre>
(script-fu-register
    "script-fu-test-script"                     ;func name
    "Test Script"                               ;menu label
    "Test script that does a few simple tasks"  ;description
    "Sandy Scott"                               ;author
    "Copyright 2013, Sandy Scott"               ;copyright notice
    "August 3, 2013"                            ;date created
    "*"                                         ;image type that the script works on
    SF-IMAGE       "Input image" 0
    SF-DRAWABLE    "Input drawable" 0 
            )
(script-fu-menu-register "script-fu-test-script" "<Image>/Filters/Test")

(define (script-fu-test-script image drawable)

    (let* ( )
        
        ; Prep
        (gimp-context-push)
        (gimp-image-undo-group-start image)
        
        ; Actual work here
        
        ; Convert to grayscale
        (gimp-image-convert-grayscale image)
        ;Rotate 90 CCW
        (gimp-image-rotate image ROTATE-270)
        
        ; Finishing Off
        (gimp-image-undo-group-end image)
        (gimp-context-pop)
        (gimp-displays-flush)
    )
)
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2013/08/a-basic-gimp-script-fu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ruby Serial Port</title>
		<link>https://www.sandyscott.net/2013/05/ruby-serial-port/</link>
					<comments>https://www.sandyscott.net/2013/05/ruby-serial-port/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Tue, 14 May 2013 09:06:52 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[com]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=18</guid>

					<description><![CDATA[Ever wanted to get Ruby talking to a serial Device? The key step is getting the Development Kit set up, which will allow you to install the serialport gem from source Download &#038; Install Ruby. If you&#8217;re on windows, the RubyInstaller is great Download &#038; Install the DevKit. Find the...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2013/05/ruby-serial-port/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>Ever wanted to get Ruby talking to a serial Device?</p>
<hr />
<p>The key step is getting the Development Kit set up, which will allow you to install the serialport gem from source</p>
<ol>
<li>Download &#038; Install Ruby.  If you&#8217;re on windows, the <a href="http://rubyinstaller.org/downloads/">RubyInstaller</a> is great</li>
<li>Download &#038; Install the DevKit.  Find the installer on the page above, use these <a href="https://github.com/oneclick/rubyinstaller/wiki/Development-Kit">installation instructions</a></li>
<li>Install the serialport gem as normal:<br />
<code>gem install serialport</code></li>
</ol>
<p>And you should be good to go!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2013/05/ruby-serial-port/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
