Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #cs ----------------------------------------------------------------------------
- AutoIt Version: 3.3.6.1
- Author: SYED JAHANZAIB
- Email: aacable@hotmail.com
- Web: http://aacable.wordpress.com
- 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 . . .")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement