<?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>MakeUseOf &#187; scripts</title>
	<atom:link href="http://www.makeuseof.com/tags/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.makeuseof.com</link>
	<description>Cool Websites, Software and Internet Tips</description>
	<lastBuildDate>Fri, 10 Feb 2012 14:30:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How To Send Emails From An Excel Spreadsheet Using VBA Scripts</title>
		<link>http://www.makeuseof.com/tag/send-emails-excel-vba/</link>
		<comments>http://www.makeuseof.com/tag/send-emails-excel-vba/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 22:31:02 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[email tips]]></category>
		<category><![CDATA[microsoft excel]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=98665</guid>
		<description><![CDATA[In the past, I’ve used email a whole lot in my batch jobs and other automated scripts, just like I’ve described in past articles. These are great for those times when you have a script that’s monitoring the health of a computer or the status of a specific process, but what if you want to automate sending emails from within Office products like Word or Excel?]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2012/01/emaillaptop.png?323f2c" alt="email from excel" />Using emails as part of any program is a nice way to automate important tasks, and it also significantly improves the value and functionality of any program or script.</p>
<p>In the past, I&#8217;ve used email a whole lot in my batch jobs and other automated scripts, just like I&#8217;ve described in past articles here on using tools like <a href="http://www.makeuseof.com/tag/send-automated-emails-save-time-sendemail-windows-task-scheduler/">Sendmail</a> or <a href="http://www.makeuseof.com/tag/easily-quickly-send-command-line-emails-blat/">Blat</a> to issue emails straight from the command line, or from within a command line script.</p>
<p>These are great for those times when you have a script that&#8217;s monitoring the health of a computer or the status of a specific process, but what if you want to automate sending emails from within Office products like Word or Excel?</p>
<p>There are a lot of reasons why you might want to do so. Maybe you have staff that update documents or spreadsheets on a weekly basis, and you&#8217;d like to receive an email notification of when those updates take place, and even a report of the data from within those sheets. There are a few techniques you can use to program automated emails from within Excel, but my favorite remains CDO.</p>
<h2>Sending Emails From Within Excel</h2>
<p>You&#8217;re probably thinking that scripting outgoing email into an Excel VBA script is going to be painfully complicated. Well, that&#8217;s not the case at all.</p>
<p>CDO is a messaging component used in Windows for a few generations of the OS. It used to be called CDONTS, and then with the advent of Windows 2000 and XP, it was replaced with &#8220;CDO for Windows 2000&#8243;. This component is already included in your VBA installation within Word or Excel and it&#8217;s ready for use.</p>
<p>Using the component makes sending emails from within Windows products with VBA extremely easy. In this example, I&#8217;m going to use the CDO component in Excel to send out an email that will deliver the results from a specific Excel cell.</p>
<p>The first step is to go to the &#8220;<em>Developer</em>&#8221; menu tab, click on &#8220;<em>Insert</em>&#8221; in the Controls box, and then select a command button. Draw it into the sheet and then create a new macro for it.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2012/01/outlookvba1.png?323f2c" alt="email from excel" width="525" height="395" /></p>
<p style="text-align: left;">When Excel opens up the VBA editor, you&#8217;re going to need to add the reference to the CDO library. You can access this in the Tools menu, and then scroll down the list until you find &#8220;<em>Microsoft CDO for Windows 2000 Library</em>&#8220;. Select the checkbox and click OK.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2012/01/outlookvba2.png?323f2c" alt="send email from excel" width="553" height="504" /></p>
<p style="text-align: left;">Now you&#8217;re ready to use CDO to issue emails from inside Excel. To do this, you first need ot create the mail objects and set up all of the fields that will be required for sending the email. Keep in mind that while many of the fields are optional, the From and To fields are required.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Dim</span> CDO_Mail <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Object</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> CDO_Config <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Object</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> SMTP_Config <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Variant</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strSubject <span style="color: #151B8D; font-weight: bold;">as</span> <span style="color: #F660AB; font-weight: bold;">String</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strFrom <span style="color: #151B8D; font-weight: bold;">as</span> <span style="color: #F660AB; font-weight: bold;">String</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strTo <span style="color: #151B8D; font-weight: bold;">as</span> <span style="color: #F660AB; font-weight: bold;">String</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strCc <span style="color: #151B8D; font-weight: bold;">as</span> <span style="color: #F660AB; font-weight: bold;">String</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strBcc <span style="color: #151B8D; font-weight: bold;">as</span> <span style="color: #F660AB; font-weight: bold;">String</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> strBody <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
&nbsp;
strSubject = <span style="color: #800000;">&quot;Results from Excel Spreadsheet&quot;</span>
strFrom = <span style="color: #800000;">&quot;ryxxxxxx@xxxxxcast.net&quot;</span>
strTo = <span style="color: #800000;">&quot;rdxxxxxx@gmail.com&quot;</span>
strCc = <span style="color: #800000;">&quot;&quot;</span>
strBcc = <span style="color: #800000;">&quot;&quot;</span>
strBody = <span style="color: #800000;">&quot;The total results for this quarter are: &quot;</span> &amp;amp; Str(Sheet1.Cells(2, 1))</pre></div></div>

<p>The cool thing about this is that you an build up any string you want to customize a full email message and assign it to the strBody variable. Piece together components of the message by using the &#8220;&amp;&#8221; string to insert data from any of the Excel sheets right into the email message, just like I&#8217;ve shown above.</p>
<p>The next section of code is where you will configure CDO to use any external SMTP server that you want to use. In this case I don&#8217;t need to use SSL because my SMTP server doesn&#8217;t require it. CDO is capable of SSL, but that&#8217;s outside the scope of this article. If you need to use SSL, I highly recommend Paul Sadowski&#8217;s <a href="http://www.paulsadowski.com/wsh/cdo.htm">awesome writeup</a> on using CDO.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Set</span> CDO_Mail = <span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;CDO.Message&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">On</span> <span style="color: #151B8D; font-weight: bold;">Error</span> <span style="color: #8D38C9; font-weight: bold;">GoTo</span> Error_Handling
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> CDO_Config = <span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;CDO.Configuration&quot;</span>)
CDO_Config.Load -1
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> SMTP_Config = CDO_Config.Fields
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">With</span> SMTP_Config
    .Item(<span style="color: #800000;">&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;</span>) = 2
    .Item(<span style="color: #800000;">&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;</span>) = <span style="color: #800000;">&quot;smtp.metrocast.net&quot;</span>
    .Item(<span style="color: #800000;">&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;</span>) = 25
    .Update
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">With</span> CDO_Mail
    <span style="color: #151B8D; font-weight: bold;">Set</span> .Configuration = CDO_Config
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span></pre></div></div>

<p>Now that you&#8217;ve configured the connection to the SMTP server for sending the email, all you have to do is fill in the appropriate fields for the CDO_Mail object, and issue the Send command. This is how you do that.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">CDO_Mail.Subject = strSubject
CDO_Mail.From = strFrom
CDO_Mail.<span style="color: #8D38C9; font-weight: bold;">To</span> = strTo
CDO_Mail.TextBody = strBody
CDO_Mail.CC = strCc
CDO_Mail.BCC = strBcc
CDO_Mail.Send
&nbsp;
Error_Handling:
<span style="color: #8D38C9; font-weight: bold;">If</span> Err.Description &amp;lt;&amp;gt; <span style="color: #800000;">&quot;&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span> MsgBox Err.Description</pre></div></div>

<p>So there you have it. There won&#8217;t be any pop-up boxes or security alert messages, which can happen when you resort to using the Outlook mail object. CDO simply puts together the email and utilizes your SMTP server connection details to fire off the message. It&#8217;s probably the easiest way I know to incorporate email into Word or Excel VBA scripts.</p>
<p>Here&#8217;s what the message looked like that I received in my inbox.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2012/01/outlookvba4.png?323f2c" alt="email from excel" width="346" height="98" /></p>
<p>No hassle &#8211; just the data straight from within the Excel sheet delivered right to my email account. If you&#8217;re creative with how you put together the body string variable with all sorts of data from your Excel sheet, you can just imagine the cool automated email reports that you could put together. And if you don&#8217;t want to use a command button, just have the script run on the sheet or application close event.</p>
<p>Can you think up any cool uses for CDO in your own Excel, Access, or Word projects? Share your thoughts and ideas in the comments section below.</p>
<p><small><a href="http://image.shutterstock.com/display_pic_with_logo/285868/285868,1280383213,6/stock-photo-laptop-and-mail-done-in-d-isolated-58049572.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/send-emails-excel-vba/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Create A Realtime Computer Status App With Windows Script &amp; LiveGraph</title>
		<link>http://www.makeuseof.com/tag/create-realtime-computer-status-app-windows-script-livegraph/</link>
		<comments>http://www.makeuseof.com/tag/create-realtime-computer-status-app-windows-script-livegraph/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 17:00:03 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[pc maintenance]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[system monitor]]></category>
		<category><![CDATA[system tools]]></category>
		<category><![CDATA[troubleshoot]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=96075</guid>
		<description><![CDATA[One of the fun things about being a computer geek is showing off with multiple displays going on all at once. These might include scrolling text across various windows, and a second screen full of real-time graphs rolling from right to left, showing every last detail about the status of every computer system on the network - CPU usage, battery levels of all of the laptops, and remaining hard drive space on all systems.Wouldn't it be cool to have an application that would offer such a display?]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/realchart.png?323f2c" alt="computer system status reports" />One of the fun things about being a computer geek is showing off with multiple displays going on all at once.</p>
<p>These might include scrolling text across various windows, and a second screen full of real-time graphs rolling from right to left, showing every last detail about the status of every computer system on the network &#8211; CPU usage, battery levels of all of the laptops, and remaining hard drive space on all systems.</p>
<p>Wouldn&#8217;t it be cool to have an application that would offer such a display?</p>
<p>We&#8217;ve covered a number of programs that provide some real-time status displays like that, like <a href="http://www.makeuseof.com/tag/monitor-your-computer-fans-with-speedfan/">SpeedFan</a> that Kyle and <a href="http://www.makeuseof.com/tag/how-to-use-speedfan-to-remotely-monitor-computer-health/">Guy covered</a>. The most elaborate tool for viewing all of your computer information is probably <a href="http://www.makeuseof.com/tag/speccy-an-advanced-system-information-tool-for-your-pc/">Speccy</a>, which Karl covered.</p>
<p>The problem with all of these is that they either offer too much or too little information. Maybe there are a few things you want to track on your network or your computer system, but you don&#8217;t want to have to dig through all of that other stuff. What if you could customize your own computer monitoring system using Windows Script, and then display the details in a really cool, real-time charting system that is open-source and absolutely free?</p>
<h2>Developing Your Own Cool Real-Time Statistics</h2>
<p>There are two stages to doing this. You don&#8217;t have to be a programming expert. Once you understand how to go about obtaining data from your computer (or any computer on your network) using Windows Script, you&#8217;ll be able to build this system to display whatever you like, and only what you want.</p>
<p>The following script will query your computer system for the current CPU load in percentages.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">&lt;script <span style="color: #151B8D; font-weight: bold;">type</span>=<span style="color: #800000;">&quot;text/javascript&quot;</span> language=<span style="color: #800000;">&quot;VBScript&quot;</span>&gt;// &lt;![CDATA[
<span style="color: #E56717; font-weight: bold;">Option</span> <span style="color: #E56717; font-weight: bold;">Explicit</span>
<span style="color: #151B8D; font-weight: bold;">On</span> <span style="color: #151B8D; font-weight: bold;">Error</span> <span style="color: #151B8D; font-weight: bold;">Resume</span> <span style="color: #8D38C9; font-weight: bold;">Next</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> oFSO, sFile1, oFile1, sFile2, oFile2, sFile3, oFile3, sText
<span style="color: #151B8D; font-weight: bold;">Dim</span> colResults, objResult, strQuery
<span style="color: #151B8D; font-weight: bold;">Dim</span> strResults
<span style="color: #151B8D; font-weight: bold;">Dim</span> x
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> Shell = wscript.<span style="color: #E56717; font-weight: bold;">createObject</span>(<span style="color: #800000;">&quot;wscript.shell&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Set</span> oFSO = <span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
sFile1 = <span style="color: #800000;">&quot;CPULoad.csv&quot;</span>
sFile2 = <span style="color: #800000;">&quot;DriveSpace.csv&quot;</span>
sFile3 = <span style="color: #800000;">&quot;BatteryStatus.csv&quot;</span>
&nbsp;
<span style="color: #008000;">'***Open New File to write CPU Load***
</span><span style="color: #151B8D; font-weight: bold;">Set</span> oFile1 = oFSO.CreateTextFile(sFile1, 1)
&nbsp;
<span style="color: #008000;">'Define the WMI query
</span>strQuery = <span style="color: #800000;">&quot;SELECT * FROM Win32_Processor&quot;</span>
&nbsp;
<span style="color: #008000;">' Run the query
</span><span style="color: #151B8D; font-weight: bold;">Set</span> colResults = <span style="color: #E56717; font-weight: bold;">GetObject</span>(<span style="color: #800000;">&quot;winmgmts://./root/cimv2&quot;</span>).ExecQuery( strQuery )
&nbsp;
<span style="color: #008000;">'Identify the CPU load
</span><span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> objResult <span style="color: #8D38C9; font-weight: bold;">In</span> colResults
 	strResults = CStr(objResult.LoadPercentage)
<span style="color: #8D38C9; font-weight: bold;">Next</span>	
&nbsp;
oFile1.WriteLine strResults
oFile1.<span style="color: #8D38C9; font-weight: bold;">Close</span>
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> oFile1 = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
<span style="color: #151B8D; font-weight: bold;">set</span> colResults = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
strResults = <span style="color: #800000;">&quot;&quot;</span></pre></div></div>

<p>The key lines here are the select statement that looks at &#8220;Win32_Processor&#8221;, and the &#8220;objResult.LoadPercentage&#8221; line, which extracts the CPU load percentage from the system results. Finally, as you can see toward the bottom of the code, the data that&#8217;s extracted gets written to a csv file.</p>
<p>After creating the file and writing one line, the next step is to create a loop that continues polling the computer system and updating the csv data file with updated data. Here&#8217;s what that loop looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'***Write New CPU Load every 5 seconds***
</span>
<span style="color: #8D38C9; font-weight: bold;">For</span> x = 1 <span style="color: #8D38C9; font-weight: bold;">to</span> 50
&nbsp;
	WScript.Sleep 5000
&nbsp;
	<span style="color: #008000;">'***Update CPU Load File***
</span>	<span style="color: #151B8D; font-weight: bold;">Set</span> oFile1 = oFSO.OpenTextFile(sFile1,8,1)
&nbsp;
	<span style="color: #008000;">'Define the WMI query
</span>	strQuery = <span style="color: #800000;">&quot;SELECT * FROM Win32_Processor&quot;</span>
&nbsp;
	<span style="color: #008000;">' Run the query
</span>	<span style="color: #151B8D; font-weight: bold;">Set</span> colResults = <span style="color: #E56717; font-weight: bold;">GetObject</span>(<span style="color: #800000;">&quot;winmgmts://./root/cimv2&quot;</span>).ExecQuery( strQuery )
&nbsp;
	<span style="color: #008000;">'Identify the CPU load
</span>	<span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> objResult <span style="color: #8D38C9; font-weight: bold;">In</span> colResults
	 	strResults = CStr(objResult.LoadPercentage)
	<span style="color: #8D38C9; font-weight: bold;">Next</span>	
&nbsp;
	oFile1.WriteLine strResults
	oFile1.<span style="color: #8D38C9; font-weight: bold;">Close</span>
	<span style="color: #151B8D; font-weight: bold;">Set</span> oFile1 = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
	<span style="color: #151B8D; font-weight: bold;">set</span> colResults = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
	strResults = <span style="color: #800000;">&quot;&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">Next</span></pre></div></div>

<p>This will loop 50 times, waiting 5 seconds between each system query and updating the data file. You could use a while loop to make it an infinite loop if you want and just have it constantly running in the background, but for this example I&#8217;m using a limited loop that runs for just over 4 minutes. Here&#8217;s what the output file looks like after the script has run for a while.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/realtime1a.png?323f2c" alt="computer system status reports" width="332" height="468" /><br />
This is a cool system to query system information for data and then output that info to a constantly-updated text file. This gives you real-time information about anything the Windows WMIC system has available. Just to give you a glimpse of what sort of information is available, take a look at the <a href="http://technet.microsoft.com/en-us/library/ee156538.aspx">Microsoft Technet page</a> on WMIC &#8211; it&#8217;s pretty impressive.</p>
<p>But the real coolness-factor comes from using <a href="http://www.live-graph.org/">LiveGraph</a> &#8211; an open-source plotting tool that will read in the real-time data you&#8217;re writing to the CSV files, and display those in an updated graph display.</p>
<p>When you install and run LiveGraph, you just tell it what CSV file to query, and move the slider over to the left to have the program check the data file every 10 seconds or so.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/realtime2.png?323f2c" alt="computer status" width="470" height="300" /></p>
<p>Here is what LiveGraph looks like after the windows script above has been running for a couple of minutes. LiveGraph updates automatically and as more data gets added to the file, the chart scrolls across the screen with the latest CPU load.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/realtime1aa.png?323f2c" alt="computer status" width="439" height="487" /></p>
<p>Once you&#8217;ve gotten this far, you can fill a whole screen up with cool real-time graphs of whatever information you&#8217;d like, by adding additional sections to your windows script that query other information about your computer or any computer on your network. For example, I added the following section to query the system for the current battery level of my laptop.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'***Open New File to write Battery Level***
</span><span style="color: #151B8D; font-weight: bold;">Set</span> oFile3 = oFSO.CreateTextFile(sFile3, 1)
&nbsp;
<span style="color: #008000;">'Define the WMI query
</span>strQuery = <span style="color: #800000;">&quot;SELECT * FROM Win32_Battery&quot;</span>
&nbsp;
<span style="color: #008000;">' Run the query
</span><span style="color: #151B8D; font-weight: bold;">Set</span> colResults = <span style="color: #E56717; font-weight: bold;">GetObject</span>(<span style="color: #800000;">&quot;winmgmts://./root/cimv2&quot;</span>).ExecQuery( strQuery )
&nbsp;
<span style="color: #008000;">'Identify the Battery Level
</span><span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> objResult <span style="color: #8D38C9; font-weight: bold;">In</span> colResults
 	strResults = CStr(objResult.EstimatedChargeRemaining)
<span style="color: #8D38C9; font-weight: bold;">Next</span>	
&nbsp;
oFile3.WriteLine strResults
oFile3.<span style="color: #8D38C9; font-weight: bold;">Close</span>
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> oFile3 = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
<span style="color: #151B8D; font-weight: bold;">set</span> colResults = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
strResults = <span style="color: #800000;">&quot;&quot;</span></pre></div></div>

<p>After adding another section to monitor the realtime level of my hard drive, I finally had three data files accumulating realtime data about my systems.</p>
<p>The beauty here is that you can customize the system with whatever you like &#8211; it doesn&#8217;t have to be computer information, you can poll network status, ping computers on your network, <a href="http://www.makeuseof.com/tag/basic-internet-browser-vba/">query HTML files</a> and extract information that you can display in a real-time graph on your screen.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/realtime4.png?323f2c" alt="computer system status reports" width="580" height="593" /></p>
<p>I love the display, and now kick off the windows script on my PC startup, and just make it run in an infinite loop. For now it&#8217;s providing system info about all of the PCs on my network, but plan to play around with extracting real-time info about my overall network bandwidth use and information polled off the net. With VB Script and imagination, the sky&#8217;s the limit.</p>
<p>Give the script and LiveGraph a try, and play around with adding your own information and data to the system. What kind of cool graph displays did you come up with? Share your experiences and thoughts in the comments section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/create-realtime-computer-status-app-windows-script-livegraph/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Control Running Services With The SC Command [Windows]</title>
		<link>http://www.makeuseof.com/tag/control-running-services-sr-command-windows/</link>
		<comments>http://www.makeuseof.com/tag/control-running-services-sr-command-windows/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 22:31:54 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[pc maintenance]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[system monitor]]></category>
		<category><![CDATA[system tools]]></category>
		<category><![CDATA[troubleshoot]]></category>
		<category><![CDATA[windows processes]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=95838</guid>
		<description><![CDATA[One of the things that I find myself doing much more often since diving into IT is monitoring and checking the status of services running on computers that are running across the company. There is the standard way of managing services which most people use because it's well-known and fairly easy. But what about another way?]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/computercode.png?323f2c" alt="services in computer" />One of the things that I find myself doing much more often since diving into IT is monitoring and checking the status of services running in computers across the company.</p>
<p>There is the standard way of managing services which most people use because it&#8217;s well-known and fairly easy. This involves going into Administrative controls or going into the control panel, hunting down the Services utility and doing what you need to do.</p>
<p>If you want to manage the services that are running on a different computer or server on your network, you need to go to computer management, connect to the remote machine, and then manage those services.</p>
<p>There&#8217;s nothing at all wrong with taking this approach &#8211; in fact system administrators everywhere use these standard Windows utilities to manage the infrastructure across the enterprise. But, what if you could monitor, stop and start services by typing in a single line at the command prompt?</p>
<h2>Controlling Services From the Command Line</h2>
<p>You may need to stop services running in a client computer so that you can reinstall some software. Or maybe you need to restart services that are running on a server because some software isn&#8217;t working properly.</p>
<p>Up until now, you&#8217;ve probably managed services on client machines running on your network using the standard services utility. This is the Services tool that you launch in the <em>Administrative Tools</em> section of the control panel.</p>
<p style="text-align: center;"><img class="aligncenter" style="border: 1px solid black;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/services1.png?323f2c" alt="services in computer" width="523" height="398" /></p>
<p>In Admin Tools, you can either go directly to the Services tool, or open up computer management if you want to access a different computer on your network.</p>
<p style="text-align: center;"><img class="aligncenter" style="border: 1px solid black;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/services2.png?323f2c" alt="running services windows" width="427" height="363" /></p>
<p>To access a different computer, just click action, &#8220;<em>Connect to Another Computer</em>&#8221; and then type the network name of the computer.</p>
<p><img src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/services3.png?323f2c" alt="running services windows" width="564" height="373" /></p>
<p>Then you can open up the services tool.</p>
<h3>An Easier Way To Manage Services</h3>
<p>So anyway, that&#8217;s the long way. The shorter and faster way is to use the command &#8220;SC&#8221;.</p>
<p>You&#8217;re probably familiar with the NET command. The SC command is nearly identical to NET, except that it can also create a service, in addition to monitoring, stopping and starting them. Best of all, you can issue the SC command against other computers over the network (assuming you have admin rights).</p>
<p>Doing an SC query against a computer will give you all of the installed services and whether they are running. When you issue the command <em>&#8220;SC \\**computer-name** query |more&#8221;</em> &#8211; you&#8217;ll get an output as shown here.</p>
<p><img src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc11.png?323f2c" alt="running services windows" width="574" height="502" /></p>
<p>As you can see, this gives you the state of the service, the type of service and other parameters. For the sake of our exercises here, we&#8217;re going to pay attention to just the state of the services.</p>
<p>If you want to list only the services that are currently not running (stopped), then you would issue the command, <em>&#8220;SC \\**computer-name** query state= &#8220;inactive&#8221; |more&#8221;</em></p>
<p>The |more part of the command makes the output pause on each screen so that you can scroll.</p>
<p><img src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc21.png?323f2c" alt="services running on computer" width="577" height="500" /></p>
<p>As you can see, those services are all stopped. Now, instead of having to dig through all of those services, if you know the name of the service, you can just issue the command <em>&#8220;SC \\**computer-name** query **service-name**&#8221;</em></p>
<p><img src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc31.png?323f2c" alt="services running on computer" width="578" height="145" /></p>
<p>That will report back with the current status of just that service and nothing else. To remotely stop a service, all you have to do is issue the stop command, <em>&#8220;SC \\**computer-name** stop **service-name**&#8221;</em></p>
<p><img src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc41.png?323f2c" alt="services running on computer" width="579" height="156" /></p>
<p>The output will show a state of &#8220;STOP-PENDING&#8221;, but after a few moments, if you query that service again, you&#8217;ll see that it is no longer running. You can start it by issuing the same command, but replacing &#8220;stop&#8221; with &#8220;start&#8221;.</p>
<h3>Creating A Script To Query, Stop Or Start Any Service</h3>
<p>Okay, so now that you&#8217;ve got the basics down, it&#8217;s time to write a script that will stop any service that you want without the need to remember the exact command string. We can do this by writing a trusty Windows Script, as follows.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">&lt;script <span style="color: #151B8D; font-weight: bold;">type</span>=<span style="color: #800000;">&quot;text/javascript&quot;</span> language=<span style="color: #800000;">&quot;VBScript&quot;</span>&gt;// &lt;![CDATA[
   <span style="color: #E56717; font-weight: bold;">Option</span> <span style="color: #E56717; font-weight: bold;">Explicit</span> <span style="color: #151B8D; font-weight: bold;">On</span> <span style="color: #151B8D; font-weight: bold;">Error</span> <span style="color: #151B8D; font-weight: bold;">Resume</span> <span style="color: #8D38C9; font-weight: bold;">Next</span> <span style="color: #151B8D; font-weight: bold;">Dim</span> WshShell <span style="color: #151B8D; font-weight: bold;">Dim</span> strInput <span style="color: #151B8D; font-weight: bold;">Dim</span> strComputer <span style="color: #151B8D; font-weight: bold;">Dim</span> x <span style="color: #151B8D; font-weight: bold;">Dim</span> blnGetList <span style="color: #151B8D; font-weight: bold;">Dim</span> strStopStart <span style="color: #151B8D; font-weight: bold;">set</span> WshShell=<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;WScript.Shell&quot;</span>) x=0 strComputer = InputBox(<span style="color: #800000;">&quot;Enter the computer or server name:&quot;</span>) <span style="color: #8D38C9; font-weight: bold;">Do</span> <span style="color: #8D38C9; font-weight: bold;">while</span> x=0    <span style="color: #008000;">'Query User for Service to check    strInput = InputBox(&quot;Enter the service name or DONE:&quot;)    If strInput = &quot;DONE&quot; or strInput = &quot;done&quot; then 	x=1    Else 	strStopStart = MsgBox(&quot;Stop Service? Yes-Stop, No-Start&quot;, VBYesNo, &quot;Stop Request&quot;)        'Send commands 	IF strStopStart = vbYes then       	    WshShell.run &quot;cmd.exe&quot;             WScript.Sleep 1000             WshShell.SendKeys &quot;sc \\&quot; &amp;#038; strComputer &amp;#038; &quot; stop &quot; &amp;#038; strInput &amp;#038; &quot; &gt;&gt; c:\temp\results.txt&quot;
</span>            WshShell.SendKeys (<span style="color: #800000;">&quot;{Enter}&quot;</span>)
            WScript.Sleep 1000
            WshShell.SendKeys <span style="color: #800000;">&quot;exit&quot;</span>
            WshShell.SendKeys (<span style="color: #800000;">&quot;{Enter}&quot;</span>)
&nbsp;
         <span style="color: #8D38C9; font-weight: bold;">Else</span>
&nbsp;
      	    WshShell.run <span style="color: #800000;">&quot;cmd.exe&quot;</span>
            WScript.Sleep 1000
&nbsp;
            WshShell.SendKeys <span style="color: #800000;">&quot;sc \\&quot;</span> &amp;#038; strComputer &amp;#038; <span style="color: #800000;">&quot; start &quot;</span> &amp;#038; strInput &amp;#038; <span style="color: #800000;">&quot; &gt;&gt; c:\temp\results.txt&quot;</span>
            WshShell.SendKeys (<span style="color: #800000;">&quot;{Enter}&quot;</span>)
            WScript.Sleep 1000
            WshShell.SendKeys <span style="color: #800000;">&quot;exit&quot;</span>
            WshShell.SendKeys (<span style="color: #800000;">&quot;{Enter}&quot;</span>)
	 <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span> 
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">Loop</span>
&nbsp;
WScript.Quit
// ]]&gt;&lt;/script&gt;</pre></div></div>

<p>When you run this script, it&#8217;ll ask you for the name of the service that you want to stop or start.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc5.png?323f2c" alt="services running on computer" width="363" height="160" /></p>
<p>And then whether you want to stop or start the service.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc7.png?323f2c" alt="" width="188" height="107" /></p>
<p>Using the <em>&#8220;&gt;&gt; c:\temp\results.txt&#8221;</em> command, it outputs the stop and start results and errors to a text file that you can use to see whether the command worked.</p>
<p>When I ran the script above, I followed it up with a quick query of the service before and after running the script.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/sc8.png?323f2c" alt="services in computer" width="576" height="278" /></p>
<p>As you can see, the service I stopped &#8211; helpsvc &#8211; was running. I ran the Windows Script to stop it, queried it, and it was stopped.</p>
<p>If you wanted to get really fancy, you could add a section to the script that outputted all of the currently installed services on the PC to a text file that you could review before deciding which service to stop or start. The command for that would be <em>&#8220;sc \\&#8221; &amp; strComputer &amp; &#8221; query &gt; c:\temp\services.txt&#8221;.</em></p>
<p>As you can see, the SC command can be a pretty powerful and efficient way to manage services on any computer, and if you have some talent with Windows Scripting, you can even automate the process to make your job even easier.</p>
<p>Do you think the SC command could come in handy for you? What about an automated script that runs the command? Share your ideas and thoughts in the comments section below.</p>
<p><small>Image Credit: <a href="http://image.shutterstock.com/display_pic_with_logo/298498/298498,1281943813,1/stock-photo-code-of-php-language-programming-on-blue-59109898.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/control-running-services-sr-command-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Create A Data Backup Tool With SyncToy &amp; VB Script</title>
		<link>http://www.makeuseof.com/tag/set-automated-data-recovery-synctoy-vb-script/</link>
		<comments>http://www.makeuseof.com/tag/set-automated-data-recovery-synctoy-vb-script/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:00:32 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[How-To Articles]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[pc maintenance]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[synchronize]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=91453</guid>
		<description><![CDATA[We've covered a lot of backup solutions here at MUO, and all of these solutions are great, but if you're working in an environment that is wary about free 3rd party software packages, or companies that want to stick with Microsoft products only, then you may find yourself without a good solution. Enter SyncToy and VB Script.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/foldertransfer.jpg?323f2c" alt="data backup" />Last month, I wrote an article about different tools you can use to <a href="http://www.makeuseof.com/tag/automate-schedule-regular-windows-7-backups/">create backups</a> or images of all of your Windows 7 computer systems. While taking full backups of your entire system is important, you may want to more frequently back up really important directories or files. This is often the case in the field of IT, where you have clients collecting data to a specific directory, and they want to be sure that there are regular daily (or hourly) backups of the data there.</p>
<p>We&#8217;ve covered a lot of data backup solutions here at MUO, such as Tina&#8217;s article on <a href="http://www.makeuseof.com/tag/5-ways-to-clone-and-copy-your-hard-drive/">cloning hard drives</a>, Stefan&#8217;s article on <a href="http://www.makeuseof.com/tag/pure-sync-backup-and-file-synchronization-made-easy/">file sync tools</a>, or Shankar&#8217;s article on <a href="http://www.makeuseof.com/tag/how-to-sync-files-between-pc-and-usb-thumb-drive/">syncing files</a> between a PC and your USB drive.  Justin even did one yesterday on <a href="http://www.makeuseof.com/tag/entire-hard-drive-redo-backup-recovery/">Redo</a>. All of these solutions are great, but if you&#8217;re working in an environment that is wary about free 3rd party software packages, or companies that want to stick with Microsoft products only, then you may find yourself without a good solution.</p>
<p>In this article, I&#8217;m going to show you how you can use a combination of Microsoft&#8217;s free SyncToy tool with a very simple scheduled VB Script that will automate the entire data backup process.</p>
<h2>Setting Up SyncToy For Automated File Backups</h2>
<p><a href="http://www.microsoft.com/download/en/details.aspx?id=15155">Microsoft SyncToy</a> is a free tool that lets you &#8220;pair&#8221; up folders for either an echo clone or full synchronization. I&#8217;ll explain the difference below. However, the point here is that before you can automate the directory and file backups, you need to set up all of the areas you want to copy and where you want the archived copy to go.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy1.png?323f2c" alt="data backup" width="443" height="388" /></p>
<p>You do this when you first run the SyncToy by clicking on &#8220;<em>Create New Folder Pair</em>&#8221; and then defining the left (from) folder, and the right (to) folder. The second step of the sync setup process is to choose the type of synchronization you want.</p>
<p>&#8220;<em>Synchronize</em>&#8221; is a two-way data backup. This means if any new file appears or is updated on the left or the right, those changes will be copied over to the other directory. On the other hand, Echo just mirrors all changes from the left directory onto the right. This is usually what people want to do when they&#8217;re backing up a particular directory &#8211; they want all changes mirrored on the backup.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy2.png?323f2c" alt="data backup system" width="443" height="388" /></p>
<p>In the scheduled solution that I&#8217;m going to show you how to set up, I&#8217;m going to set up four folder pairs. Each pair is a backup that I want to handle during one particular time of the day. In the morning, I&#8217;m going to back up one folder. At noon, I will back up another, and so on.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy3.png?323f2c" alt="data backup system" width="580" height="329" /></p>
<p>Once you have all of the folders set up that you want to perform automated backups for, it&#8217;s time to set up the script that will launch SyncToy using the command line feature that Microsoft offers with the tool.</p>
<h2>Setting Up The SyncToy Automation Script</h2>
<p>The VB Script that I&#8217;m going to show you will check the current time of day, and will run the appropriate command to launch the Microsoft SyncToy program and back up the right directory.</p>
<p>It does this by using the name of the paired directory that you set up in the tool above. Copy the script into notepad and save it as something like &#8220;databackup.wsf&#8221;.</p>
<pre></pre>
<pre>&lt;job&gt;</pre>
<pre>&lt;script language="VBScript"&gt;</pre>
<pre>Option Explicit</pre>
<pre>On Error Resume Next</pre>
<pre>Dim HourNow</pre>
<pre>Dim strHour</pre>
<pre>Dim WshShell</pre>
<pre>Dim strProgFiles</pre>
<pre>HourNow = Hour(Now())</pre>
<pre>set WshShell=CreateObject("WScript.Shell")</pre>
<pre>strProgFiles = WshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")</pre>
<pre>Select Case HourNow</pre>
<pre> case HourNow &gt;= 0 and HourNow &lt; 7 </pre>
<pre> WshShell.exec strProgFiles &amp; "\SyncToy 2.1\SyncToyCmd.exe -R MorningFiles"</pre>
<pre> case HourNow &gt;= 7 and HourNow &lt; 13 </pre>
<pre> WshShell.exec strProgFiles &amp; "\SyncToy 2.1\SyncToyCmd.exe -R NoonFiles"</pre>
<pre> case HourNow &gt;= 13 and HourNow &lt; 19 </pre>
<pre> WshShell.exec strProgFiles &amp; "\SyncToy 2.1\SyncToyCmd.exe -R MailArchives"</pre>
<pre> case else </pre>
<pre> WshShell.exec strProgFiles &amp; "\SyncToy 2.1\SyncToyCmd.exe -R EveningFiles"</pre>
<pre>End Select</pre>
<pre>WScript.Quit </pre>
<pre>&lt;/script&gt;</pre>
<pre>&lt;/job&gt;</pre>
<p>The script above simply checks the hour right now (based on the PC clock where the script runs), and if it is between midnight and 6:59 a.m., it will sync the &#8220;MorningFiles&#8221; pair that you set up. Between 7 a.m. and 12:59, the &#8220;NoonFiles&#8221; pair, and so on.</p>
<p>All you have to do now is set up a Windows scheduled task that will launch the script above four times a day within the four time spans. This is also pretty easy, just go to the Control Panel, Administrative Tools, and open up the Task Scheduler. Click on &#8220;<em>Create Task&#8221;</em>.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy4.png?323f2c" alt="data backup system" width="455" height="391" /></p>
<p>Name the task, and then click on the trigger tab. Make sure to select &#8220;<em>On a schedule</em>&#8220;, <em>Daily, recur every day, start at 3 a.m</em>., and then at the bottom click to repeat the task every 6 hours. This will trigger the task at 0300, 0900, 1500 and 2100 hours.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy5.png?323f2c" alt="backup data" width="527" height="413" /></p>
<p>Those are all within one of the four time spans that you scheduled into your script. Now click on the <em>Actions</em> tab, and select &#8220;<em>Start a program</em>&#8221; from the dropdown list and browse to where you stored the script.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy6.png?323f2c" alt="backup data" width="468" height="258" /></p>
<p>That&#8217;s all there is to it! Now, the task scheduler will launch your single script four times a day (no need to mess with multiple tasks). Your script will handle launching SyncToy in command mode by launching &#8220;<em>SyncToyCmd.exe -R EveningFiles</em>&#8221; &#8211; with whatever file pair you named after &#8220;-R&#8221;.</p>
<p>You can monitor whether your script is running by checking the SyncToy log file at &#8220;<em>C:\Users\Owner\AppData\Local\Microsoft\SyncToy\2.0\SyncToyLog.log</em>&#8221;</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/12/synctoy7.png?323f2c" alt="data backup" width="579" height="354" /></p>
<p>The log updates every time SyncToy is run, and it&#8217;ll show you what directory was backed up, when it was done, the file count and the size of the backup.</p>
<p>Does this data backup solution work for you? Do you have any other ways you like to automatically back up important data files and folders? Share your thoughts in the comments section below.</p>
<p><small>Image Credit: <a rel="nofollow" href="http://image.shutterstock.com/display_pic_with_logo/400282/400282,1304233549,4/stock-photo-moving-documents-between-folders-d-illustration-76277335.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/set-automated-data-recovery-synctoy-vb-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Put Your Command Line On Steroids With Swiss File Knife [Windows]</title>
		<link>http://www.makeuseof.com/tag/put-command-line-steroids-swiss-file-knife/</link>
		<comments>http://www.makeuseof.com/tag/put-command-line-steroids-swiss-file-knife/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:00:25 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[system tools]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=92749</guid>
		<description><![CDATA[Sometimes, the fastest way to accomplish a task such as sorting files or editing text documents is to use quick command line tools. there is a really cool tool called Swiss File Knife (sfk), which extends the sort of scripting set we've all become accustomed to.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfkicon.png?323f2c" alt="command line programming" />Sometimes, the fastest way to accomplish a task such as sorting files or editing text documents is to use quick command line tools.</p>
<p>If you&#8217;ve followed my recent scripting articles, then you know that  I really like command line programming. I use <a href="http://www.makeuseof.com/tag/3-awesome-windows-scripting/">Windows Scripting</a>, but lots of readers still use the old batch jobs, which still work well.</p>
<p>However, there is a really cool tool called <strong>Swiss File Knife (sfk)</strong>, which extends the sort of scripting set we&#8217;ve all become accustomed to.</p>
<p>The tool includes the usual command file functions that you may be used to, like mkdir, copy or list, but it extends your cmd powers with other amazing features like easily manipulating files, analyzing folders, and even higher level functions not usually associated with command line commands.</p>
<h2>Setting Up Swiss File Knife</h2>
<p>Setting up sfk on your computer is really easy. First, <a href="http://stahlworks.com/downloads.html">download sfk</a> and place the executable somewhere on your hard drive, and then edit the PATH in the environment variables so that the path where that file is located is included.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk1.png?323f2c" alt="command line programming" width="411" height="428" /></p>
<p>Reboot your computer, and then you&#8217;re ready to get started. There are loads of really <a href="http://stahlworks.com/dev/swiss-file-knife.html">cool commands</a> that you can kick off with sfk, but I wanted to touch on the ones that I liked the most.</p>
<p>One of the useful commands that come in handy when you&#8217;re trying to figure out what folders or directories are hogging all of your computer hard drive space is the <em>treesize</em> command.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk2.png?323f2c" alt="command line software" width="573" height="204" /></p>
<p>&#8220;sfk treesize [directory]&#8221; will run down through all subdirectories, showing you how many files each directory has and the total memory consumption.</p>
<p>At the bottom of the results, you&#8217;ll find the total statistics for the folder you launched the command against. You&#8217;ll see a total count of files, directories and memory usage.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk3.png?323f2c" alt="command line software" width="404" height="143" /></p>
<p>Another useful command for when you want to run a script that doesn&#8217;t allow for directories or files with spaces, is the sfk <em>deblank</em> command.</p>
<p>The command is used to target a file, directory, or all files within a directory. To remove spaces from all file names inside a directory, just type &#8220;sfk deblank [directory name]&#8220;.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk4.png?323f2c" alt="command line software" width="521" height="398" /></p>
<p>This will go through the entire directory and rename any file with a space in it, replacing spaces with the underscore character.</p>
<p>Getting into some of the more advanced features of sfk is the <em>snapto</em> command, which can take multiple text files and collect the contents into a single file. This is really useful for collecting a collection of log files all into one file.</p>
<p>The command for this is &#8220;sfk snapto=filename.txt&#8221;.  Filename.txt is the name of the output file where you want all of the combined text contents to output to.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk5.png?323f2c" alt="command line tools" width="569" height="426" /><br />
One of my favorite commands in sfk is the <em>httpserv</em> command. By simply navigating to a particular folder and typing &#8220;sfk httpserv&#8221;, you can instantly launch a simple web server, with that directory as the root web directory.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk7.png?323f2c" alt="command line tools" width="502" height="150" /></p>
<p>The command uses your computers current network IP address as the web host IP, so any other computer on the network can open up that directory by opening up a web browser and typing that IP into the address. This is a really cool way to instantly share out an HTML page you may be working on, or if you want to quickly show someone the contents of a folder over the network.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk81.png?323f2c" alt="" width="577" height="433" /><br />
While you might be tempted to use this to share out files, like pictures or movie files, it&#8217;s actually faster to launch a quick FTP server using my other favorite sfk command, <em>ftpserv</em>.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk9.png?323f2c" alt="command line tools" width="468" height="126" /></p>
<p>When you type &#8220;sfk ftpserv&#8221;, it will instantly launch an ftp service so that any user on your network can open up an FTP client and connect to that directory via FTP file transfer. Here is Filezilla connected to my laptop computer after I enabled the service on the laptop through the &#8220;sfk ftpserv&#8221; command.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/11/sfk10.png?323f2c" alt="command line programming" width="549" height="486" /><br />
These are just a few of the cool things you can do with sfk. If you load it onto a USB drive, just think of the powerful commands at your fingertips no matter what computer you are on. Plug in your USB stick and use sfk commands to launch and instant web service, or to quickly scan through a collection of documents, looking for specific words and joining together multiple files with just one or two quick command lines.</p>
<p>Swiss File Knife is the swiss army knife of command line programming tools, and it&#8217;ll make your life a whole lot easier. Give it a shot and let us know which commands you like best. Share your thoughts in the comments section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/put-command-line-steroids-swiss-file-knife/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Write VB Windows Scripts Easier &amp; Faster With VbsEdit</title>
		<link>http://www.makeuseof.com/tag/write-vb-windows-scripts-easier-faster-vbsedit/</link>
		<comments>http://www.makeuseof.com/tag/write-vb-windows-scripts-easier-faster-vbsedit/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 16:01:07 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[programmer tools]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=90283</guid>
		<description><![CDATA[Writing a script to automate various tasks on your system that you would normally have to do manually is something that I've become infatuated with recently. Maybe it's the automation engineer in me, but the idea of having a computer intelligently do what I don't have time to do is very appealing. That is why I've recently started offering some tips on how you can automate your own computer.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/bluecode.png?323f2c" alt="write windows script" />Writing a script to automate various tasks on your system that you would normally have to do manually is something that I&#8217;ve become infatuated with recently. Maybe it&#8217;s the automation engineer in me, but the idea of having a computer intelligently do what I don&#8217;t have time to do is very appealing. That is why I&#8217;ve recently started offering some tips on how you can automate your own computer with <a href="http://www.makeuseof.com/tag/batch-windows-scripting-host-tutorial/">windows host scripts</a>, typically using Visual Basic script to do things like <a href="http://www.makeuseof.com/tag/automate-telnet-commands-vb-script/">automate telnet commands</a> or <a href="http://www.makeuseof.com/tag/3-awesome-windows-scripting/">even sending emails</a>.</p>
<p>The reason I like VB script so much is because it&#8217;s a scaled down version of Visual Basic itself, which in my opinion is probably one of the easiest programming languages to learn if you&#8217;re just getting started as a programmer. That isn&#8217;t because the language is limited in features or scaled down in functionality, it&#8217;s because using the language is intuitive, and full of objects and components that you can pull in to perform some pretty amazing tasks with your computer.</p>
<h2>A VB Scripting Environment</h2>
<p>If you want to become a power Windows scripting expert, then you really need an environment that helps you remember the syntax of the language, and provides you with a quick library of functions and objects that are available to you.</p>
<h3>VbsEdit Helps You Write Powerful Windows Scripts</h3>
<p>If you are writing in VB6 or .Net, then you need to use the Microsoft Studio package that includes the programming environment you need. However, if you&#8217;re just a system administrator or a network IT guy, you really don&#8217;t want to spend money on an expensive tool just for writing Windows scripts. That&#8217;s where <a href="http://www.vbsedit.com/">VbsEdit</a> comes in handy.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit2.png?323f2c" alt="write windows script" width="506" height="379" /></p>
<p>Last week I wrote about <a href="http://www.makeuseof.com/tag/createweb-pages-faster-bluefish-editor/">the BlueFish editor</a> for web apps. Well, VbsEdit is sort of the all-star tool that is very well-known within the IT community for power-scripting highly functional VB based Windows Scripts. As you can see in the screenshot above, using an editor built specifically for VB scripting gives you the power of color-coded, intelligent sensing of declarations, variables, functions and objects. It gives you pop-up lists for suggested methods, properties and events for different objects, and a whole lot more.</p>
<p>If you don&#8217;t know what the heck I&#8217;m talking about here, don&#8217;t worry. After using VbsEdit for a while, you&#8217;ll quickly learn how the language works and how much functionality you can add to your Windows Scripts if you write them in this language and use VbsEdit.</p>
<p>The one drawback of the free version of VbsEdit is that it does have a nag-screen when you first launch the application.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit1.png?323f2c" alt="writing windows scripts" width="434" height="177" /></p>
<p>It is a functional, free version of the software, but you have to click &#8220;<em>Evaluate</em>&#8221; every time you start. If you really like it, I would suggest buying a copy, as it is really inexpensive. Otherwise, just click <em>Evaluate</em> and the software will launch.</p>
<h3>VbsEdit Features</h3>
<p>There&#8217;s a lot available when you use this tool to write Windows Script, but the first thing that I recommend you do when you first launch it is to click on the &#8220;<em>WScript</em>&#8221; button at the top of the main window. This enables all of the VBS features that I&#8217;m going to describe here.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit3.png?323f2c" alt="writing windows scripts" width="567" height="465" /></p>
<p>The first thing that I want to point out is that when you start defining available objects, like the windows scripting object or IHost for networking, those objects appear in the Object Browser on the right side of the window.</p>
<p>When you drop down the Object Browser, you can see all of the elements that are available to you, and you can drill down within those to see what properties or methods are available. If you&#8217;re just learning VB scripting, this is an invaluable resource.</p>
<p>Another nice feature is the drop-down lookup, just like you might be accustomed to if you&#8217;ve written programs in MS Visual Studio.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit4.png?323f2c" alt="writing windows scripts" width="577" height="355" /></p>
<p>Other really nice features of this tool include adding or removing breakpoints. You can do this by clicking to the left of the line where you want to pause the program, or click on the break point icon in the toolbar.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit5.png?323f2c" alt="vb windows scripting" width="453" height="422" /></p>
<p>Another nice feature that makes this software just as good as MS Visual Studio is the commenting feature. You can comment entire blocks of text simply by highlighting all of it and clicking on the &#8220;<em>comment</em>&#8221; icon.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit6.png?323f2c" alt="vb windows scripting" width="578" height="317" /></p>
<p>There is also a really nice debugging feature that most programming editors lack. When you click the run button, the program will stop at your breakpoints and you can step through your program by clicking on the various step icons.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit7.png?323f2c" alt="vb windows scripting" width="561" height="526" /></p>
<p>At the bottom of the window, you can view active variables and their values while your script is running. When you&#8217;re debugging an especially complex windows script, this feature is worth its weight in gold.</p>
<p>The only second drawback to the free version is another nuisance screen that counts down in seconds any time you want to run your script from inside the editor.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit8.png?323f2c" alt="" width="353" height="133" /></p>
<p>Other really nice features of this VB Script editor include (from left to right) the ability to convert your script into an executable, a button to add your newly written code into your own personal &#8220;code library&#8221;, a useful search button, and finally a series of bookmarking buttons that let you more easily organize and navigate your script.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/vbsedit9.png?323f2c" alt="write windows script" width="575" height="375" /></p>
<p>For the most part, VbsEdit is a much better improvement over using just a text editor for writing Windows Scripts. With VbsEdit, you can quickly see what you want to do, and how to do it. You can test your scripts and get them into production much faster than otherwise possible.</p>
<p>So give VbsEdit a shot and see if it improves your script writing experience. Share your thoughts about it in the comments section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/write-vb-windows-scripts-easier-faster-vbsedit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create A Freaky Possessed Computer With Windows Script For Halloween</title>
		<link>http://www.makeuseof.com/tag/create-possessed-computer-windows-script/</link>
		<comments>http://www.makeuseof.com/tag/create-possessed-computer-windows-script/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 16:01:50 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[halloween]]></category>
		<category><![CDATA[jokes]]></category>
		<category><![CDATA[prank]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[visual basic]]></category>
		<category><![CDATA[windows tips]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=90586</guid>
		<description><![CDATA[There are a lot of fun pranks you can play on your friends with a computer. You've probably seen all of those creepy YouTube videos that people forward to each other for a good scare. Not long ago, Justin covered a few really funny ways to prank your parents with a computer too. All of those ideas are fun, but this year, how about creeping out your friends a bit with your very own programming skill?]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/phantomtype.png?323f2c" alt="typing ghost" />There are a lot of fun pranks you can play on your friends with a computer. You&#8217;ve probably seen all of those creepy <a href="http://www.makeuseof.com/tag/14-popular-youtube-pranks-play-friends/">YouTube videos</a> that people forward to each other for a good scare. Not long ago, Justin covered a few really funny ways to <a href="http://www.makeuseof.com/tag/four-funny-ways-to-prank-your-parents-with-the-family-computer/">prank your parents</a> with a computer too. All of those ideas are fun, but this year, how about creeping out your friends a bit with your very own programming skill?</p>
<p>In this article, I&#8217;m going to show you how you can create your own little Windows script that will run on just about any modern Windows computer. All you have to do is open up Notepad, type up this script, save it as a .wsf file and then have your friends open up the file. The script will automatically open up Notepad and then start typing &#8211; complete with typewriter sound effects &#8211; just like the computer itself is possessed by a typing ghost.</p>
<p>The real beauty of this little script is how creative you are with launching it. Insert it into the computer&#8217;s startup folder so it launches when the computer starts, or replace one of their favorite desktop shortcuts to link to your file instead of their application!</p>
<h2>Scripting A Possessed Typing Computer</h2>
<p>The idea for this came from an experience at college, when I walked past a professor&#8217;s office and saw that he had an old DOS computer that was typing all by itself. He was a Computer Science professor, and he&#8217;d clearly written a DOS program that could type all by itself, complete with sound effects, pauses and everything. Very authentic. In this article, you&#8217;re going to do the same thing, just with Windows and using VB Script to accomplish the job. I&#8217;ll walk you through the process.</p>
<p>First step &#8211; download a typewriter WAV file from any of your favorite <a href="http://www.makeuseof.com/dir/soundbible-wav-sounds-free-to-download/">free WAV file websites</a>.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/typing1.png?323f2c" alt="typing ghost" width="563" height="433" /></p>
<p>Preferably download one that lasts from 30 seconds to a minute, depending on how much text you want your phantom app to type on the screen by itself. Save the file to <em>c:/windows/Media/</em> with the rest of the Windows sound files so it&#8217;ll be easy to find later.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/typing2.png?323f2c" alt="" width="536" height="390" /></p>
<p>Next, open up a text file and save it as a .wsf file. In my case I called it &#8220;<em>phantomtype.wsf</em>&#8220;. Declare all of the required variables, set up your text file link and then type the text that you want your typing ghost app to type on the screen.</p>
<p>&nbsp;</p>
<pre>&lt;job&gt;
&lt;script language="VBScript"&gt;
Option Explicit
On Error Resume Next

Dim NoteShell
Dim SoundShell
Dim strText
Dim intTextLen
Dim x
Dim intPause
Dim strTempText

strSoundFile = "C:\Windows\Media\typewriter1.wav"

strText = "Hello. My name is Ryan. I have possessed your computer</pre>
<pre>and there is nothing you can do about it. Of course, I suppose you</pre>
<pre>can always close the window if you want to, but that wouldn't be any fun!"</pre>
<p>&nbsp;</p>
<p>Pretty simple so far right? The two &#8220;Shell&#8221; variables are basically the shell commands that are going to launch Notepad and your sound file. The phantom typing will come from your script sending keystrokes to the Notepad app behind the scenes. Accomplishing that is easy &#8211; you just use &#8220;CreateObject&#8221; to set up your two application objects, and then launch each app, waiting a tiny bit between each launch.</p>
<p>&nbsp;</p>
<pre>Set NoteShell = CreateObject("WScript.Shell")
Set SoundShell = CreateObject("Wscript.Shell")

NoteShell.Run "notepad"
WScript.Sleep 1000

SoundShell.Run "C:\Windows\Media\typewriter1.wav", 0, True
WScript.Sleep 500</pre>
<p><span style="font-family: monospace;"><br />
</span></p>
<p>Now, the victim will see Notepad pop up on the screen, and after a second, the typewriter typing sound will start. At that moment, you will start sending ghostly text to the screen, just like someone is sitting there typing. Here&#8217;s how that part works.</p>
<p>&nbsp;</p>
<pre>intTextLen = Len(strText)
intPause = 100

For x = 1 to intTextLen
	strTempText = Mid(strText,x,1)
	NoteShell.SendKeys strTempText

	WScript.Sleep intPause

	If intPause &lt;= 500 Then
		intPause = intPause + 100
	Else
		intPause = 100
	End If
Next</pre>
<p><span style="font-family: monospace;"><br />
</span></p>
<p>This may look complicated, but don&#8217;t worry, it&#8217;s not at all. The first line checks the length of the long string of text that you typed up at the start of this program. That&#8217;s the text that you want to magically appear &#8211; one letter at a time &#8211; on the screen. The next line creates a starting pause (a tenth of a second) between each typed letter.</p>
<p>The For loop that you see below that basically starts at position 1, extracts a single letter from your text, sends that letter to Notepad, and then waits a little bit before moving forward to the next letter in your text. Pretty cool huh?</p>
<p>And to keep things authentic, the little &#8220;IF&#8221; statement keeps adding and subtracting pause time between typed letters to make the whole thing look really authentic, like someone is sitting right there typing.</p>
<p>Now close up the script.</p>
<pre>WScript.Quit
&lt;/script&gt;
&lt;/job&gt;
</pre>
<p>Save the file again &#8211; making sure you&#8217;ve got the &#8220;wsf&#8221; extension &#8211; and you&#8217;re done. Double click the file and check out your haunted computer!</p>
<p>Here&#8217;s my script in action (I wish you could hear the typing sounds, it&#8217;s a riot!)</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/typing3.png?323f2c" alt="typing ghost" width="420" height="253" /></p>
<p>Like most programs, it could use a little perfecting if you&#8217;re up to it. The sound file needs to match the amount of time it takes for the typing to finish. Or, you could loop both the typing and the sound, but you&#8217;ll need to come up with a way to let the person close the typing ghost application. If you don&#8217;t, the &#8220;sendkeys&#8221; will just continue typing no matter what window they open&#8230;which, is actually a pretty funny virus-like behavior, but not something that I would recommend you do to your friends.</p>
<p>So give this creepy little script a try and let us know what your friends thought about it. Did you come up with any other ways to perfect it? Share your thoughts in the comments section below.<br />
<small></small></p>
<p><small>Image Credit : <a href="http://image.shutterstock.com/display_pic_with_logo/208936/208936,1287452408,1/stock-photo-a-young-woman-experiences-the-horror-of-what-he-saw-on-the-internet-63277774.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/create-possessed-computer-windows-script/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>3 Ways To Open Applications &amp; Windows Maximized With VB Script [Windows]</title>
		<link>http://www.makeuseof.com/tag/3-ways-open-applications-windows-maximized-vb-script/</link>
		<comments>http://www.makeuseof.com/tag/3-ways-open-applications-windows-maximized-vb-script/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 18:01:03 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[application launchers]]></category>
		<category><![CDATA[desktop enhancements]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[window management]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=89774</guid>
		<description><![CDATA[If there is one thing I love to do, it's write VB scripts. Whether it's a Windows Script file or a VBA script inside an application, scripting provides the ability to add functionality to applications where most other people would find limitations and roadblocks. One of the most common functions that I've found I use in many of my scripts is maximizing a window.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/windows.png?323f2c" alt="script to maximize a window" />If there is one thing I love to do, it&#8217;s write VB scripts. Whether it&#8217;s a Windows Script file or a VBA script inside an application, scripting provides the ability to add functionality to applications where most other people would find limitations and roadblocks.</p>
<p>One of the most common functions that I&#8217;ve found I use in many of my scripts is maximizing a window. This may be the launching of an application from a Windows script, or maybe launching an Excel or Word document in full-screen mode for display in a conference room, or as an application of sorts.</p>
<p>The beauty of scripting is that you don&#8217;t have to be a programmer to do this, and you don&#8217;t have to have any special software installed. If you&#8217;re using a Windows computer, or any application that has a VBA back-end, you can make use of these functions. In this article I&#8217;m going to provide three examples of how you can maximize windows using VB scripts, but you can take what I&#8217;m going to show you here and use it throughout any other script that you might be building.</p>
<h2>Launch Applications In Maximized Mode</h2>
<p>Before we get started, I&#8217;m going to quickly show you how you can launch any application in maximized mode by writing a quick script that launches that program using the Windows Shell.</p>
<p>There is a parameter in the Shell &#8220;Run&#8221; command where you can tell the application what mode to run in, and it will run it maximized. This is what the script looks like.</p>
<pre></pre>
<pre>&lt;job&gt;
<pre>&lt;script language="VBScript"&gt;</pre>
</pre>
<pre>Option Explicit
<pre>On Error Resume Next</pre>
</pre>
<pre>Dim WshShell
<pre>Dim retVal
<pre>Dim myPath </pre>
</pre>
</pre>
<pre>set WshShell=CreateObject("WScript.Shell")<em> </em><em>retVal = WshShell.Run("C:\temp\firefox", 3)</em></pre>
<pre>WScript.Quit</pre>
<pre>&lt;/script&gt;</pre>
<pre>&lt;/job&gt;</pre>
<p>You can substitute any program in the string where I currently have Firefox, and if the app allows for it. It&#8217;ll launch maximized. Some apps don&#8217;t. For example, this technique works for Firefox, but Chrome seems to have a mind of its own. Regardless, this script will work with most applications.</p>
<h2>Open Documents Maximized in Word</h2>
<p>To maximize any Word document, using nothing more than a command button in Word, you&#8217;ll need to enable Developer mode. To do this, click the Windows button and select <em>Word Options</em> at the bottom of the dropdown. In the Options menu, select &#8220;<em>Show Developer tab in the Ribbon</em>&#8220;.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/wordmax1.png?323f2c" alt="script to maximize a window" width="541" height="388" /></p>
<p>Now you can select the Developer menu item and make use of &#8220;<em>design mode</em>&#8221; where you can code awesome functionality into your Word documents. To create a button that can maximize the document to full-screen, just enable Design Mode, click on the Forms dropdown button and click on the button object.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/wordmax2.png?323f2c" alt="script maximize window" width="477" height="370" /></p>
<p>Place the button anywhere at all that you want in your document.  Right-click on the button, select <em>CommandButton Object</em> and then click <em>View Code</em>. Now, there are two things you can do to maximize the window. You can either force the Windows application itself to maximize like this.</p>
<pre>Application.WindowState = wdWindowStateMaximize</pre>
<p>Or, you can make the entire document go full-screen and remove the header toolbars completely.</p>
<pre>ActiveWindow.View.FullScreen = True</pre>
<p>This puts the entire document in full-screen with only a ruler enabled (if you click on the ruler button in the upper left). To get out of full-screen mode, just tap the Escape key.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/wordmax3.png?323f2c" alt="script maximize window" width="574" height="344" /></p>
<p>What can this be used for? Well if you don&#8217;t have Microsoft Powerpoint, you can basically use this feature to  make use of Word as a similar display tool. To flip to the next page, you just scroll down the document.</p>
<p>If you don&#8217;t want to use a command button and would rather have the document automatically open in this mode, just use the code above in the Document_Open() function. You can get to that function in the code editor by selecting &#8220;<em>Document</em>&#8221; in the left dropdown at the top of the code window, and &#8220;<em>Open</em>&#8221; on the right dropdown.</p>
<h2>Open Spreadsheets Maximized In Excel</h2>
<p>What you can do with VBA in Word, you can usually also do in Excel, except things are going to be just a little bit different. You can enable the Developer toolbar the same way you did in Word above, but when you add a button you&#8217;ll see that Excel wants you to apply a Macro. All you have to do is name a new Macro and click on the &#8220;<em>New</em>&#8221; button. That will put you into the code editor.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/excelmax4.png?323f2c" alt="script maximize window" width="516" height="435" /></p>
<p>This is where you&#8217;ll type the code to maximize the spreadsheet and remove the scrollbars.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/excelmax5.png?323f2c" alt="script maximize" width="562" height="407" /></p>
<p>If you&#8217;re not accustomed to coding in VBA, you&#8217;ll notice that many of the objects you can reference in your code are listed to the left. You can perform a number of actions on specific sheets and workbooks, and lots of the objects inside those sheets as well. In this case you&#8217;re referencing the entire Excel application itself.</p>
<pre>Application.DisplayFullScreen = True</pre>
<pre>Application.CommandBars("Worksheet Menu Bar").Enabled = False</pre>
<p>You can perform a number of actions on specific sheets and workbooks, and lots of the objects inside those sheets as well. In this case you&#8217;re referencing the entire Excel application itself. This code will convert the Excel window to full screen mode and then entirely remove the menu bar at the top of the screen.</p>
<p><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/excelmax6.png?323f2c" alt="script to maximize a window" width="482" height="394" /></p>
<p>Just like in Word, you can get out of this mode with the Escape key, and you can also use the same code in the  screen. You can also use this code in the Workbook_Open() or Worksheet_Activate() functions to enable full-screen mode without the need for a button. However you want to perform your script magic is up to you!</p>
<p>So start up Notepad or MS Office and give these scripts a try. Did you think of some creative use for launching maximized applications? Share your experiences in the comments section below.</p>
<p><small>Image Credit: <a href="http://image.shutterstock.com/display_pic_with_logo/273049/273049,1307902701,1/stock-photo-a-spotlight-is-shining-on-a-blank-internet-website-on-a-black-background-add-your-text-message-79079875.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/3-ways-open-applications-windows-maximized-vb-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Ways To Clean Up Your Computer With An Automated Script [Windows]</title>
		<link>http://www.makeuseof.com/tag/xx-ways-clean-computer-automated-script/</link>
		<comments>http://www.makeuseof.com/tag/xx-ways-clean-computer-automated-script/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 21:31:20 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Cool Windows Apps & Tricks]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[cleaning]]></category>
		<category><![CDATA[pc maintenance]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[troubleshoot]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=89605</guid>
		<description><![CDATA[Computer maintenance isn't exactly something that most people remember to do. For the general user that isn't exactly tech savvy, when a computer doesn't work, they either call for help or simply buy a new computer. If you have family members or friends that are always calling you for help with a slow computer, I'm going to offer you a solution that you can use to stop those phone calls right now.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/automated.png?323f2c" alt="automate computer cleanup" />Computer maintenance isn&#8217;t exactly something that most people remember to do. For the general user that isn&#8217;t exactly tech savvy, when a computer doesn&#8217;t work, they either call for help or simply buy a new computer.</p>
<p>If you have family members or friends that are always calling you for help with a slow computer, I&#8217;m going to offer you a solution that you can use to stop those phone calls right now. This solution incorporates six tools into a Windows script. That script is going to perform all of the PC cleanup work that you would do if you were sitting right in front of the computer yourself.</p>
<h2>What This Script Will Accomplish</h2>
<p>This Windows script is going to run the required tools in command line mode. Many of these tools that you&#8217;ve been using for years, you may not have even realized that there <em>is</em> a command-line mode available.</p>
<h3>Clean Up Registry &amp; Temp Folders</h3>
<p>The first step is probably the most important. We&#8217;re going to launch CCleaner in command line mode to clean up temp files and the registry.</p>
<p>One catch. In order to make this script work without constant notifications about the apps making computer changes, you&#8217;ll have to disable the User Account Control windows feature in Windows 7.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean1.png?323f2c" alt="" width="571" height="406" /></p>
<p>Now you&#8217;re ready to roll. Create a file called <em>CleanComputer.wsf</em> and start it off with the following script.</p>
<pre>&lt;job&gt;</pre>
<pre>&lt;script language="VBScript"&gt;</pre>
<pre>Option Explicit</pre>
<pre>On Error Resume Next</pre>
<pre>Dim WshShell</pre>
<pre>Dim retVal</pre>
<pre>set WshShell=CreateObject("WScript.Shell")</pre>
<pre>WshShell.run "CCleaner.exe /AUTO"</pre>
<p>Danny covered <a href="http://www.makeuseof.com/tag/optimize-system-run-ccleaner/">CCleaner</a> recently, so you can see just what it is capable of and how much it can optimize your system. When you launch it in the script as shown above with the /AUTO flag, it&#8217;ll run invisible and it&#8217;ll use the settings you used when you last ran the application. You&#8217;ll see CCleaner.exe running in the Task Manager.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean2.png?323f2c" alt="automate computer cleanup" width="520" height="417" /></p>
<p>If you configure CCleaner beforehand, in auto mode it&#8217;ll automatically clean up temporary files, log files and your registry as well.</p>
<h3>Clean Up Spyware</h3>
<p>Next up is to take care of any spyware that might be running on the PC. My favorite tool for that is Spybot, and luckily Spybot also offers a command line feature. The one problem here is that the path to Spybot is full of spaces, which is hard to handle in a Windows Script shell command.</p>
<p>So, create a .bat file with the following:</p>
<pre>C:\Program Files (x86)\Spybot - Search &amp; Destroy\SpybotSD.exe" /taskbarhide /autocheck /autofix /autoclose</pre>
<pre>Exit</pre>
<p>Save it as <em>SpyBot.bat</em> in the same directory as your Windows script. Then in the next line of your WSF file, add the following:</p>
<pre>WshShell.run "spybot.bat"</pre>
<p>Your Windows Script will launch your batch job that will launch Spybot in command-line mode. You will know it&#8217;s running when the Exe appears in the task manager.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean3.png?323f2c" alt="script to clean temp files" width="549" height="410" /></p>
<p>Those four parameters after the spybotsd.exe file  will run Spybot in silent mode, automatically remove any spyware found, and then automatically close.</p>
<h3>Remove Malicious Software</h3>
<p>In addition to anything Spybot catches, I also like to run the Microsoft <a href="http://support.microsoft.com/kb/890830">Malicious Software removal tool</a>. Download the executable from the &#8220;Microsoft Download Center&#8221; section, save it in your script directory as &#8220;<em>malremove.exe</em>&#8221; and then add the following line to your growing Windows Script.</p>
<pre>WshShell.run "malremove.exe /Q /F:Y"</pre>
<p>The /Q command tells the malware removal tool to run in quiet mode (no interface) and /F:Y tells it to forcibly remove any malware that it finds without any intervention required. The first time you run it during your initial testing, you&#8217;ll have to select the option for no warning the next time it runs.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean4.png?323f2c" alt="script to clean temp files" width="404" height="305" /></p>
<p>Here it is running in the background.</p>
<p style="text-align: center;"><img class="aligncenter" style="border-width: 1px; border-color: black; border-style: solid;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean31.png?323f2c" alt="script to clean temp files" width="549" height="410" /></p>
<p>So, we&#8217;ve covered most of what you&#8217;d probably do if you were there in person &#8211; run CCleaner to get rid of temporary Internet files and other temp files, remove spyware and malware, so what&#8217;s left?</p>
<h3>Automate Disk Cleanup</h3>
<p>Another common tool that can help computer performance is the Windows Disk Cleanup tool.  First you have to set it up. Go to <em>Start -&gt; Run</em> and type: &#8220;<em>cleanmgr /sageset:1</em>&#8220;. The following window will appear.</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/autoclean6.png?323f2c" alt="computer clean up script" width="385" height="472" /></p>
<p>Set up the items that you&#8217;d like your command line to automatically clean, and then click OK. This tells it that whenever you choose <em>/sageset:1</em>, to utilize the settings you&#8217;ve just created. Now, in your Windows Script, add the following line.</p>
<pre>WshShell.run "Cleanmgr /sagerun:1"</pre>
<p>This will run the Windows disk cleanup silently, using the settings you&#8217;ve just created. You can also install the latest Windows updates by first installing <a href="http://www.wuinstall.com/">WuInstall.exe</a> and adding this line.</p>
<pre>WshShell.run "wuinstall.exe /install /reboot_if_needed"</pre>
<p>And don&#8217;t forget to do a quick defrag of the hard drive by adding the following lines to the script.</p>
<p><em>WshShell.run &#8220;Defrag volume c:&#8221;</em></p>
<pre>WshShell.run "Defrag volume d:"</pre>
<h3>Automate Virus Scan After Cleanup</h3>
<p>Last, but definitely not least, you&#8217;ll also want to end your script by firing off a full virus scan. For example, I use Kaspersky, which offers its own <a href="http://support.kaspersky.com/kis2010/tech?qid=208280476">set of command line parameters</a>.</p>
<p>In my case, I just add the following final line to my script.</p>
<pre>WshShell.run "AVP.exe SCAN /ALL /i4"</pre>
<p>And that kicks off the command window and runs through a full scan (which can take several hours).</p>
<p><img class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/antivirus51.png?323f2c" alt="automate computer cleanup" width="580" height="293" /></p>
<p>Most other anti-virus providers out there offer similar command-line options.</p>
<p>So, once you&#8217;ve added all of these lines, close out your Windows Script.</p>
<pre>WScript.Quit</pre>
<pre>&lt;/script&gt;</pre>
<pre>&lt;/job&gt;</pre>
<p>Once you&#8217;ve finished the procedure above and saved your file on the PC, just schedule the job to run on a regular basis (<em>/Accessories/System Tools/Task Scheduler</em>). Give the procedure above a try and see how well it works for you.</p>
<p>Did it work well, and can you think of any other useful command line tasks that could also be added? Share your thoughts in the comments section below.</p>
<p><small>Image Credit: <a href="http://image.shutterstock.com/display_pic_with_logo/704362/704362,1308593659,3/stock-photo-high-resolution-d-render-of-an-control-panel-in-colorful-lighting-control-panel-switches-80248693.jpg" rel="nofollow">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/xx-ways-clean-computer-automated-script/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Check Bad Links On Your Site Automatically With Linkchecker</title>
		<link>http://www.makeuseof.com/tag/automate-checking-bad-links-site-linkchecker/</link>
		<comments>http://www.makeuseof.com/tag/automate-checking-bad-links-site-linkchecker/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 18:00:09 +0000</pubDate>
		<dc:creator>Ryan Dube</dc:creator>
				<category><![CDATA[Wordpress & Blogging]]></category>
		<category><![CDATA[link checker]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[webmaster tools]]></category>

		<guid isPermaLink="false">http://www.makeuseof.com/?p=89103</guid>
		<description><![CDATA[When it comes to keeping your website or your blog healthy and strong in search engine listings, regularly checking for broken or otherwise bad links on your website is a very good idea. Not only is it good for your site's overall standings in search listings, it's also good for your visitors. No one wants to encounter broken links on a site - it's a sign of a poorly cared for website.]]></description>
			<content:encoded><![CDATA[<p><img class="align-right" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/brokenlink.png?323f2c" alt="checking bad links" />When it comes to keeping your website or your blog healthy and strong in search engine listings, regularly checking for broken or otherwise bad links on your website is a very good idea.</p>
<p>Not only is it good for your site&#8217;s overall standings in search listings, it&#8217;s also good for your visitors. No one wants to encounter broken links on a site &#8211; it&#8217;s a sign of a poorly cared for website.</p>
<p>Then again, regularly checking your site for bad links can be a tedious chore. We&#8217;ve covered a few tools here at MUO that can help you stay on top of things if you have the time, like Ann&#8217;s article on <a href="http://www.makeuseof.com/tag/3-notsoobvious-totally-awesome-xenu-link-sleuth/">Xenu Link Sleuth</a>, and Saikat&#8217;s article on <a href="http://www.makeuseof.com/tag/check-urls-free-document-hyperlink-checker/">Hyperlink Checker</a>.</p>
<p>Those are good solutions, but again, they require your time. Checking for bad links takes work. A better solution would be to set up an automated script on your own server (or any computer connected to the Internet) to check your website for bad links and then issue a report with all of the results. Better yet, schedule it to run weekly or monthly, and you never have to think about the task again, until there are bad links discovered.</p>
<h2>Setting Up Your LinkChecker Script</h2>
<p>The tool that I want to focus on is one that we&#8217;ve listed in the MUO directory before called <a href="http://www.makeuseof.com/dir/linkchecker-find-broken-links-site/">LinkChecker</a>.</p>
<p>The reason I choose that tool is because LinkChecker provides an alternative command-line alternative to the standard GUI. In the command line, all you need to do is call the linkchecker application, followed by the URL that you want to check, as well as a assortment of parameters (which I&#8217;ll get to below).</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker1.png?323f2c" alt="checking bad links" width="559" height="328" /></p>
<p>In the case where everything goes well, and there are no issues, the command window will look something like this.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker1b.png?323f2c" alt="checking bad link on the website" width="579" height="333" /></p>
<p>There are no errors, so you&#8217;re just seeing a regular status update of link counts checked by the tool. On the other hand, if you have any bad links, you&#8217;ll see the errors echoed back in the command window as shown here.</p>
<p><img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker2.png?323f2c" alt="checking bad link on the website" width="572" height="328" /></p>
<p>While this is useful only if you want to manually launch the script, what we&#8217;re trying to do here is automate this command. To do this, you need to understand some of the parameters that are available with this command mode option. You can find all of the parameters and flags at the <a href="http://linkchecker.sourceforge.net/man1/linkchecker.1.html">LinkChecker help page</a>. The ones that we are going to focus on are -0 and -f. That&#8217;s the output and the file parameters.</p>
<p>For example, you can issue the command, &#8220;linkchecker -r1 -ocsv -Fcsv http://www.topsecretwriters.com&#8221; to get a CSV file with all of the link check results, which shows up in the root linkchecker directory under the default file name &#8220;linkchecker-out.csv&#8221;.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker4.png?323f2c" alt="checking bad link on the website" width="579" height="482" /><br />
The CSC file shows a full listing of all bad links found, with the link checked in one column and the time/date the broken link was found as well as the warning error script.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-89108" style="border-width: 1px; border-color: black; border-style: solid;" title="linkchecker5" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker5.png?323f2c" alt="finding bad links" width="570" height="558" /></p>
<p>This is a very cool thing &#8211; because now all you have to do is schedule a batch command to run that issues the above linkchecker command, and every day you&#8217;ll have an updated CSV file with a list of all bad links on your website. You can use this list to go through and fix all of the bad links.</p>
<p>If you&#8217;re unfamiliar with how to set up such a scheduled job, all you have to do is create a batch job that has the above command in it, name it something like &#8220;CheckLinks.bat&#8221;, and then schedule that batch job to run every week or every month. Just go to Start &#8211;&gt;Accessories &#8211;&gt; System Tools &#8211;&gt; Scheduled Tasks.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker7.png?323f2c" alt="finding bad links" width="446" height="408" /><br />
Click on &#8220;Add Scheduled Task&#8221; to add the time/date you want it to run and just browse to your batch file when asked.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker8.png?323f2c" alt="finding bad links" width="384" height="97" /><br />
An even cooler solution, if you&#8217;re running your own web server, would be to run the LinkChecker command on your website, output to HTML format, and the move that HTML results page to a special page on your website that you can call up on any web browser to check out.</p>
<p>You can have the LinkChecker tool output to HTML by issuing the following command:</p>
<blockquote><p><em>&#8220;linkchecker -r1 -ohtml -Fhtml/badlinks.html http://www.topsecretwriters.com&#8221;</em></p></blockquote>
<p>What this does is outputs the results to an HTML file on the local linkchecker path. You&#8217;ll want to add a line to your batch file to move that HTML file to the file path where your public HTML files are stored. Just add:</p>
<blockquote><p><em>&#8220;MOVE badlinks.html d:/web-server/xampp/htdocs/badlinks/&#8221;</em></p></blockquote>
<p>This way, you&#8217;ll have a web directory on your website /badlinks/ where you can call up the badlinks.html page. This is what the results look like in HTML format.<br />
<img class="aligncenter" style="border: 0pt none;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/10/linkchecker6.png?323f2c" alt="checking bad links" width="579" height="436" /><br />
Using this approach, you never have to even log into the server or computer where the link check script is running. You can just check your special page and deal with the errors that you find there.</p>
<p>Keeping on top of bad links on your site is more important than most people realize. It also happens more often than you might think, as many of the web pages you might have linked to in that article a few years ago went out of service, leaving all of your visitors out of luck when they try to follow your link to that page.</p>
<p>So, give the command-line option of LinkChecker a shot and see if it lets you improve your website link quality without taking up all of your valuable time. Did you take the approach above, or did you try some other technique? Share your own experiences with the script in the comments section below.</p>
<p><small>Image Credit: <a rel="nofollow" href="http://image.shutterstock.com/display_pic_with_logo/157960/157960,1294571613,1/stock-photo-abstract-d-illustration-of-gray-chain-with-weak-red-link-broken-68570005.jpg">Shutterstock</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.makeuseof.com/tag/automate-checking-bad-links-site-linkchecker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (Requested URI is rejected)
Database Caching 1/45 queries in 0.070 seconds using apc
Object Caching 712/815 objects using disk: basic
Content Delivery Network via main.makeuseoflimited.netdna-cdn.com

Served from: www.makeuseof.com @ 2012-02-10 14:54:20 -->
