• Auto Login to a Wireless Network (Browser)

    Home » Forums » AskWoody support » Windows » Windows – other » Auto Login to a Wireless Network (Browser)

    Author
    Topic
    #475867

    My school’s wireless requires people to accept a certificate to use the net. This certificate is kind of wonky so I have to use Opera to (or IE but that’s not happening) to accept it. Firefox 3.6 and earlier it just wouldn’t connect. Firefox 4 just crashes. What I want to do is have my computer automatically run a script (which I can figure out how to right) when it detects that I’m connected to a certain SSID but don’t have an internet connection. Of course if someone knows an easier way to automatically login to a browser system that would be useful as well.

    To fully clarify I’ll list the steps to connecting to the internet:
    My computer automatically connects to the SSID LC3

    It pops up a little message that says something to the extent of more login info is needed.

    I Open Opera (for as I said my default browser just crashes)

    I open a new URL so I to trigger the login

    I accept a javascript usage dialog

    I click to accept the terms of use.

    Viewing 3 reply threads
    Author
    Replies
    • #1274623

      I’d recommend using AutoIT to automate the login procedure from the point the message pops up requiring additional information to connect. Install AutoIT and the SciTE editor packages to provide a development environment.

      Here’s a trivial script I wrote as an exercise as an example of some of the capabilities of AutoIT. Run this script while viewing this forum topic to get the information on-screen and posted to a file in your Documents folder. Tested on IE and Chrome.

      If you want to stay “native” (that is don’t install another program) then VBScript is probably capable, but I don’t have a useful example to offer there.

      Code:
      ; ===============================================================================================================================
      ; Name………..: GetClientScreenInfo
      ; Description …: Displays the rect of a specific window and saves rect to file
      ; Syntax………: GetClientScreenInfo
      ; Parameters ….: none
      ; Return values .: none
      ; Author ……..: PJ
      ; Examples of …:
      ;			– accessing registry keys
      ;			– locating specific open window
      ;			– accessing window information via API
      ;			– output information to file
      ; ===============================================================================================================================
      
      Opt(“MustDeclareVars”, 1)       ;0=no, *1=require pre-declare
      Opt(“WinSearchChildren”, 1)     ;0=no, *1=search children also
      Opt(“WinTextMatchMode”, 1)      ;*1=complete, 2=quick
      Opt(“WinTitleMatchMode”, 1)     ;*1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
      Opt(“WinWaitDelay”, 250)        ;250 milliseconds
      
      #include 
      #include 
      
      ; Put program in function Main to keep all variables local
      Main()
      
      Func Main()
      Local $outfile, $file, $hwnd, $rect, $userdocs, $output
      
      ; Locate the users documents folder – cannot assume to be in the user profile
      	$userdocs = RegRead(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders”, _
      						“Personal”)
      ; Create output file
      	$outfile = $userdocs & ‘ScreenSize.txt’
      
      ; Identify the window to check by title – MUST BE EXACTLY AS SHOWN!
      	$hwnd = WinActivate(“Auto Login to a Wireless Network”)
      
      ; Obtain the window parameters and write to screen and file
      	$rect = _WinAPI_GetClientScreenRect($hwnd)
      	If IsArray($rect) Then
      		MsgBox(0, “_WinAPI_GetClientScreenRect Example”, _
      			“Left:   ” & $rect[0] & @CRLF & _
      			“Right:  ” & $rect[1] & @CRLF & _
      			“Top:    ” & $rect[2] & @CRLF & _
      			“Bottom: ” & $rect[3] & @CRLF & _
      			“Width:  ” & $rect[1] – $rect[0]  & @CRLF & _
      			“Height: ” & $rect[3] – $rect[2])
      
      		$output = “_WinAPI_GetClientScreenRect Example”  & @CRLF &  _
      			“Left:     ” & $rect[0] & @CRLF & _
      			“Right:    ” & $rect[1] & @CRLF & _
      			“Top:      ” & $rect[2] & @CRLF & _
      			“Bottom:   ” & $rect[3] & @CRLF & _
      			“Width:    ” & $rect[1] – $rect[0]  & @CRLF & _
      			“Height:   ” & $rect[3] – $rect[2]  & @CRLF & _
      			 @CRLF
      		$file = FileOpen($outfile, 1)
      		FileWriteLine($file, $output)
      		FileClose($file)
      
      	Else
      		MsgBox(0,”Failed”,”Failed”)
      	EndIf
      
      EndFunc
      
      
      ; #FUNCTION# ====================================================================================================================
      ; Name………..: _WinAPI_GetClientScreenRect
      ; Description …: Returns the onscreen rect of a window.
      ; Syntax………: _WinAPI_GetClientScreenRect($hWindow)
      ; Parameters ….: $hWindow     – Identifies an open handle to a window
      ; Return values .: Success       – Array
      ;                   [0] Left
      ;                   [1] Right
      ;                   [2] Top
      ;                   [3] Bottom
      ;                  Failure       – False
      ; Author ……..: Nemcija
      ; Remarks …….: For minimized windows values wouldn’t be correct!
      ; Related …….: _WinAPI_GetClientRect
      ; Example …….:
      ;~      $hwnd = GUICreate(“test”,100,150,5,200)
      ;~      $rect = _WinAPI_GetClientScreenRect($hwnd)
      ;~      If IsArray($rect) Then
      ;~          MsgBox(0, “_WinAPI_GetClientScreenRect Example”, _
      ;~              “Left: ” & $rect[0] & @CRLF & _
      ;~              “Right: ” & $rect[1] & @CRLF & _
      ;~              “Top: ” & $rect[2] & @CRLF & _
      ;~              “Bottom: ” & $rect[3])
      ;~      Else
      ;~          MsgBox(0,”Failed”,”Failed”)
      ;~      EndIf
      ; ===============================================================================================================================
      Func _WinAPI_GetClientScreenRect($hWindow)
          Local $tLocalClientRect, $tPoint, $aiReturnValue[4]
          $tLocalClientRect = _WinAPI_GetClientRect($hWindow)
          if @error Then Return SetError(@error, @extended, False)
          $tPoint = DllStructCreate(“int X;int Y”)
          DllStructSetData($tPoint, “X”, DllStructGetData($tLocalClientRect, “Left”))
          DllStructSetData($tPoint, “Y”, DllStructGetData($tLocalClientRect, “Top”))
          _WinAPI_ClientToScreen($hWindow, $tPoint)
          if @error Then Return SetError(@error, @extended, False)
          $aiReturnValue[0] = DllStructGetData($tPoint, “X”)
          $aiReturnValue[1] = $aiReturnValue[0] + DllStructGetData($tLocalClientRect, “Right”)
          $aiReturnValue[2] = DllStructGetData($tPoint, “Y”)
          $aiReturnValue[3] = $aiReturnValue[2] + DllStructGetData($tLocalClientRect, “Bottom”)
          Return $aiReturnValue
      EndFunc
      
    • #1274626

      If it is an SSL certificate you could get a free one from StartSSL. Then it won’t be wonky.

      cheers, Paul

    • #1274732

      @pjustice57[/url]
      I was actually thinking of using AutoIt anyway but I don’t know how to make it start when it detects I’m connected to LC3 but not the internet. I haven’t read your example script yet but, I’ll definitely have to check it out (and the SciTE package as well).

      @[/B]Paul T
      I’m not honestly sure as I’ve just gotten used to clicking my way through. I’ll have to check it out. If that does work it’ll save me the work with AutoIt though as I said before I’ll still check the script out as I’m always willing to learn.

      P.S. Sorry for the weird bold script. I used a copy paste Operation for the names and it caused that weird bold thing to happen (Pressing the bold button/pressing ctrl+b does fix it). I’m also assuming you’ll see the bold as I’m seeing it…Weird

    • #1274733

      @Pault T
      I just went to the startSSL link and it looks like it’s for giving my own website a certificate. It doesn’t mention being able to auto-login (which is what I’m looking for).

    Viewing 3 reply threads
    Reply To: Auto Login to a Wireless Network (Browser)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: