; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other ; ; Script Function: ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) ; if not A_IsAdmin { Run *RunAs "%A_ScriptFullPath%" "%1%" "%2%" ; Requires v1.0.92.01+ ExitApp } ;^!p:: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. ;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;;SetWorkingDir %A_WorkingDir% SetWorkingDir %A_ScriptDir% global title, include_txt, myvar, lang, svn_ver, sub_ver, int_drv if 1 = { MsgBox, 16, tortoisesvn install err, name execute file Exit 0 } else{ exe_file=%1% } if 2 = { int_drv := "D" }else{ int_drv = %2% } ;exe_file=TortoiseSVN-1.9.3.27038-win32-svn-1.9.3.msi ;exe_file=TortoiseSVN-1.8.12.26645-win32-svn-1.8.14.msi ;exe_file=TortoiseSVN-1.6.10.19898-win32-svn-1.6.12.msi ;int_drv := "D" if (A_Is64bitOS){ so_type := "x64" so_bit := " (64 bit) " } else{ so_type := "win32" so_bit := " (32 bit) " } ;svn_ver := "1.8.12.26645" ;svn_ver := "1.10.0.28176" ;sub_ver := "1.10.0" ;svn_ver := "1.8.12.26645" for xp ;sub_ver := "1.8.14" for xp ;svn_ver := "1.6.10.19898" for 2k ;sub_ver := "1.6.12" for 2k ;EnvGet, WORK_DIR, RUN_PATH ;******************************************:// ;//******************************************:// ;//OFFICE_2003CN******************************************:// TORTOISESVN: ;;Goto,TORTOISESVN_X ;//******************************************:// RegRead, lang, HKEY_LOCAL_MACHINE, SYSTEM\CurrentControlSet\Control\Nls\Language, Default ;title= ;include_txt= ;RUN_TORTOISESVN() START_TORTOISESVN: ;run %comspec% /c "\\Nas-e5-dd-10\SYS\soft\win\SVN\TortoiseSVN-" svn_ver "-win32-svn-" sub_ver ".msi" ;run,%comspec% /c "%A_ScriptDir%\TortoiseSVN-%svn_ver%-%so_type%-svn-%sub_ver%.msi" run,%comspec% /c "%A_ScriptDir%\%exe_file%" myvar :=0 SetTitleMatchMode RegEx ;;SetTitleMatchMode 2 SetTimer, check_running, 1000 RE_TRY_TORTOISESVN: titlePattern := "TortoiseSVN\s*([\d.]+)\s*\(.+\)\s*Setup" ;;MsgBox,A_TitleMatchMode=%A_TitleMatchMode%-A_TitleMatchModeSpeed=%A_TitleMatchModeSpeed%: WinWait ,%titlePattern%,, 3000 if ErrorLevel { Goto,RE_TRY_TORTOISESVN } SetTimer, check_running, Delete WinGetTitle, OutputVar , %titlePattern%, FoundPos := RegExMatch(OutputVar, titlePattern, SubPat) svn_ver := SubPat1 SetTitleMatchMode 2 title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Welcome to the TortoiseSVN " svn_ver so_bit "Setup Wizard" Sleep,500 WinWait,%title%,%include_txt% ;;MouseMove,200,145 WinActivate,%title%,%include_txt% CoordMode,Mouse,Relative btn := "&Next >" ret := WinClikAndWaitTime(title, btn,include_txt,10) check_tortoisesvn( ret ) if ( ret = 1) { Goto,START_TORTOISESVN } title := "TortoiseSVN " svn_ver so_bit "License Agreement" include_txt := "End-User License Agreement" WinWait,%title%,I &accept the terms in the License Agreement,5 if ErrorLevel { ;; } else{ ControlCheck(title,"I &accept",include_txt) } btn := "&Next >" ret := WinClikAndWaitTime(title, btn,include_txt,10) check_tortoisesvn( ret ) if ( ret = 1) { Goto,START_TORTOISESVN } RE_TRY_TORTOISESVN_2: title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Click on the icons in the tree below to change the way features will be installed." WinWait ,%title%,%include_txt%, 20 if ErrorLevel { if(myvar<30){ myvar++ Goto,RE_TRY_TORTOISESVN } } ControlFocus, Br&owse,%title%,%include_txt% Sleep,200 SetControlDelay, -1 ;MsgBox,text-%Button%:%WinTitle%:%WinText% ControlClick,Br&owse,%title%,%include_txt%,,,NA title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Browse to the destination folder" WinWait ,%title%,%include_txt%, 2 if ErrorLevel { Goto,RE_TRY_TORTOISESVN_2 } ControlGetText, OutputVar, RichEdit20W1,%title%,%include_txt% NewStr := RegExReplace(OutputVar, "^\s*(\w)(:.+)", int_drv "$2") WinActivate,%title%,%include_txt% CoordMode,Mouse,Relative ;对于激活的窗口 SendEvent {Click 119,310, down} MouseMove, 264,310,30 SendEvent {Click 264,310, up} SendMessage, 0xC, 0, &NewStr, RichEdit20W1, %title%,%include_txt% Sleep,1000 Click, 1 Sleep,1000 WinWaitAndClikButton(title,"OK",include_txt) title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Click on the icons in the tree below to change the way features will be installed." btn := "&Next >" WinWaitAndClikButton(title, btn,include_txt) title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "The Setup Wizard is ready to begin the Custom installation" btn := "&Install" WinWaitAndClikButton(title, btn,include_txt) ;install sleep,5000 ;TORTOISESVN_X: title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Show Changelog" btn := "&Finish" WinWaitAndClikButton(title, btn,include_txt) title := "Installer Information" include_txt := "Click Yes to restart now or No if you plan to manually restart later." WinWait ,%title%,%include_txt%, 5 if ErrorLevel { }else{ btn := "No" WinWaitAndClikButton(title, btn,include_txt) } TORTOISESVN_END: exit 0 check_running: SetTitleMatchMode 2 if (lang = 0804) { title := "打开文件 - 安全警告" include_txt := "您想运行此文件吗?" bnt_l := "运行(&R)" }else if( lang = 0411 ) { title := "開いているファイル - セキュリティの警告" include_txt := "実行しますか?" bnt_l := "実行(&R)" }else if( lang = 0412 ) { title := "파일 열기 - 보안 경고" include_txt := "이 파일을 실행하시겠습니까?" bnt_l := "실행(&R)" } IfWinExist,%title%,%include_txt% { ;MsgBox,A_TitleMatchMode=%A_TitleMatchMode%-A_TitleMatchModeSpeed=%A_TitleMatchModeSpeed%-text-%bnt_l%:%title%:%include_txt% WinWaitAndClikButton(title,bnt_l,include_txt) return } bnt_l := "Button1" if (lang = 0804) { title := "打开文件 - 安全警告" ;include_txt=无法验证发行者。您确实要运行此软件吗? ;include_txt=无法验证发布者。您确定要运行此软件吗? ; windows7 inc_txt=[ "无法验证发行者。您确实要运行此软件吗?","无法验证发布者。您确定要运行此软件吗?" ] bnt_l := "运行(&R)" }else if( lang = 0411 ) { title := "開いているファイル - セキュリティの警告" include_txt := "実行しますか?" }else if( lang = 0412 ) { title := "파일 열기 - 보안 경고" include_txt=이 소프트웨어를 실행하시겠습니까? } ErrorCode := 1 if IsObject(inc_txt) { ;MsgBox 数组 for index, value in inc_txt { IfWinExist,%timer_title%,%value% { ErrorCode := 0 Break } } } else{ IfWinExist,%timer_title%,%value% { ErrorCode := 0 } } if ErrorCode { } else{ WinWaitAndClikButton(timer_title,bnt_l,inc_txt) } return check_tortoisesvn( retcode =0 ) { if (retcode = 1) { title_l := "TortoiseSVN " svn_ver so_bit "Setup" include_txt_l := "Please wait while the installer finishes determining your disk space requirements." bnt_l := "Button1" MsgBox,text-%bnt_l%:%title_l%:%include_txt_l% WinWaitAndClikButton(title_l,bnt_l,include_txt_l) ;title := "TortoiseSVN " svn_ver " (32 bit) License Agreement" ;include_txt := "End-User License Agreement" bnt_l := "Button3" MsgBox,text-%bnt_l%:%title%:%include_txt% WinWaitAndClikButton(title,bnt_l,include_txt) title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "Are you sure you want to cancel TortoiseSVN " svn_ver so_bit "installation?" WinWait ,%title%,%include_txt%, 10 if ErrorLevel { }else{ bnt_l := "Button2" MsgBox,text-%bnt_l%:%title%:%include_txt% WinWaitAndClikButton(title,bnt_l,include_txt) } bnt_l := "Button2" title := "TortoiseSVN " svn_ver so_bit "Setup" include_txt := "TortoiseSVN " svn_ver so_bit "Setup Wizard was interrupted" MsgBox,text-%bnt_l%:%title%:%include_txt% WinWaitAndClikButton(title,bnt_l,include_txt) sleep,3000 } } ;#include RemoteBuf.ahk ;#include RTV.ahk #include %A_ScriptDir%\BUTTON_LIB.ahk