AutoIT- Simple Timer

A simple Autoit code..

[autoit]

#comments-start
# author : ram
# site      : ramnathbabu.com
# Displays a timer at the TOP LEFT (can be customized)
#         corner of your screen. Displays the time you have spent
# You are free to modify/use/distribute the code.
# Try to retain the site somewhere in the script
#comments-end

; setting HotKey
HotKeySet(“{ESC}” , “fexit”)

;Tray GUI Creation
$aboutitem  = TrayCreateItem(“About”)
TrayCreateItem(“”)
$exit = TrayCreateItem(“Exit”)
TraySetState()

;Timer
$begin = TimerInit()

While 1
; gives seconds
$T = StringLeft( TimerDiff($begin), _
StringInStr(TimerDiff($begin), “.”) -4)

Sleep(20)

; check if the tray has been clicked
$msg = TrayGetMsg()

; tooltip diplay @ top-left corner
ToolTip(“” & Int($T / 60) & “:” & mod($T,60), 0, 0, “Timer”)

Select
Case $msg = $aboutitem
; if the user has clicked “About”
Msgbox(64,”About:”,”November 2010″ & @crlf & @crlf & _
“Instructions:” & @CRLF & “ALT+CTRL+SHIFT+X – Get Progress” _
& @CRLF & “ALT+ESC – Exit Program” & @crlf & @crlf & “Free usage :)”)

Case $msg = $exit
; if the user has clicked “Exit”
Exit
EndSelect
WEnd

func fexit()
; when “Esc” button is pressed – exit
Exit
EndFunc

[/autoit]

Programming Languages

I was recently searching for A GOOD programming language to cling on to.. I have a worked for some time now, looking at various programming languages to get a feel of the available programing paradigms . Considering the fact that one does not generally have the luxury of time, I thought it would be more appropriate to first understand the available tools of trade before u get your hands dirty writing your own piece of code from scratch ( I am no demoralising the ones who are enthusiastic about writing their own code.. It is just that I believe, the (more) important question is what u added to the existing body of knowledge/code).

Being a person willing to hack my way out, in case I need to get something done, I have an ardent fan and I always would vouch for open-source programs

From the point of view of a researcher, I think the choice of a programming language is all the more important. As I write this post ( as the year 2010 draws to end ) I still find that the major programming languages have  a long way to go to reach what I prefer to call intuitive programming. ( Mathematica is a , which is to be released sooner, has implemented free-form input, which I think is a significant step towards this).

Now given the fact that no one is yet there, I would restate the question I posed in the beginning of this blog, about the choice of programming language. I have read some posts on the internet and have summarized some of my personal opinion here with relevant references. I hope this post would come in handy for a person who is wondering about the choice of programming languages.

I am a researcher,and simply put, I am looking for the following features in a GOOD programming language ( designers note …),

  • which can crunch numbers .. and is as fast as it can get (SPEED IS A MUST).. I know that hand-tweaking a C,C++ or FORTRAN code is (currently)  the ONLY solution, considering practicality. (I am not all free to write an OPTIMAL ASSEMBLY code and hand optimize it.  )..I would like the compiler or the interface to do this for me
  • which is intuitive to program, i.e. when I am programming, I want to be thinking in terms of MY ALGORITHM rather than in terms of the control structures or data structures what the program has to offer ( as an example, if I am thinking about an algorithm to determine the similarity of two shapes, I would like to think in terms of intuitive terms such as curvature, norms etc and not in terms of foreach pixel in row , foreach pixel in col , etc..) .  (I know this is a conflicting to the above statement, meaning it is simply too much to expect the performance of a low-level language from such a high level system. But this may be A feasible solution.. give the user low level access as well, and allow the user to hand optimise sections of the code .. Say for example including sections of assembly code in the main code) .. I dont think a black box approach will comply this and hence this practically eliinates almost all closed source programming languages and packages…
  • (Obviously) I expect a LOT of others to use such a language..  this goes without saying. (Being a researcher I would not like to be put to the embarassing position of writing the drivers of whichever hardware I use, JUST because I am the first person in the world who is with this  DEVICE + ProgrammingLanguage combo and even if I am willing to write one, I should not be ALONE in the WORLD who does it  🙂 ).

AutoIt !

I am (actually was) an ardent fan of the Visual Studio programming environment, especially Visual Basic. I found that it reduced the job of creating GUIs to mere click and drag (dint realize it was making me lazy) . Initial codes for my toy-experiments were simple  enough to code. I took a few days to code them when I was in high school.

I was beginning to start automating my computer ( I personally do not like doing robo-jobs). As the complexity of the code started increasing (i.e. , as I wanted to perform larger number of simpler tasks), I realized I was spending more time searching for snippets of code on the internet to perform simple tasks such as displaying the taskbar icon or saving the environment variables to a .ini file and or saving a screenshot into a file (specifically .jpg file). I needed SIMPLE/QUICK-fixes for a relatively small jobs ( all I wanted is that the snippet be reliable ).

This was when I came across this utility called AUTOIT . ( I had earlier visited the page of AutoHotkey..). The syntax of AutoIT was very very close to that of Visual Basic. So I went through the AutoIt tutorial on youtube ( it took a few hours on a weekend to complete this series 🙂 ) . I have started using AutoIT now .. And I have created some cool applications.  And I dint think I will be able to ever assemble so many features into a single small yet powerful code. As a sample, my time-keeper application with automatic logging + .ini file exporter + taskbar icon + context-menus on the taskbar icon + timer + system-wide-hotkeys) application took me 130 lines 🙂 ( & yes this includes the comments too )..  Hoping to uploading the codes soon .. ( You can get my codes/project downloads at the download section of my HOMEPAGE)

THE Creative Commons Licence

Being an ardent fan of open-source software, I think it is one of the revolutionary ideas.. giving away things for free. Put in other words, maintaing a single copy of a thing which is accessible to ANYONE. I believe as it is stated in the Wiki Page, that the sum of human knowledge must be available to ANYONE, anywhere , free of cost 🙂

A nice quote I read ,( I do not I know the Author and I could not Google it up) ..

“A lot can be achieved if it does not matter who takes the credit “

And I JUST LOVE this page .. and have a copy of it ..( Just in case they loose the page 😛 )

Creative Commons Deed

This is a human-readable summary of the full license below.

You are free:

  • to Share—to copy, distribute and transmit the work, and
  • to Remix—to adapt the work

Under the following conditions:

  • Attribution—You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work.)
  • Share Alike—If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.

With the understanding that:

  • Waiver—Any of the above conditions can be waived if you get permission from the copyright holder.
  • Other Rights—In no way are any of the following rights affected by the license:
  • Notice—For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do that is with a link to http://creativecommons.org/licenses/by-sa/3.0/

Just exercising my right as the page says

“Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights “

OBVIOUSLY THE RULES IN THIS POST APPLIES TO THIS POST too

My Blog?

Hello World ..

So this is MY web log .. I will be putting up some wierd thoughts I have had. Thought I have to share it with the world ( I know the probability of this page being read among the estimated 109.5 million websites ( estimated a year back , that is 2009) and 1 Trillion unique URLs ( reported recently by Google ) in the WWW jungle is low..still I would like to give it a try
Some wierd-ities follow…. please bear with me .. 🙂

Broken Link !

Huh.. this is my second installation of WordPress.

The previous one got overwritten ( by me ), guess when I was exploring the files..

This is what I apparently did ..  as this blog puts it , I locked myself out after amending file path setting.

The solution was simple, edit the wp-config.php file and add these two lines of code :

[php]define(‘WP_HOME’,’http://ursite.com/wordpress’);

define(‘WP_SITEURL’,’http://ursite.com/wordpress’);[/php]

and then reload the page.. more about this on this page

Note that this is a hack ( a shortcut so to say ). To realize this goto your General settings in your admin panel , you will find that the WordPress address (URL) and the Site address (URL) are blurred. For a clean fix you will have to modify the database name in the WordPress website as given in this page

Hello world!

Hi .. this is my first post using WordPress . A test post ..

Thank You .. all those who created this fine piece of software..

I wanted to be able to access my codes, wherever I am. I am tired of synchronizing files across various PCs using USBs etc. and at last resorted to uploading them online. This way other ppl  who are interested in the same code can just use it.
I will be sharing my codes here .. Suggestions or Hacks are welcome 🙂