Você está na página 1de 5

Opt("GUIOnEventMode", 1)

AutoItSetOption("TrayIconDebug", 1)
; ----------------------------------------------------------------------------
; checking for windows xp sp2
; ----------------------------------------------------------------------------
#include <GUIConstants.au3>
if @OSVersion = "WIN_XP" then $WINVER = "Windows XP"
if @OSVersion = "WIN_2003" then $WINVER = "Windows 2003"
if @OSVersion = "WIN_2000" then $WINVER = "Windows 2000"
if @OSVersion = "WIN_NT4" then $WINVER = "Windows NT 4"
if @OSVersion = "WIN_ME" then $WINVER = "Windows ME"
if @OSVersion = "WIN_98" then $WINVER = "Windows 98"
if @OSVersion = "WIN_95" then $WINVER = "Windows 95"
if @OSVersion <> "WIN_XP" Then
msgbox(0 , "Operating System and Service Pack Check", "This script only work
s on Windows XP Systems and your Operating System is " & $WINVER & " - Please co
ntact the Helpdesk" )
Exit
EndIf
if @OSServicePack <> "Service Pack 2" Then
MsgBox(16,"Operating System and Service Pack Check","The Wireless Profile se
tup will only run on Windows XP computers with Service Pack 2.")
Exit
EndIf
;~ -----------------------------------------------------------------------------
---------
;~ checking for a program called ipass, which disables the wireless profile tab
;~ -----------------------------------------------------------------------------
---------
while ProcessExists ( "IPassConnectGUI.exe" )
ProcessClose ( "IPassConnectGUI.exe" )
sleep (500)
WEnd

; ----------------------------------------------------------------------------
; Setting the Options for all Offices
; ----------------------------------------------------------------------------
Global $SSID = 'YOURSSIDHERE'
Global $WEP = 'YOURWEPKEYHERE'

$installed = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\Applications", "Wireless Profi


le" )
if $installed = "Installed" Then
regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\Applications", "Wireless Profile" ,"RE
G_SZ", "Installed" )
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Applications", "Wireless Profile" )
EndIf
$installed1 = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\Applications", "Wireless Prof
ile" )
if $installed1 = "Installed" Then
#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Warning
Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(49,"Profile Exists", "The Wireless Profile alrea
dy exists - if you are having problems with your connection press the OK button
to delete and recreate the profile otherwise press the CANCEL button to select a
different office.")
Select
Case $iMsgBoxAnswer = 1;OK
call ("Delete")
call ("Setup")
Case $iMsgBoxAnswer = 2;CANCEL
EndSelect
#Region --- CodeWizard generated code Start ---
Else
call ("Setup")
regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\Applications", "Wireless Profile"
,"REG_SZ", "Installed" )
EndIf
; ----------------------------------------------------------------------------
; Setup Script
; ----------------------------------------------------------------------------
func Setup()
SplashTextOn("Profile Setup","Setting up the wireless profile. Full mouse and k
eyboard use will return when this has finished running.","500","50","-1","50",0,
"Tahoma","9","400")

sleep (50)
BlockInput ( 1 )
sleep (50)
Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE)
sleep (50)
WinWait ( 'Network Connections' )
if NOT WinActive ( 'Network Connections', '' ) then
WinActivate ( 'Network Connections' )
endif
WinWaitActive ( 'Network Connections' )
sleep ( 50 )
Send ( 'wireless' )
sleep ( 50 )
send ('{Appskey}')
sleep ( 50 )
send ( 'r' )
sleep (50)
WinWait ( 'Wireless Network Connection Properties', 'Connect using:' )
if NOT WinActive ( 'Wireless Network Connection Properties', 'Connect using:' )
then
WinActivate ( 'Wireless Network Connection Properties', 'Connect using:' )
endif
WinWaitActive ( 'Wireless Network Connection Properties', 'Connect using:' )
sleep ( 50 )
Send ( '+{Tab}' )
sleep ( 50 )
send ( '+{Tab}' )
sleep ( 50 )
send ('{Right}' )
sleep (50)
WinWait ( 'Wireless Network Connection Properties', 'Wireless Networks' )
if NOT WinActive ( 'Wireless Network Connection Properties', 'Wireless Networks'
) then
WinActivate ( 'Wireless Network Connection Properties', 'Wireless Networks'
)
endif
WinWaitActive ( 'Wireless Network Connection Properties', 'Wireless Networks' )
sleep ( 50 )
Send ( '!a' )
sleep (50)
WinWait ( 'Wireless network properties', 'Association' )
if NOT WinActive ( 'Wireless network properties', 'Association' ) then
WinActivate ( 'Wireless network properties', 'Association' )
endif
WinWaitActive ( 'Wireless network properties', 'Association' )
sleep ( 1 )
Send ( $SSID )
sleep ( 5 )
send ('{Tab}')
sleep ( 1 )
send ('{S}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{W}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ("{SPACE}")
sleep ( 1 )
send ('+{Tab}')
sleep ( 1 )
send ('+{Tab}')
sleep ( 1 )
send ( $WEP )
sleep ( 5 )
send ('+{Tab}')
sleep ( 5 )
send ( $WEP )
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{ENTER}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{Tab}')
sleep ( 1 )
send ('{ENTER}')
sleep ( 1 )

;WinClose ( 'Wireless Network Connection Properties' )


;sleep (1000)
WinClose ( 'Network Connections' )
sleep (100)
Splashoff ( )
sleep (100)
BlockInput ( 0 )
sleep (100)
endfunc
; ----------------------------------------------------------------------------
; Delete Script
; ----------------------------------------------------------------------------
func Delete()
SplashTextOn("Wireless Profile Exists","Deleting the wireless profile.","450","3
0","-1","50",0,"Tahoma","9","400")
sleep (1000)
BlockInput ( 1 )
sleep (1000)
Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE)
sleep (1000)
WinWait ( 'Network Connections' )
if NOT WinActive ( 'Network Connections', '' ) then
WinActivate ( 'Network Connections' )
endif
WinWaitActive ( 'Network Connections' )
sleep ( 1500 )
Send ( 'wireless' )
sleep ( 1500 )
send ('{Appskey}')
sleep ( 1500 )
send ( 'r' )
sleep (1000)
WinWait ( 'Wireless Network Connection Properties', 'Connect using:' )
if NOT WinActive ( 'Wireless Network Connection Properties', 'Connect using:' )
then
WinActivate ( 'Wireless Network Connection Properties', 'Connect using:' )
endif
WinWaitActive ( 'Wireless Network Connection Properties', 'Connect using:' )
sleep ( 1500 )
Send ( '+{Tab}' )
sleep ( 1500 )
send ( '+{Tab}' )
sleep ( 1500 )
send ('{Right}' )
sleep (1000)
WinWait ( 'Wireless Network Connection Properties', 'Wireless Networks' )
if NOT WinActive ( 'Wireless Network Connection Properties', 'Wireless Networks'
) then
WinActivate ( 'Wireless Network Connection Properties', 'Wireless Networks'
)
endif
WinWaitActive ( 'Wireless Network Connection Properties', 'Wireless Networks' )
sleep ( 1500 )
Send ( '!p' )
sleep ( 1500 )
Send ( $SSID )
sleep ( 1500 )
Send ( '!r' )
sleep ( 1500 )
Send ( '+{Tab 5}' )
sleep ( 1500 )
Send ( '{Enter}' )
WinWaitClose ( 'Wireless Network Connection Properties' )
sleep ( 1000 )
WinClose ( 'Network Connections' )
sleep ( 1000 )
Splashoff ( )
sleep ( 1000 )
EndFunc

Você também pode gostar