Войти

Показать полную графическую версию : [решено] Как вывести сообщение во время выолнения команды?


Centrinar
10-02-2010, 13:54
RunWait('"tets.exe" -a') MsgBox(16, "Проверка", "Идет проверка, ждите", WinGetHandle("Проверка"))
Надо что бы окно Проверка высвечивалась во время выполнения tets.exe поверх окна. Спасибо!

madmasles
10-02-2010, 14:01
Вот:$iRet = _MsgBoxEx(36, "My Title", "Message", 10, 0, "_SetData")

MsgBox(64, "", "Returned Value is: " & $iRet)

Func _SetData($iCount)
ConsoleWrite("The script is not paused " & $iCount & " second(s)" & @LF)
EndFunc

Func _MsgBoxEx($iType, $sTitle, $sText, $iTimeOut=0, $hWnd=0, $sCallBackFunc="")
Local $sAu3Line = '"ConsoleWrite(MsgBox(' & $iType & ', ''' & $sTitle & ''', ''' & $sText & ''', ' & _
$iTimeOut & ', ' & $hWnd & '))"'
Local $iAu3PID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sAu3Line, '', @SW_SHOW, 6)

Local $iStdOutRead
Local $iTimerInit = TimerInit(), $iTimerDiff = Round(TimerDiff($iTimerInit)/1000, 0), $iLastTimer = $iTimerDiff
Local $iOld_WWD_Opt = Opt("WinWaitDelay", 0)

WinWait($sTitle, $sText)

Opt("WinWaitDelay", $iOld_WWD_Opt)

While 1
$iStdOutRead &= StdoutRead($iAu3PID)
If @error <> 0 Then ExitLoop

If $sCallBackFunc <> "" Then
$iTimerDiff = Round(TimerDiff($iTimerInit)/1000, 0)

If $iLastTimer <> $iTimerDiff Then
$iLastTimer = $iTimerDiff
Call($sCallBackFunc, $iTimerDiff)
EndIf
EndIf

Sleep(1)
WEnd

Return $iStdOutRead
EndFunc
Нашел у себя пример , кажется, от Creat0R.

Creat0R
10-02-2010, 16:45
Надо что бы окно Проверка высвечивалась во время выполнения tets.exe поверх окна. »

$iPID = Run (http://www.autoitscript.com/autoit3/docs/functions/Run.htm)('"tets.exe" -a')

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) ProcessExists (http://www.autoitscript.com/autoit3/docs/functions/ProcessExists.htm)($iPID)
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(262144+16, "Проверка", "Идет проверка, ждите")
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)

Centrinar
10-02-2010, 17:02
Creat0R Всё хорошо, но после окончания test.exe окно всеранво остаеться, как сделать чтобы оно само закрывалось.

Creat0R
10-02-2010, 20:57
после окончания test.exe окно всеранво остаеться, как сделать чтобы оно само закрывалось »
Тогда нужен не Msgox, а самопальный GUI:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>

$hGUI = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("Проверка", 300, 120, -1, -1, BitOR (http://www.autoitscript.com/autoit3/docs/functions/BitOR.htm)($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)

GUICtrlCreateLabel (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateLabel.htm)("Идет проверка, ждите", 0, 40, 300, -1, $SS_CENTER)
$nProgress = GUICtrlCreateProgress (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateProgress.htm)(120, 70, 60, 22, $PBS_SMOOTH, $WS_EX_DLGMODALFRAME)

GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@SW_SHOW), $hGUI)

$iPID = Run (http://www.autoitscript.com/autoit3/docs/functions/Run.htm)('"tets.exe" -a')

$iProgress = 0
$iStep = 5

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) ProcessExists (http://www.autoitscript.com/autoit3/docs/functions/ProcessExists.htm)($iPID)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($nProgress, $iProgress)
$iProgress += $iStep
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iProgress >= 100 Or (http://www.autoitscript.com/autoit3/docs/keywords.htm#Or) $iProgress <= 0 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iStep = -$iStep

Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(100)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)

Centrinar
10-02-2010, 21:11
все хорошо, только табличка на заднем плане, ее не видно)))

Creat0R
11-02-2010, 00:40
табличка на заднем плане, ее не видно »
Поправил свой пост.




© OSzone.net 2001-2012