SHARE
TWEET

PPPoE Dialer Installer Script in AUTOIT by Syed Jahanzaib

aacable Sep 2nd, 2011 2,164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #cs ----------------------------------------------------------------------------
  2.  
  3. AutoIt Version: 3.3.6.1
  4. Author:         SYED JAHANZAIB
  5. Email:          aacable@hotmail.com
  6. Web:            http://aacable.wordpress.com
  7. Script Function:
  8. Template AutoIt script. for PPPoE Dialer Installer
  9.  
  10. #ce ----------------------------------------------------------------------------
  11.  
  12. ; Script Start - Add your code below here
  13.  
  14. #NoTrayIcon
  15. #compiler_icon=itlifesaver.ico
  16. #include <GUIConstants.au3>
  17.  
  18. $COMPANY_NAME = "AACABLE - DIALER SERVICE" ; name of the pppoe icon, friendly description
  19. $SERVICE_NAME = "aa" ; name of the pppoe service configured in NAS/Mikrotik
  20.  
  21. $DELAY = 200
  22. ; change this DELAY value to speedup or slow down the process,
  23. ;any range between 200-300 is better in my view, too fast will shatter things
  24.  
  25. ;This is for showing your logo for 2 secs
  26. ;$destination = "C:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg"
  27. ;SplashImageOn("Splash Screen", $destination,250,50)
  28. ;Sleep(2000)
  29. ;SplashOff()
  30.  
  31. $answer = MsgBox(4, "PPPOE Connection", "This script will create a PPPOE DIALER connection to " & $COMPANY_NAME & ", Ready?")
  32. If $answer = 7 Then
  33. Exit
  34. EndIf
  35.  
  36. ; Prompt user for PPPOE login info
  37. $frmInformation = GUICreate("Enter Information", 287, 194, 193, 115)
  38. $lblUserName = GUICtrlCreateLabel("User Name:", 16, 40, 60, 17)
  39. $lblPassword = GUICtrlCreateLabel("Password:", 16, 80, 53, 17)
  40. $txtUserName = GUICtrlCreateInput("", 112, 40, 153, 21)
  41. Dim $ES_PASSWORD,$ES_AUTOHSCROLL
  42. $txtPassword = GUICtrlCreateInput("", 112, 80, 153, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
  43. $lblPassword2 = GUICtrlCreateLabel("Confirm Password:", 16, 120, 91, 17)
  44. $txtPassword2 = GUICtrlCreateInput("", 112, 120, 153, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
  45. $btnOK = GUICtrlCreateButton("&OK", 200, 160, 75, 25, 0)
  46. $lblInfo = GUICtrlCreateLabel("Enter your pppoe Login Information Below!", 48, 8, 196, 17)
  47. GUISetState(@SW_SHOW)
  48.  
  49. While 1
  50. $nMsg = GUIGetMsg()
  51. Switch $nMsg
  52. Case $btnOK
  53. If GUICtrlRead($txtPassword) <> GUICtrlRead($txtPassword2) Then
  54. MsgBox (16, "Error", "Passwords do not match! Try again.")
  55. Else
  56. $Username = GUICtrlRead($txtUsername)
  57. $Password = GUICtrlRead($txtPassword)
  58. ExitLoop
  59. EndIf
  60. Case $GUI_EVENT_CLOSE
  61. Exit
  62.  
  63. EndSwitch
  64. WEnd
  65. GUISetState(@SW_HIDE)
  66.  
  67. ; Run Network Setup
  68. Run("control ncpa.cpl")
  69. WinWaitActive("Network Connections")
  70.  
  71. ; 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...
  72. $ControlID = ControlListView("Network Connections", "", "SysListView321", "FindItem", $COMPANY_NAME, "AACABLE - DIALER SERVICE")
  73. If $ControlID <> -1 Then
  74. $answer = MsgBox(4404, "Error", "Connection to " & $COMPANY_NAME & " already exists! Remove it and recreate it?")
  75. If $answer = 6 Then
  76. ControlListView("Network Connections", "", "SysListView321", "Select", $ControlID)
  77. Send("{DEL}")
  78. WinWaitActive("Confirm Connection Delete")
  79. Send("!y")
  80. Sleep($DELAY)
  81. Else
  82. MsgBox(16, "Exit", "Script stopped by user")
  83. Exit
  84. EndIf
  85. EndIf
  86.  
  87. ; open new connection wizard from file menu
  88. Send("!f")
  89. Send("n")
  90. Sleep($DELAY)
  91.  
  92. ; New Connection Wizard
  93. Sleep($DELAY)
  94. Send("!n")
  95. Sleep($DELAY)
  96.  
  97. ; Choose Conncetion type
  98. Sleep($DELAY)
  99. Send("!n")
  100. Sleep($DELAY)
  101.  
  102. ; setup connectoin manuall
  103. Send("!m")
  104. Sleep($DELAY)
  105. Send("!n")
  106. Sleep($DELAY)
  107.  
  108. ; Connect using broadband connection with user name n passwd
  109. Send("!u")
  110. Sleep($DELAY)
  111. Send("!n")
  112. Sleep($DELAY)
  113.  
  114. ; Send Your ISP Name
  115. Send($COMPANY_NAME)
  116. Send("!n")
  117. Sleep($DELAY)
  118.  
  119. ;Donot send id password here, we will set it in End
  120. Send("!n")
  121. Sleep($DELAY)
  122.  
  123. ; Wizard Complete, do we want a desktop shortcut?
  124. Send("!s")
  125. Sleep($DELAY)
  126. Send("{ENTER}")
  127.  
  128. WinWaitClose("New Connection Wizard")
  129.  
  130. WinWaitActive("Connect " & $COMPANY_NAME)
  131.  
  132. Send($Username)
  133. Send("{TAB}")
  134. Send($Password)
  135. Sleep($DELAY)
  136. Send("!s") ; save password...
  137. Send("!a") ; for anyone who uses this computer, use "!n" for 'Me only'
  138. Sleep($DELAY)
  139.  
  140. WinClose("Network Connections")
  141. MsgBox(0, "Setup Complete", "Your Dialer have been installed , Click Connect to initiate dialing . . .")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top