Showing posts with label -sta. Show all posts
Showing posts with label -sta. Show all posts

Tuesday, April 23, 2013

Powershell Script : Stopwatch

Hi,

Few days back I upload a script on “Powershell Digital Clock”, when i was writing that script at that time another script idea strike in to my mind, that ideas was to create a Stopwatch using Powershell.

I don’t know writing a script for stopwatch is a good idea or not, but i know one thing that i will learn a new thing and that may be helpful in the future.

After thinking i started writing an GUI based script to creating a stopwatch.

Powershell has open lots of possibilities for system administrators like me. We just need to imagine what we want and we able to achieve it easily using Powershell.

Last week when i take a session in Delhi User Group meeting, i told attendees that Powershell is the most easiest scripting language to be learn.

Anyway.

In this “Stopwatch” i used 4 buttons, one to start the clock, One to stop the clock , one to reset the stopwatch and another is for the lap.

I am not so good in designing GUI so ignore the colour of the buttons ;o).

In this script i learn few new things.

Lesson Learned:

  • System.Diagnostics.Stopwatch class
  • Few methods of System.Diagnostics.Stopwatch class
  • Make multiline textbox in powershell to auto scroll using
              • $textBox1.SelectionStart = $textBox1.Text.Length;
                $textBox1.ScrollToCaret()

  •  

23-04-2013 22-51-47 23-04-2013 22-55-52  

“Screenshot of the script”

Please run this script in –Sta mode

23-04-2013 22-54-51

Download Link : https://dl.dropboxusercontent.com/u/17858935/StopWatch-Community-Edition.zip

 

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Monday, April 15, 2013

Samay : Powershell script based digital clock.

Hi,

Few days back i was writing an powershell GUI based script, in that script I need to add a clock.

First i thought how can i make a clock? I was thinking about an hour and then i got an idea. why not to use timer object and use it for creating an clock.

This is what i have done to create a GUI clock.
  1. Created a blank form on “Powershell Studio”
  2. Add a blank label to it
    1. 15-04-2013 23-12-48
  3. Added a time object to it.
    1. 15-04-2013 23-13-18
  4. In timer object property , i set Enabled to true, and interval to 1 {which is very low because the it is in milliseconds}
  5. Double click on “Timer” object and i added the below code.
  6. 15-04-2013 23-11-16
  7. In above code , i am just converting, Get-Date to string.
  8. and when you run scrip the outcome is running Powershell Digital clock.
Screenshot
15-04-2013 23-03-59

You can download the script from here: http://gallery.technet.microsoft.com/scriptcenter/Samay-Powershell-Digital-45acb9d2

Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007




Download Link : https://dl.dropboxusercontent.com/u/17858935/Samay-Digital_Clock.zip