Sunday, 5 October 2014

Android Application of this blog!

Presenting an android application based on this blog. The application can be downloaded here.
It has good interface and it includes most famous articles of this blog and you can read them offline.
Please download and have a look. This application will be upgraded time to time, so please upgrade accordingly.

Good part of this application is that it can be run offline, so if you do not have internet, still you can study and learn things related with Powershell.

Hope you would like this application.


Saturday, 31 May 2014

Speaking Script in Powershell

A script can be written which can talk to you and speak out - "Sir! Your copy job has completed." or something like "Sir! Please press any key to continue!". These all are not fictions with Powershell and you don't have to write much more lines of code to accomplish. In fact, this is just a one liner!

(new-object -com SAPI.SpVoice).speak("One more Powershell tips")

So, I decided to write a completely talking script which will copy all file from one location to another.

#--Script will demonstrate File-copy with speaking voice. --# 


$source_dir="E:\folder1"
$target_dir="E:\folder2"

#-- List number of files --#

$count=0

ls ${source_dir} | select Name | foreach { $count++}

(new-object -com SAPI.SpVoice).speak("Sir! Total ${count} files to be copied. Please wait for sometime, Thank you!!")

Copy-Item "$source_dir\*.*" "$target_dir" -recurse


if ($? -ne $True )
{
(new-object -com SAPI.SpVoice).speak("Sorry! Your file-copy operation failed, please troubleshoot!!")
}
else

{
(new-object -com SAPI.SpVoice).speak("Sir! Your file-copy operation completed successfully, Thank you!!")
}



Once you run it, you will have more ideas about writing any interactive script which could give messages verbally. I am now thinking to write something which will take commands from microphone!!