Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2009
    Location
    Ohio, USA
    Posts
    227
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto Login to a Wireless Network (Browser)

    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.
    Current Machine:HP Compaq 6910p with 4GB RAM, Core2Duo @ 2.20 GHz, Mobile Intel 965 Express Chipset Family, Avast free, Malwarebyte's free, TP-Link wireless card (as the built in card has nothing but problems with empty solutions): The card identifies as "Atheros AR922X Wireless Network Adapter". [Not the best machine but it does internet, docs, and vids, and some games (PvZ, Spore)]

  2. #2
    2 Star Lounger
    Join Date
    Mar 2010
    Location
    Tampa, FL, USA
    Posts
    114
    Thanks
    11
    Thanked 10 Times in 9 Posts
    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 <WinAPI.au3>
    #include <WindowsConstants.au3>
    
    ; 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_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell 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
    PJ in FL

  3. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    If it is an SSL certificate you could get a free one from StartSSL. Then it won't be wonky.

    cheers, Paul

  4. #4
    3 Star Lounger
    Join Date
    Dec 2009
    Location
    Ohio, USA
    Posts
    227
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @pjustice57
    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).

    @
    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
    Current Machine:HP Compaq 6910p with 4GB RAM, Core2Duo @ 2.20 GHz, Mobile Intel 965 Express Chipset Family, Avast free, Malwarebyte's free, TP-Link wireless card (as the built in card has nothing but problems with empty solutions): The card identifies as "Atheros AR922X Wireless Network Adapter". [Not the best machine but it does internet, docs, and vids, and some games (PvZ, Spore)]

  5. #5
    3 Star Lounger
    Join Date
    Dec 2009
    Location
    Ohio, USA
    Posts
    227
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @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).
    Current Machine:HP Compaq 6910p with 4GB RAM, Core2Duo @ 2.20 GHz, Mobile Intel 965 Express Chipset Family, Avast free, Malwarebyte's free, TP-Link wireless card (as the built in card has nothing but problems with empty solutions): The card identifies as "Atheros AR922X Wireless Network Adapter". [Not the best machine but it does internet, docs, and vids, and some games (PvZ, Spore)]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •