Felix Timer....My first Full-Fledged Application

Here at last is my first Application. Although its only useful for those people who are using a BSNL Internet Connection with a Rs. 500/- Plan and are lazy enough not to get up at 2.00 in the morning to start their downloads and again sit in front of the PC at 8.00 A.M. to stop the started downloads.

It is very funny how this idea came up. I was trying to develop a virus in my Second Year(especially for Ashish), and it took me around 16-18 days to complete it(No, I am not going to publish it). Well, most of the days (around 13) went for learning the AutoHotKey Scripting Lanugage and its numerous functions and variables. Now, the idea for this Enabling/Disabling LAN during the Limited hours came when we were discussing it in the class during lunch. All I needed was the method in which I could retrieve the list of LAN's in a PC or its NIC's. I did not exactly write the whole of this code actually but borrowed the base code from SEAN, an autohotkey community member. All I had to do was to formulate a timing pattern which took most of my time. Its 12.02 A.M. and I am very excited(however useless my application is) as the application is working very well and as designed. And forgive me for the Name - "Felix Timer", I couldn't resist myself.

Here is the source code of the App along with its Help document

File Name: Help.txt

I developed this application with the BSNL Internet Connection Rs.500/- plan in my mind. So I would advice only those users using the aforementioned Plan to use this Application.

Must do::

Go to Control Panel>Network Connections and
RENAME THE INTERNET CONNECTION IN NETWORK CONNECTIONS AS "BSNL Internet" (without the quotes). The application won't work if it is not renamed correctly.


All this application does is

1. To enable the LAN connection betweeen 2.10 A.M. and 7.50 A.M.
2. To disable the LAN connection when the time is not betweeen 2.10 A.M. and 7.50 A.M.

The application is present at the bottom-left corner of the taskbar in the shape of a "H" with a green background.

To Stop the Script, Right-click on the "H" icon and select "Exit"
To pause the Script at any time, Right-click on the Green "H" icon and select "Pause Script"
To Re-enable the Script, Right-click on the Red "H" icon and remove the tick on "Pause Script"
Clicking on "Suspend Hotkeys" has no effect on the app. as I did not use any.
The application is named "Felix Timer.exe" in the task-manager processes tab. Do not Kill it when you are using the application.
The Files of this program are extracted to "c:\ProgramFiles\FelixTimer"

To Manually Enable/Disable LAN connections, Click on 'Start' and go to 'Connect to' and select 'Show all connections". Then right click on any network in the list and Disable it.

No copyrights. No patents. No trademarks of my own. AutoHotkey is a registered Freeware and all the Patents, copyrights and trademarks are owned by it. You may use this app for Non-commercial Purposes.
This software is tested only in XPSP2. So I am not responsible for any crashes or disturbances it causes in you PC. Use it at your OWN RISK.(Not that it contains any trojans)
I would like to thank Sean of AutoHotKey Community for his base code of "Enable/Disable a Network Connection" and his "Cohelper.ahk" library. Contact me for the source code at http://ecerocks.blogspot.com/


File Name: Felix Timer.ahk

#persistent
#singleinstance ignore
#Include CoHelper.ahk
settimer, rep,2000 ;repeat this label for every 2 seconds
return


rep: ;this is a label

hour=%A_Hour% ;current hour
min=%A_Min% ;current minute

if( (hour>02) and (hour<7)>
{ NetConnect(1)
;Msgbox %A_Hour% %A_Min% within limits
}
else if(hour=2 and min>9)
{ NetConnect(1)
;Msgbox %A_Hour% %A_Min% within limits
}
else if(hour=7 and min<50)
{ NetConnect(1)
;Msgbox %A_Hour% %A_Min% within limits
}
else
{ NetConnect(0)
;Msgbox %A_Hour% %A_Min% Off limits
}


;NetConnect(0)
;Sleep, 5000
;NetConnect(1)


NetConnect(bEnable = False, sConnection = "BSNL Internet")
{
CoInitialize()
psh := ActiveXObject("Shell.Application")

pns := Invoke_(psh, "Namespace", 3, CSIDL_Connections:=0x0031)
pitems := Invoke(pns, "Items")

Loop, % Invoke(pitems, "Count")
{
pid := Invoke_(pitems, "Item", 3, A_Index-1)
If (Invoke(pid, "Name") = sConnection)
{
bRes := True
Break
}
Release(pid)
}

If !bRes
ExitApp

pverbs := Invoke(pid, "Verbs")
pvb := Invoke_(pverbs, "Item", 3, nVB:=0)

If pvb
{
sVerbName := Invoke(pvb, "Name")
If (bEnable && InStr(sVerbName, "&a")) || (!bEnable && InStr(sVerbName, "&b")) ; &a and &b can be Language dependent.
Invoke(pvb, "DoIt")
WinWait, %sConnection% ahk_class #32770,, 1
WinWaitClose
Release(pvb)
}

Release(pverbs)
Release(pid)
Release(pitems)
Release(pns)
Release(psh)
CoUninitialize()
}



return ; end settimer


File Name: Felix_Timer_Setup.ahk

MsgBox, 4,Felix Timer Setup, Install Felix Timer?
IfMsgBox Yes
{
FileCreateDir, %A_ProgramFiles%\Felix Timer


FileInstall,Felix Timer.exe, %A_ProgramFiles%\Felix Timer\Felix Timer.exe,1
FileInstall, Help.txt, %A_ProgramFiles%\Felix Timer\Help.rtf,1
FileCreateShortcut %A_ProgramFiles%\Felix Timer\Felix Timer.exe, %A_Desktop%\Felix Timer.lnk, %A_ProgramFiles%\Felix Timer, ,A LAN Enable/Disable Timer

FileCreateShortcut %A_ProgramFiles%\Felix Timer\Felix Timer.exe, %A_StartMenu%\Felix Timer.lnk, %A_ProgramFiles%\Felix Timer, ,A LAN Enable/Disable Timer

FileCreateShortcut %A_ProgramFiles%\Felix Timer\Help.rtf, %A_StartMenu%\Help for Felix Timer.lnk, %A_ProgramFiles%\Felix Timer, ,Help for Felix Timer


MsgBox Rename the Internet Connection in Control Panel > Network Connections as "BSNL Internet"(without the quotes). The application wont work if its not done properly.

Run %A_ProgramFiles%\Felix Timer\Help.rtf,,Max

}

IfMsgBox No
MsgBox Then why bother clicking it. So you don't have a BSNL LAN Connection with Rs.500 Plan? Then never mind this application.


File Name: CoHelper.ahk -- Sean from AutoHotkey Community.

2 Comments:

Doria said...

This is great info to know.

Anonymous said...

[url=http://cpcheat.org/]Club Penguin[/url] gives you a [url=http://cpcheat.org/club-penguin-money-maker/]Club Penguin Money Maker[/url] that allows you to make a lot of coins in Club Penguin.
[url=http://cpcheat.org/]Club Penguin Codes[/url] also provides you with [url=http://cpcheat.org/club-penguin-trackers/]Club Penguin Trackers[/url] such as a [url=http://cpcheat.org/club-penguin-aunt-arctic-tracker/]Club Penguin Aunt Arctic Tracker[/url], a [url=http://cpcheat.org/club-penguin-cadence-tracker/]Club Penguin Cadence Tracker[/url], a [url=http://cpcheat.org/club-penguin-gary-tracker/]Club Penguin Gary Tracker[/url], a [url=http://cpcheat.org/club-penguin-band-tracker/]Club Penguin Band Tracker[/url], a [url=http://cpcheat.org/club-penguin-rockhopper-tracker/]Club Penguin Rockhopper Tracker[/url], and a [url=http://cpcheat.org/club-penguin-sensei-tracker/]Club Penguin Sensei Tracker[/url].
Last,[url=http://cpcheat.org/]Club Penguin Codes[/url] gives you [url=http://cpcheat.org/club-penguin-bots/]Club Penguin Bots[/url] and [url=http://cpcheat.org/]Club Penguin Mission Cheats[/url] and [url=http://cpcheat.org/]Club Penguin Coin Cheats[/url]