Based AutoIt3 operation and maintenance tool

#Region; **** compiler directive compiler options window created by AutoIt3Wrapper **** 
# AutoIt3Wrapper_Icon = favicon.ico 
# AutoIt3Wrapper_Compile_Both = the y- 
#endregion; **** **** compiler directives created by the compiler options AutoIt3Wrapper window 
; # AutoIt3Wrapper_UseX64 = n- 
#include <Constants.au3>; for the Ping 
#include <GUIConstantsEx.au3>; for the GUI 
#include <IE.au3>; for a browser 
#include <Date.au3>; for Data 


; ***** ********* when revision number, corresponding to modify the version of the URL while ************** 
; modified version number EipFunc.au3 the 
#include <SsoFunc.au3 >; My custom function 

, Ltd. Free Join $ logfile = ' EipRepairLog- ' & @MON & ' - ' & @MDAY & ' .txt ' 
FileWriteLine ($ logfile, @CRLF & @YEAR & ' - ' & @MON & ' - ' @MDAY & & '  ' & @HOUR & " : " & @MIN & " : " & @SEC); --------- log 


; detection bits OS 
$ myOsArch = ' [ 'OsArch & () & ' position] ' 
; UI initialization  -   version automatically updates the 
$ headlabel = " Communications Test SSO- " & versionGet () 
FileWriteLine ($ logfile, $ headlabel); --------- log 
GUICreate ($ headlabel, 400 , 280 ) 
; GUISetBkColor ( 0xFFFFFF ) 
GUISetBkColor ( 0x8ef5b2 ) 

$ hostsbutton = GUICtrlCreateButton ( " open the hosts file " , 30 , 200 , 100 , 30 ) 
$ eipbutton = GUICtrlCreateButton ( " open SSO URL " ,160. , 200 , 100 , 30 ) 
; $ okButton = GUICtrlCreateButton ( " OK " , 290 , 200 , 70 , 30 ) 


; detecting whether the network 
$ isInNetStr = isInNetOrNot () 
output you the IP; 
$ iplabel = " hello, " @UserName & & " ! your IP is: " & @ IPAddress1 & "  " & $ isInNetStr & $ myOsArch 
FileWriteLine ($ logfile, $ iplabel); --------- log
GUICtrlCreateLabel ($ iplabel, 30 , 250 ) 
GUISetState (@SW_SHOW) 



; cloud desktop user determines whether to switch the IP corresponding to the URL eip 
; detecting whether the cloud desktop 
$ isYun = . 1 ; 0 --CloudDesk | . 1 - NotCloud 
$ isYunStr = isCloudOrNot () 
Free Join $ testIP 
the If $ isYun == . 1 the Then 
    $ testIP = ' as 192.168.2.172. ' 
Else 
    $ testIP = ' 172.30.17.248 ' 
EndIf 

; of ping the IP and return 
$ piplabel = "Can be connected to test whether " & $ testIPtestIP $ 
FileWriteLine (logfile $, $ piplabel); --------- log 
GUICtrlCreateLabel ($ piplabel, 30 , 20 is ) 
Sleep ( 100 ) 
$ mypiplabel = myping ($ testIP) 
FileWriteLine (logfile $, $ mypiplabel) ; --------- log 
GUICtrlCreateLabel ($ mypiplabel, 30 , 40 ) 
Sleep ( 100 ) 


; detecting whether 192. eip.hxgroup.com 168.2 . 172 
$ tiplabel = " start detecting whether eip.hxgroup.com " & ---------
FileWriteLine ($ logfile, $ tiplabel) ; log 
GUICtrlCreateLabel ($ tiplabel, 30 , 70 ) 
Sleep ( 100 ) 
$ netEqualIp = tcpEqualIp ( " eip.hxgroup.com " , $ testIP); return 1 indicates normal 
Free Join $ myHostFile = @SystemDir & " \ Drivers \ etc \ the hosts " 
the If $ netEqualIp == . 1 the Then 
    $ tcplabel = " the IP address of eip.hxgroup.com [is] " & $ testIP 
    FileWriteLine (logfile $, $ tcplabel); ------ --- log 
    GUICtrlCreateLabel ($ tcplabel, 30 , 90) 
Else 
    $ tcplabel = " [not] " & $ & testIP " , but " & $ netEqualIp 
    FileWriteLine (logfile $, $ tcplabel); --------- log 
    GUICtrlCreateLabel ($ tcplabel, 30 , 90 ) 
    ; write hosts file 
    GUICtrlCreateLabel ( " start writing hosts file " , 30 , 120 ) 
    FileWriteLine ($ logfile, " start writing hosts file - " & $ myHostFile); --------- log 
    ; for 64 PC is System32 folder path, for a 32-bit path SystemWoW64
    ; GUICtrlCreateLabel ($ myHostFile, 30 , 250 ); Test for URL 
    ; hosts file exists determines whether 
    the If the FileExists ($ myHostFile) the Then 
        FileWriteLine ($ logfile, " hosts file already exists " ); --------- log 
        GUICtrlCreateLabel ( " hosts file already exists " , 30 , 140 ) 
        $ inhosts = strInHosts (myHostFile $, $ testIP, ' eip.hxgroup.com ' ) 
        ; sso.hxgroup.com overseas to be added to the hosts file 
        $ inhosts1 = strInHosts ( myHostFile $, '172.16.10.13' , ' Sso.hxgroup.com ' ) 
        FileWriteLine ($ logfile, inhosts $ & '   EIP ' ); --------- log 
        FileWriteLine ($ logfile, inhosts1 $ & '   SSO ' ); ---- ----- log 
        GUICtrlCreateLabel ($ inhosts, 30 , 160. ) 
    Else 
        FileWriteLine ($ logfile, " hosts file does not exist, the hosts file and writes the new start " ); --------- log 
        GUICtrlCreateLabel ( " hosts file does not exist, start a new file and writes hosts " , 30, 140 ) 
        writeHosts ($ myHostFile) 
        FileWriteLine ($ logfile, " write completed hosts file " ); --------- log 
        GUICtrlCreateLabel ( " write completed hosts file " , 30 , 160. ) 
    EndIf 
EndIf 
Sleep ( 100 ) 




; writeHosts ( ' hosts ' ); test write hosts file 



the While . 1 
  $ MSG = GUIGetMsg () 

  the Select 
    Case $ MSG = $ eipbutton 
        $ oIE = _IECreate ( " http://sso.hxgroup.com" , 0 , 1 , 0 ); open page 
        FileWriteLine ($ logfile, " open EIP- " & $ oIE); --------- log 
        ; ExitLoop 
    Case $ MSG = $ hostsbutton 
        $ openhosts = the Run (@ & WindowsDir " \ Notepad.exe " & '  ' & @SystemDir & " \ the Drivers \ etc \ hosts " ) 
        FileWriteLine ($ logfile, " open the hosts file - " & $ openhosts);--------- log 
    Case $ msg =GUI_EVENT_CLOSE $
        ; Close the dialog event 
        FileWriteLine ($ logfile, " Close to exit " & @CRLF); --------- log 
        FileClose ($ logfile) 
        ExitLoop 
  EndSelect 
WEnd

 

Guess you like

Origin www.cnblogs.com/mjy2wxy/p/11468550.html