In VBS it is possible using code:
- Update: for activate and also maximize the program window
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.AppActivate "chromedriver"
'usando sendkey para maximizar janela via teclas ::
objShell.SendKeys ("% ") 'update /teclas: alt==[%]+espaço==[ ]
WScript.Sleep 000000000999 'update /sleep/timeout > 1 segundo
objShell.SendKeys ("x") 'update /tecla: x (maximizar janela)
To call the code:
"%Windir%\System32\CScript.exe" //nologo "Show_Active.vbs"
Or in a bat that creates the vbs and monitors whether the Adobe open, if positive,
calls the window chromedriver.exe foreground:
@echo off
>"%temp%\Show_Active.vbs"^
(
echo/ Set objShell = WScript.CreateObject^("WScript.Shell"^)
echo/ objShell.AppActivate "chromedriver"
echo/
echo/ objShell.SendKeys ^("%% "^) 'update /para maximizar janela/
echo/ WScript.Sleep 000000009999 'update /para maximizar janela/
echo/ objShell.SendKeys ^("x"^) 'update /para maximizar janela/
)
set _Run_CScript="%Windir%\System32\CScript.exe" //nologo
set _Show_Active=%_Run_CScript% "%temp%\Show_Active.vbs"
:_loop_:
:: para sair do looping quando a aplicação n estiver mais rodando ::
>nul ( tasklist | find /i "chromedriver" || goto :eof )
>nul ( timeout /t 2 /nobreak >nul & tasklist | find /i "AcroRd32.exe"
) && ( start "" /b %_Show_Active% ) >nul
goto :_loop_:
Obs.: To use a bat which creates a vbs, it is necessary to use escape, (like the ^)quando os caracteres
special are not in quotes:
•
Example:
^(, ^), ^{, ^}, ^&, ^>, ^<, ^|, etc...
•
More examples nesse link!