Advertisement
SerW

AutoIt Script 7-Zip installation

Feb 15th, 2022
2,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.80 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  
  3. AutoIt Version: 3.3.8.1
  4. Author: http://SerW.name
  5.  
  6. Script Function:
  7. 7z920-x64 installation, configuration and localization AutoIt script.
  8.  
  9. #ce ----------------------------------------------------------------------------
  10.  
  11. ; Если скрипт не работает на более поздних версиях программ, чем те, для которой
  12. ; был написан изначально, обратите внимание на строки 30 и 31
  13. ; Предотвращение возможности множественного запуска скрипта
  14. If WinExists(@ScriptName) Then Exit
  15. AutoItWinSetTitle(@ScriptName)
  16.  
  17. ; Отображать текущую строку сценария с помощью индикатора системной панели в режиме отладки.
  18. AutoItSetOption("TrayIconDebug", 1)
  19. AutoItSetOption("SendKeyDelay", 10)
  20.  
  21. #include <File.au3>
  22. $sPath = @ScriptDir ; путь к каталогу, где лежит *.msi файл
  23. $aMsiFiles = _FileListToArray($sPath, "7z*.msi", 1)
  24. If $aMsiFiles <> 0 Then ; если найден хотя бы один файл, то выполняем условие
  25. ShellExecute ($sPath & "\" & $aMsiFiles[1]) ; запускаем первый файл
  26. EndIf
  27.  
  28. Global $Title='7-Zip'
  29. Global $Title1='Options'
  30.  
  31. ; Welcome to the 7-Zip 9.20 Setup Wizard
  32. WinWaitActive($Title)
  33. Send("!n")
  34.  
  35. ; End-User License Agreement
  36. WinWaitActive($Title, "License Agreement")
  37. Send("{SPACE}")
  38. Send("!n")
  39.  
  40. ; Custom Setup
  41. WinWaitActive($Title, "Tree of selections")
  42. Send("{DOWN 2}")
  43. Send("{SPACE}")
  44. Send("{DOWN 3}")
  45. Send("{ENTER}")
  46. Send("!n")
  47.  
  48. ; Ready to Install
  49. WinWaitActive($Title, "Install")
  50. Send("!i")
  51.  
  52. ; Choose Components
  53. WinWaitActive($Title)
  54. Send("!i")
  55.  
  56. ; Completing the 7-Zip 9.20 Setup Wizard
  57. WinWaitActive($Title, "Finish")
  58. Send("!f")
  59.  
  60. ; Configuration
  61. Run(@ProgramFilesDir & '\7-Zip\7zFM.exe')
  62.  
  63. ; Options
  64. WinWaitActive("7-Zip File Manager")
  65. Send("{F9}")
  66. Send("!t")
  67. Send("{o}")
  68.  
  69. ; System
  70. WinWaitActive($Title1, "System")
  71. ControlClick($Title1, "System", "Button1")
  72. ControlClick($Title1, "System", "SysListView321")
  73. Send("{DOWN 13}")
  74. Send("{SPACE}")
  75.  
  76. ; 7-Zip
  77. Send("^{TAB}")
  78. Send("{TAB 2}")
  79. dim $var1
  80. For $var1=0 to 2
  81. Send("{DOWN}")
  82. Send("{SPACE}")
  83. Next
  84. Send("{DOWN 3}")
  85. Send("{SPACE}")
  86. Send("{DOWN}")
  87. dim $var2
  88. For $var2=0 to 4
  89. Send("{DOWN}")
  90. Send("{SPACE}")
  91. Next
  92.  
  93. ; Settings
  94. Send("^{TAB 3}")
  95. Send("!s") ; &Single-click to open an item
  96.  
  97. ; Копируем русскую локализацию
  98. FileCopy('Lang\*.*', @ProgramFilesDir & '\7-Zip\Lang\', 9)
  99.  
  100. ; Language
  101. WinWaitActive($Title1, "Settings")
  102. Send("^{TAB}")
  103. Send("{DOWN}") ; Выбор русского языка
  104. Send("{ENTER}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement