Jump to content

quoc77

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by quoc77

  1. I found another approach that will automate the creating of a wireless network profile in Windows 7. Posting it here for others that's looking to do the same as future reference. If WinActive ("Network and Sharing Center") Then WinClose ("Network and Sharing Center") EndIf ;Open Network and Sharing Center Run ("control /name Microsoft.NetworkAndSharingCenter") Sleep ( 2000 ) ;ControlClick ("Network and Sharing Center","Manage wireless networks", "[ID:left]") ;WinWait ("Network and Sharing Center") WinWaitActive ("Network and Sharing Center") AutoItSetOption("SendKeyDelay", 40) ;Tab selection over the Manage wireless network link and proceed to the next screen Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{ENTER}") Sleep ( 2000 ) ;Tab selection over the Add link and proceed to the next screen WinWaitActive ("Manage Wireless Networks") AutoItSetOption("SendKeyDelay", 40) Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{ENTER}") Sleep ( 2000 ) ;Press Enter to go to the Manually connect to a wireless network screen and enter network settings WinWaitActive ("Manually connect to a wireless network") AutoItSetOption("SendKeyDelay", 40) Send("{ENTER}") Sleep ( 2000 ) WinWaitActive ("Manually connect to a wireless network") AutoItSetOption("SendKeyDelay", 40) Send("<SSID>") Send("{TAB}") ;Below will select WPA2-Personal Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{TAB}") ;Below will select AES Send("{DOWN}") Send("{TAB}") Sleep ( 2000 ) Send("<Security Key>") Send("!N") Send("{TAB}") Send("{ENTER}") Sleep ( 2000 ) WinClose("Manage Wireless Networks") ;Connect to new SSID RunWait (@ComSpec & " /c " & "netsh wlan connect name=<SSID>")
  2. Thanks for the suggestion. The @Comspec & netsh did lessen my overall script but it's still popping up the task bar balloon to enter the security key, which I cannot activate or send the key to. RunWait (@ComSpec & " /c " & "netsh wlan add profile filename=C:\Source\Elevate-AB0F.xml") RunWait (@ComSpec & " /c " & "netsh wlan connect name=Elevate-AB0F") Here's another script that I'm trying to write to perform the same function of creating a network wireless profile, but I can't seem to have autoit click on the link name "Manage wireless networks" Run ("control /name Microsoft.NetworkAndSharingCenter") ;ControlClick ("Network and Sharing Center","Manage wireless networks", "[ID:left]") WinWaitActive ("Network and Sharing Center") ControlClick ("Network and Sharing Center","", "[Class:DirectUIHWND; Instance:4; Text:'Manage wireless networks'; Button:Left]")
  3. Run ("cmd.exe") WinWaitActive ("Administrator: C:\Windows\system32\cmd.exe") Send ("netsh wlan add profile filename=C:\Source\Elevate-AB0F.xml{Enter}") Send ("netsh wlan connect name=Elevate-AB0F{Enter}") If WinWaitActive ("Connect to a Network", "$Security key:") Then Send ("86614480") Send ("!OK") EndIf WinClose ("Administrator: C:\Windows\system32\cmd.exe") I'm embarrassed to even post my code but this is what I currently have. It opens the command prompt, send the netsh commands (calling a xml profile with the SSID and Security key). This works okay on the laptop that I created the xml file but if I run the autoit script on a different laptop, it doesn't connect cause it ask for a security key. So the if statement, in theory is suppose to send the key and everything works fine. Wrong. I'm sure there's a simplier way to do this with autoit without having to use the xml file. I created another script that opens up the Network and Sharing Center dialog box but I can't seem to know the exact code to click on the "Manage wireless network" link that to continue.
  4. Hello All. First off I'm very novice at writing scripts or program. I have been trying to create an automated script that would automatically create a Windows 7 wireless network profile and then have it connected. I created a simple batch file using netsh that would do this but then I found out, the script doesn't work on a different computer as it would ask for the security key. In searching Google, I came across '?do=embed' frameborder='0' data-embedContent>> , but with my little experience, I can't make heads or tails on many of the syntax. I have tried editing the existing code but none of my attempts has worked and I might be more confused than before. Could anyone give me a headstart of what I need to begin my script with? Any help would be much appreciated.
×
×
  • Create New...