#!PECMD
ENVI  &&&EnviMode=1

SET ::WM_SIZE=0x0005
SET ::SIZE_MAXHIDE=4
SET ::SIZE_MAXSHOW=3
SET ::SIZE_MAXIMIZED=2
SET ::SIZE_MINIMIZED=1
SET ::SIZE_RESTORED=0


_SUB OnT1
    TEAM ENVI &LOGF=%&FNAME%| ENVI &&T=
    READ  %&LOGF%,*r,&&T
    FIND $ "%&T%" = "%&OLD%",! TEAM ENVI @&EDIT2=%&T%| ENVI-copy &OLD=&T
_END


_SUB OnSize_WIN1
   TEAM ENVI &&sz=0| ENVI &&w=0| ENVI &&h=0
   IFEX $%1 = %&SIZE_MAXIMIZED%, ENVI &sz=1
   IFEX $%1 = %&SIZE_MAXSHOW%, ENVI &sz=1
   IFEX $%1 = %&SIZE_RESTORED%, ENVI &sz=1
   IFEX $1=%&sz%,
   {
        ENVI @this.POS=?::&w:&h
        CALC #&w=%&w% - (670-640) 
        CALC #&h=%&h% - (540-480)
        ENVI @&EDIT2.POS=::%&w%:%&h%
   }
    
_END


_SUB OnName
    ENVI @&T10
    CALL OnT1
    ENVI @&T1=3000
    M
_END

//函数： WINTAIL
//参数： 文件名
//监视一个文件（如LOG）的末尾
_SUB WINTAIL
    CALL &WINTAILW  %*
_END


_SUB &WINTAILW,W670H540,PECMD2012查看LOGS,,,,, -maxb -size 
    ENVI  &&LOGF=%1
    EDIT &FNAME,L10T1W469H20,%1,CALL OnName,0x100
    EDIT|- &EDIT2,L10T25W650H480,<空>,,0x44
    ENVI @this.MSG=%&WM_SIZE%::&&wParm,&&lParm,CALL OnSize_WIN1 %&wParm%  %&lParm% 
    CALL OnSize_WIN1 %&SIZE_MAXIMIZED%
    ENVI &&OLD=
    call OnT1
    time &T1,3000,call OnT1
_END

// LOGS *E:\XX.LOG
CALL WINTAIL E:\X.LOG

