tram 发表于 2010-3-25 09:28:18

MSN Windows Live Messenger 9.0 中文版安装脚本

要发就发最难的。
此安装脚本很难,需要断一下网(当然是自动的),否则程序会弹出一个杀不掉的窗口。
#region --- AutoIt Macro Generator V 0.21 beta ---
Opt("WinTitleMatchMode", 4)
$FALSE = 0
$TRUE = NOT $FALSE

Func SOff()
    RunWait("ipconfig /release", "c:/", @SW_HIDE)
    ProcessWaitClose("ipconfig.exe")
    Return $FALSE
EndFunc;==>SOff

Func SOn()
    RunWait("ipconfig /renew", "c:/", @SW_HIDE)
    ProcessWaitClose("ipconfig.exe")
    Return $TRUE
EndFunc;==>SOn


Run(_Pathtrace() & "\Install\Install_WLMessenger_360.exe")
$A='Windows Live Messenger 2009 独立安装包官方加强版'
$B='安装 Windows Live Messenger 保护盾'
WinWaitActive($A,$B)
ControlClick($A,$B,"Button1")
ControlClick($A,$B,"Button4")
$A='Windows Live'
$B='查看隐私声明'
WinWaitActive($A,$B)
ControlClick($A,$B,"Button3")
$B='选择要安装的程序'
WinWaitActive($A,$B)
ControlClick($A,$B,"Button3")
$B='马上完成!'
WinWaitActive($A,$B)
ControlClick($A,$B,"Button1")
ControlClick($A,$B,"Button2")
ControlClick($A,$B,"Button8")



WinWaitActive($A,'关闭')
ControlClick($A,"关闭","Button4")


Soff()
SLEEP(6000)

FileRecycle (@DesktopDir & "\Windows Live 服务.lnk")

If ProcessExists("msnmsgr.exe")Then
        Run("taskkill /F /IM " & "msnmsgr.exe", "",@SW_HIDE)
EndIf
$i=0

While ProcessExists("Install_WLMessenger_360.exe")
        Run("taskkill /F /IM " & "Install_WLMessenger_360.exe", "",@SW_HIDE)
        Sleep(1000)
        $i=$i+1
        If $i >10 Then
                MsgBox(0x1020,"郁闷","MSN安装程序10次还没杀死?我闪,有事你找微软去!")
          ExitLoop       
        EndIf
WEnd

Son()



#CS
Killie()
   
   Func killie();关掉ie 和 msn
   
           For $i = 1 To 5
      $killie=ProcessExists("IEXPLORE.EXE")
      $killmsn=ProcessExists('msnmsgr.exe')
                   $killmaxthon=ProcessExists('Maxthon.exe')
                   $killMSNINSTALL=ProcessExists('Install_WLMessenger_360.exe')
      If ProcessExists("IEXPLORE.EXE") Then
      ProcessClose("IEXPLORE.EXE")
      EndIf
      If ProcessExists("msnmsgr.exe") Then
      ProcessClose("msnmsgr.exe")
   #         RunWait("taskkill /F /IM " & "msnmsgr.exe", "", @SW_HIDE)
   #RunWait(@comspec & " /c Net stop diskeeper","",@SW_HIDE)
                   EndIf
                   If ProcessExists("Maxthon.exe") Then
      ProcessClose("Maxthon.exe")
                   EndIf
                   If ProcessExists('Install_WLMessenger_360.exe')Then
                           ProcessClose('Install_WLMessenger_360.exe')
                   EndIf
                   If $killie+$killmsn+$killmaxthon +$killMSNINSTALL = 0 Then
                           ExitLoop
                   EndIf
           Next
   
   EndFunc   




WinWaitActive('Windows Live Messenger')
Send("!F")
Send("C")
#CE


#cs ================================================================
    Heres my contribution to the topic, Fugly but functional ;)
    ================================================================

ConsoleWrite(@SCRIPTFULLPATH & @LF)
ConsoleWrite("Parent Directory relative to script."& @LF & @TAB)
ConsoleWrite(_PathTrace() & @LF)
ConsoleWrite("As above but with trailing slash '\'."& @LF & @TAB)
ConsoleWrite(_PathTrace(1,0) & @LF)
ConsoleWrite("Parent of Parent directory."& @LF & @TAB)
ConsoleWrite(_PathTrace(2) & @LF)
ConsoleWrite(@AUTOITEXE & @LF)
ConsoleWrite("The directory of your exe/Interpreter."& @LF & @TAB)
ConsoleWrite(_PathTrace(0,1,@AUTOITEXE) & @LF)
ConsoleWrite("Parent directory relative to your exe/Interpreter."& @LF & @TAB)
ConsoleWrite(_PathTrace(1,1,@AUTOITEXE) & @LF)
ConsoleWrite("alternate directory delim '/' example."& @LF & @TAB)
ConsoleWrite(_PathTrace(2,1,"x:/bin/env/dev/AK47.exe",47) & @LF)
; Example, execute a program setting its working dir to the scripts parent directory
RunWait("CMD.exe /c TITLE Notice working dir? && CD && PAUSE",_PathTrace())
================================================================
Trace backward in a path string and return the relative path.
    Depth ~ 1 = "..\" , 2 = "..\..\" etc
Trail ~ Strip trailing delimeter? 1 = strip | 0 = keep
RTarget ~ Full file path to extract a relative directory from.
Delim ~ Ascii value to use as directory delimeter default is "\"
    ================================================================
Run(_PathTrace() & "\      Install\QQ2010Beta.exe")

#ce;

Func _PathTrace($Depth = 1, $Trail = 1, $RTarget = @ScriptFullPath, $Delim = 92)
        Return StringLeft($RTarget, StringInStr($RTarget, Chr($Delim), 0, -$Depth - 1) - $Trail)
EndFunc   ;==>_PathTrace

页: [1]
查看完整版本: MSN Windows Live Messenger 9.0 中文版安装脚本