Quantcast
Channel: Fórum ASP
Viewing all articles
Browse latest Browse all 1214

correr bat para minimizar browser

$
0
0

Boas,

 

Tenho  este script para correr um ficheiro bat e ele funciona na perfeicao com outra situação mas com esta nao faz nada, alguma razao para ele nao fazer nada?

dim wshell
	set wshell = CreateObject("WScript.Shell") 
    wshell.run "C:\inetpub\wwwroot\visua\minimiza.bat" 
	set wshell = nothing 

o ficheiro bat que ele corre serve para minimizar o browser e esta assim

@if (@a==@b) @end   /* JScript multiline comment

:: begin batch portion

@echo off
setlocal

for /f "tokens=2" %%I in ('tasklist /v /fi "imagename eq iexplore.exe" ^| find "Internet Explorer"') do set "PID=%%I"
if defined PID goto minimize

:: apparently IE is not running.  Launch, then wait for it to appear.
start "" "%programfiles%\Internet Explorer\iexplore.exe"
:ie 
ping -n 2 0.0.0.0 >NUL
for /f "tokens=2" %%I in ('tasklist /v /fi "imagename eq iexplore.exe" ^| find "Internet Explorer"') do set "PID=%%I"
if not defined PID goto ie

:minimize
cscript /nologo /e:Jscript "%~f0" "%PID%"

goto :EOF

:: end batch portion / begin JScript */

var oShell = WSH.CreateObject('wscript.shell');
WSH.Echo('Activating window with PID ' + WSH.Arguments(0));
oShell.SendKeys('%{ESC}')
oShell.AppActivate(WSH.Arguments(0));
WSH.Sleep(100);
WSH.Echo('Making full screen');
oShell.SendKeys('{F11}');
WSH.Sleep(1000);
WSH.Echo('Activating titlebar icon menu');
oShell.SendKeys('% ');
WSH.Sleep(100);
WSH.Echo('Minimizing');
oShell.SendKeys('n');
WSH.Sleep(100);


Obrigado


Viewing all articles
Browse latest Browse all 1214