Что нового

Не работают пункты меню при выполнении скрипта

Tuxzer92

Новичок
Сообщения
65
Репутация
0
Есть скрипт для автоматической установки ПО. Не давно добавил к нему GUI. Если просто запустить скрипт, то пункты меню работают. Все открывается, а вот если нажать на кнопку "запустить", то запускается процесс установки ПО, но пункты меню уже не работают. А когда он заканчивает работу, то все срабатывает). Как сделать так, чтобы они всегда работали?
Файлы: http://rghost.ru/58309404
Код:
#RequireAdmin
#AutoIt3Wrapper_Res_Comment=Скрипт для автоматической установки минимального набора ПО

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <EditConstants.au3>

#NoTrayIcon

Const $title= "ASI Script v0.2a"
$Window = GUICreate($title, 300, 300)

GUISetBkColor(0xE0FFFF)
GUICtrlCreatePic("1.jpg", 0, 0, 300, 250)

$OKButton = GUICtrlCreateButton("Запустить", 40, 250, 70)
$EXITButton = GUICtrlCreateButton("Закрыть", 190, 250, 70)
$BackButton = GUICtrlCreateButton("Назад", 115, 250, 70)
Local $FileMenu, $FileItem, $FileItem2
$ServerDir = "\\debian-server\FILES\SOFT\MINIMUM_INSTALL\Distr"
$x86 = "\\debian-server\FILES\SOFT\Office2010x32\Office2010x32"
$x64 = "\\debian-server\FILES\SOFT\Office2010x64\Office2010x64"
$OutDir = "D:\"
$InstDir = "D:\Distr\"
$Ping = ping("debian-server",1)
$files = "Files"

$font = "Comic Sans MS"
$FileMenu = GUICtrlCreateMenu("&Файл")
$FileItem = GUICtrlCreateMenuItem("Инструкция", $FileMenu)
$FileItem2 = GUICtrlCreateMenuItem("Выход", $FileMenu)
$FileMenu3 = GUICtrlCreateMenu("&Игры")
$FileItem4= GUICtrlCreateMenuItem("Марио",$FileMenu3)
$FileItem5= GUICtrlCreateMenuItem("Змейка",$FileMenu3)
$FileMenu2 = GUICtrlCreateMenu("&?")
$FileItem6 = GUICtrlCreateMenuItem("Changelog",$FileMenu2)
$FileItem3 = GUICtrlCreateMenuItem("О скрипте",$FileMenu2)

GUISetState(@SW_SHOW, $Window)

SoundSetWaveVolume(50)
SoundPlay(@WindowsDir & "\media\tada.wav", 1)
Local $iMsg

While 1  ;Используем бесконечный цикл While до тех пор пока не сработает ExitLoop
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $OKButton

If $Ping Then
			If FileExists($ServerDir) Then

					If FileExists($OutDir) Then

												If @OSArch ='x86' Then
															_FileCopy($ServerDir, $OutDir)
															_FileCopy($x86, $InstDir)
															RunWait(@ComSpec & " /c REGEDIT /s " & $InstDir & "DisableRestart.reg", "")
															RunWait(@ComSpec & " /c " & "gpupdate /force", "")
															RunWait($InstDir & "7z920.exe /S")
															RunWait('C:\Program Files\7-Zip\7z.exe x "D:\Distr\Office2010x32\Microsoft Office 2010 Professional Plus VL x86.iso"  -oD:\Distr\Office2010x32\Office2010')
															_FileCopy($InstDir & "Office2010x32\Updates\",$InstDir & "Office2010x32\Office2010\")
															_FileCopy($InstDir & "Office2010x32\32.MSP",$InstDir & "Office2010x32\Office2010\")
															RunWait($InstDir & "Office2010x32\Office2010\setup.exe /adminfile D:\Distr\Office2010x32\Office2010\32.MSP")
															RunWait('C:\Program Files\7-Zip\7z.exe x "D:\Distr\FineReader.rar"  -oD:\')
												Else
															_FileCopy($ServerDir, $OutDir)
															_FileCopy($x64, $InstDir)
															RunWait(@ComSpec & " /c REGEDIT /s" & $InstDir & "DisableRestart.reg", "")
															RunWait(@ComSpec & " /c " & "gpupdate /force", "")
															RunWait($InstDir & "7z920.exe /S")
															RunWait('C:\Program Files (x86)\7-Zip\7z.exe x "D:\Distr\Office2010x64\Microsoft Office 2010 Professional Plus VL x64.iso"  -oD:\Distr\Office2010x64\Office2010')
															_FileCopy($InstDir & "Office2010x64\Updates\",$InstDir & "Office2010x64\Office2010\")
															_FileCopy($InstDir & "Office2010x64\64.MSP",$InstDir & "Office2010x64\Office2010\")
															RunWait($InstDir & "Office2010x64\Office2010\setup.exe /adminfile D:\Distr\Office2010x64\Office2010\64.MSP")
															RunWait('C:\Program Files (x86)\7-Zip\7z.exe x "D:\Distr\FineReader.rar"  -oD:\')
												EndIf

									Runwait("msiexec /i D:\Distr\install_flash_player_14_active_x.msi /passive")
									Runwait("msiexec /i D:\Distr\install_flash_player_14_plugin.msi /passive")
									Runwait("msiexec /i D:\Distr\AdbeRdr11000_ru_RU.msi /passive")
									Runwait($InstDir & "ccsetup416_slim.exe /S")
									RunWait($InstDir & "aimp_3.55.1355.exe /AUTO")
									Runwait($InstDir & "K-Lite\K-Lite_Codec_Pack_1065_Mega.exe /verysilent /norestart /LoadInf=.\klcp_mega_unattended.ini")
									Runwait("msiexec /i D:\Distr\Far30b3800.x86.20140208.msi /passive")
									Runwait($InstDir & "tcmd750a\INSTALL.EXE")
									_FileCopy($InstDir & "tcmd750a\wincmd.key","C:\totalcmd\")
									Runwait($InstDir & "FSViewerSetup51.exe /S")
									Runwait($InstDir & "mini-KMS Activator 1.3 Office 2010 VL.exe /os")
									RunWait($InstDir & "KMSAutoXP.exe /oa")
									RunWait($InstDir & "WinRAR 4.20.exe -a4RAi")
									WinWaitClose("Установка WinRAR 4.20")

									FileDelete($InstDir & "mini-KMS Activator 1.3 Office 2010 VL.exe")
									FileDelete($InstDir & "KMSAutoXP.exe")
					Else
							GUISetFont(14, 700, 0, $font)
							GUICtrlCreateLabel( "Диска " & $OutDir &" нет", 10, 10)
							GUICtrlSetColor(-1, 0xff0000)
							Sleep(2000)
							GUIDelete()
							Exit
					EndIf

			Else
					GUISetFont(14, 700, 0, $font)
					GUICtrlCreateLabel("Каталог с ПО не существует!", 10, 10)
					GUICtrlSetColor(-1, 0xff0000)
					Sleep(2000)
					GUIDelete()
					Exit
			EndIf

Else
			GUISetFont(14, 700, 0, $font)
			GUICtrlCreateLabel("Debian-server не доступен!", 10, 10)
			GUICtrlSetColor(-1, 0xff0000)
			Sleep(2000)
			Exit
			GUIDelete()
		EndIf

		Case $FileItem
			$sTextFile = $files & "\ReadMe.txt"
			Run ( "notepad.exe " & $sTextFile)

		Case $GUI_EVENT_CLOSE
            ExitLoop

		Case $FileItem2
			ExitLoop

		Case $FileItem3
			GUICtrlCreateEdit($title & @CRLF & "Данный скрипт разработан с целью автоматической установки необходимого ПО."& @CRLF & "Дата начала разработки: 21.08.14" &@CRLF & "Разработал: Русинов Р.С." , 10, 10, 280, 230, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_NOHIDESEL + $ES_WANTRETURN + $ES_READONLY)
		Case $EXITButton
            ExitLoop

		Case $BackButton
				GUICtrlCreatePic("1.jpg", 0, 0, 300, 250)

		Case $FileItem4
			Run($files & "\MARIO\Mario.exe")

		Case $FileItem5
			Run($files & "\snakeV1.0.exe")

		Case $FileItem6
			$change = $files & "\changelog.txt"
			Run ( "notepad.exe " & $change)

	EndSwitch

WEnd

Exit

GUICtrlCreateLabel("Готово!", 30, 10)
Sleep(2000)
Exit
Func _FileCopy($fromFile,$tofile)
    Local $FOF_RESPOND_YES = 16
    Local $FOF_SIMPLEPROGRESS = 256
    $winShell = ObjCreate("shell.application")
    $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES)
EndFunc
 

joiner

Модератор
Локальный модератор
Сообщения
3,570
Репутация
632
смотреть в русской справке
Код:
WM_COMMAND
 
Автор
T

Tuxzer92

Новичок
Сообщения
65
Репутация
0
Короче решил запускать скрипт отдельно.
Run ("ASI(No GUI).exe").
 
Верх