Syed Jahanzaib Personal Blog to Share Knowledge !

September 1, 2011

Howto create PPPoE Dialer Installer Package using Auto-iT !


~!~ Article by Syed Jahanzaib ~!~

UPDATED: March, 2017

https://aacable.wordpress.com/2017/03/20/c-pppoe-dialer-program-code/

OLD METHOD of autoit, may not work proeprly so use above mentioned link.

From past few months, I was searching for a method to create a pppoe dialer package installer which can automatically create a new pppoe connection for user,  but I was unable to find any simple method all over the internet. Like the one we can create VPN Dialer Installer Package using Windows 2003 utility called CMAK (Connection management administration kit to

I am basically a Networking type guy who is heavily involved in Microsoft / Linux + Mikrotik Environment and I have no background experience in any programming language , that’s why I asked many people for assistance , but none of any knew about it, and those who knew, didn’t wanted to share the code with general public.

So Finally I decided to do it in my old fashioned style using MS-DOS concepts and logic’s. Today after doing some goggling and thinking about possible solutions in my head, I was able to found a way on how-to do it with the help of a Application name ‘AUTO-IT ‘

Following is a guide on howto to do it in very simple few steps (xp/2000/2003 supported Only at a moment). Being a Linux Lover, I am publishing these codes under GPL (General Public License). You can modify it as per your requirements, redistribute it. Don’t forget to give credit if it helps you :~)

Remember it’s not a standard, neat and clean way but It’s very simple and it does the job nicely:)
[This script was made for Windows 2003/xp Only, I will post Windows Vista/Windows 7 script soon]

Here we go . . .

First of all you have to download ‘Auto-it‘ software from its website at

http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe

I used Latest version: v3.3.6.1, Do full installation of AutoiT.

After installation, launch it by  Goto Start / Programs / Autoit v3  and select SciTE Script Editor

Now an advance Notepad type windows will open, Just paste the following code in it.

(Note: FOR SOME REASONS, Sometimes CODE Does not displayed PROPERLY IN THIS BLOG, IF you face syntax errors,  you can copy the raw code from following location) http://pastebin.com/jSu5mHmg

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
 Author:         SYED JAHANZAIB
 Email:          aacable@hotmail.com
 Web:            https://aacable.wordpress.com
 OS Supported:   Windows XP
 Script Function:
 Template AutoIt script. for PPPoE Dialer Installer
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#NoTrayIcon
 #compiler_icon=itlifesaver.ico
 #include <GUIConstants.au3>
$COMPANY_NAME = "AACABLE - DIALER SERVICE" ; name of the pppoe icon, friendly description
 $SERVICE_NAME = "aa" ; name of the pppoe service configured in NAS/Mikrotik
$DELAY = 200
 ; change this DELAY value to speedup or slow down the process,
 ;any range between 200-300 is better in my view, too fast will shatter things
;This is for showing your logo for 2 secs
 ;$destination = "C:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg"
 ;SplashImageOn("Splash Screen", $destination,250,50)
 ;Sleep(2000)
 ;SplashOff()
$answer = MsgBox(4, "PPPOE Connection", "This script will create a PPPOE DIALER connection to " & $COMPANY_NAME & ", Ready?")
 If $answer = 7 Then
 Exit
 EndIf
; Prompt user for PPPOE login info
 $frmInformation = GUICreate("Enter Information", 287, 194, 193, 115)
 $lblUserName = GUICtrlCreateLabel("User Name:", 16, 40, 60, 17)
 $lblPassword = GUICtrlCreateLabel("Password:", 16, 80, 53, 17)
 $txtUserName = GUICtrlCreateInput("", 112, 40, 153, 21)
 Dim $ES_PASSWORD,$ES_AUTOHSCROLL
 $txtPassword = GUICtrlCreateInput("", 112, 80, 153, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
 $lblPassword2 = GUICtrlCreateLabel("Confirm Password:", 16, 120, 91, 17)
 $txtPassword2 = GUICtrlCreateInput("", 112, 120, 153, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
 $btnOK = GUICtrlCreateButton("&OK", 200, 160, 75, 25, 0)
 $lblInfo = GUICtrlCreateLabel("Enter your pppoe Login Information Below!", 48, 8, 196, 17)
 GUISetState(@SW_SHOW)
While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
 Case $btnOK
 If GUICtrlRead($txtPassword) <> GUICtrlRead($txtPassword2) Then
 MsgBox (16, "Error", "Passwords do not match! Try again.")
 Else
 $Username = GUICtrlRead($txtUsername)
 $Password = GUICtrlRead($txtPassword)
 ExitLoop
 EndIf
 Case $GUI_EVENT_CLOSE
 Exit
EndSwitch
 WEnd
 GUISetState(@SW_HIDE)
; Run Network Setup
 Run("control ncpa.cpl")
 WinWaitActive("Network Connections")
; Check if PPPOE dialer by same name already exists, since it'll break script later if Windows add's a number at the end of the name...
 $ControlID = ControlListView("Network Connections", "", "SysListView321", "FindItem", $COMPANY_NAME, "AACABLE - DIALER SERVICE")
 If $ControlID <> -1 Then
 $answer = MsgBox(4404, "Error", "Connection to " & $COMPANY_NAME & " already exists! Remove it and recreate it?")
 If $answer = 6 Then
 ControlListView("Network Connections", "", "SysListView321", "Select", $ControlID)
 Send("{DEL}")
 WinWaitActive("Confirm Connection Delete")
 Send("!y")
 Sleep($DELAY)
 Else
 MsgBox(16, "Exit", "Script stopped by user")
 Exit
 EndIf
 EndIf
; open new connection wizard from file menu
 Send("!f")
 Send("n")
 Sleep($DELAY)
; New Connection Wizard
 Sleep($DELAY)
 Send("!n")
 Sleep($DELAY)
; Choose Conncetion type
 Sleep($DELAY)
 Send("!n")
 Sleep($DELAY)
; setup connectoin manuall
 Send("!m")
 Sleep($DELAY)
 Send("!n")
 Sleep($DELAY)
; Connect using broadband connection with user name n passwd
 Send("!u")
 Sleep($DELAY)
 Send("!n")
 Sleep($DELAY)
; Send Your ISP Name
 Send($COMPANY_NAME)
 Send("!n")
 Sleep($DELAY)
;Donot send id password here, we will set it in End
 Send("!n")
 Sleep($DELAY)
; Wizard Complete, do we want a desktop shortcut?
 Send("!s")
 Sleep($DELAY)
 Send("{ENTER}")
WinWaitClose("New Connection Wizard")
WinWaitActive("Connect " & $COMPANY_NAME)
Send($Username)
 Send("{TAB}")
 Send($Password)
Sleep($DELAY)
Send("!s") ; save password...
Send("!a") ; for anyone who uses this computer, use "!n" for 'Me only'
Sleep($DELAY)
WinClose("Network Connections")
MsgBox(0, "Setup Complete", "Your Dialer have been installed , Click Connect to initiate dialing . . .")

Now Open File / Save and name it ‘aa-dialer-installer’

Now your script with source code is ready to be compiled in .EXE executable format so any user can install it like any other normal application.

Now Open Tools and click on ‘Compile’ and it will compile the script in .exe format and it will save it to the Desktop or whatever Path You have selected.

Now click on ‘aa-dialer-install.exe’ and it will install the pppoe dialer and place its shortcut on Desktop.

Any suggestions on improvements and enhancements / advancements are most welcome  and will be appreciable 🙂
Regrd’s
Syed Jahanzaib

Advertisements

%d bloggers like this: