<?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>POWERSHELLHAM.COM</title>
	<atom:link href="http://www.powershellham.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.powershellham.com</link>
	<description>The place for Amateur Radio automation using Powershell!</description>
	<lastBuildDate>Mon, 02 Jan 2012 17:42:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Script to create a specific WSPR call csv file</title>
		<link>http://www.powershellham.com/?p=22</link>
		<comments>http://www.powershellham.com/?p=22#comments</comments>
		<pubDate>Mon, 02 Jan 2012 17:42:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc Scripts]]></category>

		<guid isPermaLink="false">http://www.powershellham.com/?p=22</guid>
		<description><![CDATA[I had the need to download a number of WSPR CSV files so I threw together a PowerShell script.  In case anyone has the same need here is the PowerShell code to use as is at your own risk.  It goes out to the WSPR web site and downloads the month you specify unzips the [...]]]></description>
			<content:encoded><![CDATA[<p>I had the need to download a number of WSPR CSV files so I threw together a PowerShell script.  In case anyone has the same need here is the PowerShell code to use as is at your own risk.  It goes out to the WSPR web site and downloads the month you specify unzips the file and then creates a CSV file of only spots with the call specified, then it deletes the downloaded ZIP and CSV files leaving only a file by the name of the call specified .csv.  This was coded for a quick project and DOES NOT have any type of error checking and it assumes you know what input parameters are needed.  I called the script download.ps1 and it needs three parameters: the year, month and call.</p>
<p>&nbsp;</p>
<p><strong><em># Script to download WSPR spot file, unzip it and create a file with spots for only the specified  call.</em></strong></p>
<p><strong><em># By N9RO January 01, 2012</em></strong></p>
<p><strong><em># To run program CD to the script&#8217;s directory and type ./download.ps1 year month call in the</em></strong></p>
<p><strong><em># PowerShell window.  New file will appear the the script&#8217;s directory.</em></strong></p>
<p>&nbsp;</p>
<p><strong><em>param($year,$month,$call)</em></strong></p>
<p><strong><em>$source = &#8220;http://wsprnet.org/archive/wsprspots-$year-$month.csv.zip&#8221;</em></strong></p>
<p><strong><em>echo &#8220;***** Downloading file from: $source *****&#8221;</em></strong></p>
<p><strong><em>Get-Date -DisplayHint time</em></strong></p>
<p><strong><em>$destination = &#8220;c:\projects\wspr-adif\wsprspots-$year-$month.csv.zip&#8221;</em></strong></p>
<p><strong><em>$wc = New-Object System.Net.WebClient</em></strong></p>
<p><strong><em>$wc.DownloadFile($source, $destination)</em></strong></p>
<p><strong><em>echo &#8220;***** File Download Complete *****&#8221;</em></strong></p>
<p>&nbsp;</p>
<p><strong><em># Now unzip File</em></strong></p>
<p><strong><em>echo &#8220;***** Unzipping WSPR File *****&#8221;</em></strong></p>
<p><strong><em>Get-Date -DisplayHint time</em></strong></p>
<p><strong><em>$shell_app=new-object -com shell.application</em></strong></p>
<p><strong><em>$filename = &#8220;wsprspots-$year-$month.csv.zip&#8221;</em></strong></p>
<p><strong><em>$zip_file = $shell_app.namespace((Get-Location).Path + &#8220;\$filename&#8221;)</em></strong></p>
<p><strong><em>$destination = $shell_app.namespace((Get-Location).Path)</em></strong></p>
<p><strong><em>$destination.Copyhere($zip_file.items())</em></strong></p>
<p><strong><em>echo &#8220;***** Unzip complete *****&#8221;</em></strong></p>
<p>&nbsp;</p>
<p><strong><em># Create Call file</em></strong></p>
<p><strong><em>echo &#8220;***** Creating WSPR Call File for $call *****&#8221;</em></strong></p>
<p><strong><em>Get-Date -DisplayHint time</em></strong></p>
<p><strong><em>$csvfile = &#8220;C:\projects\wspr-adif\wsprspots-$year-$month.csv&#8221;</em></strong></p>
<p><strong><em>Select-String -Simple $call $csvfile &gt;&gt; &#8220;$call.csv&#8221;</em></strong></p>
<p><strong><em>echo &#8220;***** Call file created for $call *****&#8221;</em></strong></p>
<p>&nbsp;</p>
<p><strong><em># Delete files not needed</em></strong></p>
<p><strong><em>echo &#8220;***** Deleting Files Not  Needed *****&#8221;</em></strong></p>
<p><strong><em>Get-Date -DisplayHint time</em></strong></p>
<p><strong><em>Remove-Item &#8220;$csvfile&#8221;</em></strong></p>
<p><strong><em>Remove-Item &#8220;$filename&#8221;</em></strong></p>
<p><strong><em>echo &#8220;***** Files deleted *****&#8221;</em></strong></p>
<p>&nbsp;</p>
<p><strong><em>Get-Date -displayhint date</em></strong></p>
<p><strong><em>Get-Date -DisplayHint time</em></strong></p>
<p><strong><em>echo &#8220;========== WSPRDB Program Complete ==========&#8221;</em></strong></p>
<p>&nbsp;</p>
<p>Here is what it looks like when I run the program:</p>
<p>PS C:\projects\wspr-adif&gt; ./download.ps1 2011 11 n9ro</p>
<p>***** Downloading file from: http://wsprnet.org/archive/wsprspots-2011-11.csv.zip *****</p>
<p>10:54:23 PM</p>
<p>***** File Download Complete *****</p>
<p>***** Unzipping WSPR File *****</p>
<p>10:55:13 PM</p>
<p>***** Unzip complete *****</p>
<p>***** Creating WSPR Call File for n9ro *****</p>
<p>10:55:16 PM</p>
<p>***** Call file created for n9ro *****</p>
<p>***** Deleting Files Not  Needed *****</p>
<p>10:55:24 PM</p>
<p>***** Files deleted *****</p>
<p>Saturday, December 31, 2011</p>
<p>10:55:24 PM</p>
<p>========== WSPRDB Program Complete ==========</p>
<p>PS C:\projects\wspr-adif&gt;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powershellham.com/?feed=rss2&#038;p=22</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rig Control With PowerShell</title>
		<link>http://www.powershellham.com/?p=13</link>
		<comments>http://www.powershellham.com/?p=13#comments</comments>
		<pubDate>Mon, 19 Sep 2011 00:31:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc Scripts]]></category>

		<guid isPermaLink="false">http://www.powershellham.com/?p=13</guid>
		<description><![CDATA[Today rig automation is easy and you don&#8217;t even need an SDR or a developers background. Below is a very simple example using PowerShell (Free with Windows 7) to automate the monitoring of two different frequencies. In this example I set a simple timer for 10 minutes and then every 30 seconds it changes between [...]]]></description>
			<content:encoded><![CDATA[<p>Today rig automation is easy and you don&#8217;t even need an SDR or a developers<br />
background. Below is a very simple example using PowerShell (Free with<br />
Windows 7) to automate the monitoring of two different frequencies. In this<br />
example I set a simple timer for 10 minutes and then every 30 seconds it<br />
changes between two frequencies. You MUST understand your radios<br />
CAT commands and have a serial port or virtual serial port setup on your<br />
radio. You can easily see how powerful controls could be build. The web<br />
is loaded with PowerShell info and training, this example is being used with<br />
my Flex radios.</p>
<p>$waitMinutes = 10<br />
$startTime = get-date<br />
$endTime = $startTime.addMinutes($waitMinutes)<br />
$timeSpan = new-timespan $startTime $endTime<br />
while ($timeSpan.minutes -gt 0 ) {<br />
$port= new-Object System.IO.Ports.SerialPort COM7,9600,None,8,one<br />
$port.open()<br />
$port.WriteLine(&#8220;FA00014272000;&#8221;)<br />
$port.Close()<br />
Start-Sleep -s 30<br />
$port= new-Object System.IO.Ports.SerialPort COM7,9600,None,8,one<br />
$port.open()<br />
$port.WriteLine(&#8220;FA00014313000;&#8221;)<br />
$port.Close()<br />
Start-Sleep -s 30<br />
$now = get-date<br />
$timeSpan = new-timespan $now $endTime<br />
}</p>
<p>If you want to check what com ports you have run the following PowerShell<br />
command. Note: This does NOT tell you what is being using only what ports<br />
are configured on the system.</p>
<p>[System.IO.Ports.SerialPort]::getportnames()</p>
<p>Below is what the PowerShell command above produced on my system.<br />
You can sort list if needed.</p>
<p>PS C:\Users\tim&gt; [System.IO.Ports.SerialPort]::getportnames()</p>
<p>COM11<br />
COM12<br />
COM15<br />
COM16<br />
COM1<br />
COM2<br />
COM3<br />
COM4<br />
COM5<br />
COM6<br />
COM7<br />
COM8<br />
COM9<br />
COM10</p>
<p>PS C:\Users\tim&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powershellham.com/?feed=rss2&#038;p=13</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WSPR Monitor Script</title>
		<link>http://www.powershellham.com/?p=12</link>
		<comments>http://www.powershellham.com/?p=12#comments</comments>
		<pubDate>Sun, 18 Sep 2011 18:18:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc Scripts]]></category>

		<guid isPermaLink="false">http://www.powershellham.com/?p=12</guid>
		<description><![CDATA[A few days ago I read someone was going to run WSPR on a VLF band, I wanted to lurk the band to see if I could capture any signal. I quickly put together a little PowerShell script that checks the WSPR database every15 minutes and if I had reported a capture it would email [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I read someone was going to run WSPR on a VLF band, I wanted to lurk the band to see if I could capture any signal. I quickly put together a little PowerShell script that checks the WSPR database every15 minutes and if I had reported a capture it would email me a notice along with a copy of the WSPR DB Web Page which I could view in a browser. In addition, on the screen you also see the date/time when the last query took place and when the next is scheduled and how long it took to process the last request. I could go on with my life and if something occurred I would be notified and I could look at the web page and decide if I wanted to run to the rig and see what was happing. Below is the script as is no warranty if you want to try it, you will need to change &#8220;CALLYOUARESEARCHINGFOR&#8221; to a real call sign, the &#8220;SMTPMAILSERVER&#8221; to your SMTP mail server, &#8220;FROMADDRESS&#8217; to the from Email address, &#8220;TOADDRESS&#8217; to the To Email address. In the output line set the band (here it is 15) and the reporter (here it is n9ro ) and you should be good to go. Everything you ever wanted to know regarding PowerShell is out on the web. Please respect the WSPR web site and don&#8217;t use needlessly.</p>
<p>$webClient = new-object System.Net.WebClient<br />
$webClient.Headers.Add(&#8220;user-agent&#8221;, &#8220;PowerShell Script&#8221;)<br />
$interval = 900 #Time in seconds to wait<br />
while (1 -eq 1) {<br />
$output = &#8220;&#8221;<br />
$startTime = get-date<br />
$output = $webClient.DownloadString(&#8220;http://wsprnet.org/olddb.php?mode=html`<br />
&amp;band=15&amp;limit=100&amp;findcall=&amp;findreportern9ro=&amp;sort=date HTTP/1.1&#8243;)<br />
$output | out-file -encoding ASCII wspr.html<br />
$endTime = get-date<br />
if ($output -like &#8220;*CALLYOUARESEARCHINGFOR*&#8221;) {<br />
&#8220;Success`t`t&#8221; + $startTime.DateTime + &#8220;`t`t&#8221; + ($endTime &#8211; $startTime).`<br />
TotalSeconds + &#8221; seconds&#8221;</p>
<p>Send-MailMessage -smtpServer &#8216;SMTPMAILSERVER&#8217; -from &#8216;FROMADDRESS&#8217; -to &#8216;TOADDRESS&#8217; -subject &#8216;WSPR Spot&#8217; -body &#8220;WSPR Data Attached&#8221; -attachment wspr.html</p>
<p>} else {<br />
&#8220;Fail`t`t&#8221; + $startTime.DateTime + &#8220;`t`t&#8221; + ($endTime &#8211; $startTime).TotalSeconds`<br />
+ &#8221; seconds&#8221;<br />
}</p>
<p>$nowtime = Get-Date -displayhint time<br />
$next = (Get-Date).AddSeconds($interval)<br />
echo &#8220;Current Time is: $nowtime Next Query Is At: $next &#8221;<br />
sleep($interval) #Wait interval then try again<br />
}</p>
<p>If it finds the call you specified it shows success if not Fail. See below:</p>
<p><a class="thickbox" href="http://www.powershellham.com/wp-content/uploads/2011/09/ps1-1.jpg"><img style="background-image: none; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="ps1-1" src="http://www.powershellham.com/wp-content/uploads/2011/09/ps1-1_thumb.jpg" border="0" alt="ps1-1" width="601" height="102" /></a></p>
<p>Below is a sample web page that was mailed during it&#8217;s use:</p>
<p><a class="thickbox" href="http://www.powershellham.com/wp-content/uploads/2011/09/ps1-2.jpg"><img style="background-image: none; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="ps1-2" src="http://www.powershellham.com/wp-content/uploads/2011/09/ps1-2_thumb.jpg" border="0" alt="ps1-2" width="613" height="378" /></a></p>
<p>Remember to use .\ to run the script from the scripts directory and make sure you have permissions for running a PowerShell script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powershellham.com/?feed=rss2&#038;p=12</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

