TEAM ENVI^ ENVIMODE=1| ENVI^ FORCELOCAL=1
IFEX X.LOG, LOGS **ln=1 * X.LOG

_SUB  KillApps
    ENVI^ FORCELOCAL=1
    NAME &&PNAME=%~1
    FEXT &&PEXT=%~1
    SED PNAME=0,\*,.*,%PNAME%
    SED PEXT=0,\*,.*,%PEXT%
    FIND  --pid*@  &&V,
    FORX *NL &V,&&v1,
    {   MSTR  &&pid,&&pt=<1><6>%V1%
        NAME  &&nm=%pt%
        FEXT  &&ext=%pt%
        SED  &&i=?,^%PEXT%$,,%ext%
        FIND $%PEXT%_<>_,!!  IFEX $%i%<>1,  EXIT -
        SED  &&j=?,^%PNAME%$,,%nm%
        IFEX $%j%<>1, EXIT -
        kill *%pid%  
    }
_END

KillApps  cal*.exe
//KillApps  goagent*.exe
//KillApps  python*

