Re: Application/popup focus

From: Philippe L. Balmanno (PBalmanno_at_sandiego.gov)
Date: 02/16/05


Date: Wed, 16 Feb 2005 15:30:30 -0800

Sorry the first post was using Internet and I got an error so I thought it
didn't make it.

"Philippe L. Balmanno" <PBalmanno@sandiego.gov> wrote in message
news:%238nJo6HFFHA.1836@tk2msftngp13.phx.gbl...
> Only the second script I've ever attempted to write for the office.
> Usually, I do SQL & PLSQL.
>
> Is there a way to keep focus on an application run from a script?
>
> Here is the script I have:
>
> /** Script: CleanUp.wsh
> *
> * Purpose: Calls Clnmgr and start cleanup.
> *
> *
> **/
>
> // Title of Disk Cleanup MMC
> var appTitle = "Disk Cleanup"; // Application's Title
> var WshShell = WScript.CreateObject("WScript.Shell");
> WshShell.Run("%systemroot%\\system32\\cleanmgr.exe /D %c");
> WScript.Sleep(100); // Wait some more
> WshShell.AppActivate(appTitle); // Activate application
> WScript.Sleep(100); // Wait a fraction before next step
>
> //Handle Popup and start the program -- here is where it stalls the popup
> looses focus
> WshShell.SendKeys("{TAB}"); // Tabs to choose ok action
> WshShell.SendKeys("{TAB}"); // Tabs to choose ok action
> WScript.Sleep(500); // Wait some more
> WshShell.SendKeys("{ENTER}"); // Action chosen is enter to start
> cleanup
>
>



Relevant Pages

  • Application focus using Wsh
    ... I'm trying to write a little script to ... run cleanmgr.exe however I've encountered the popup box that looses focus and ... // Title of Disk Defragmenter MMC ...
    (microsoft.public.scripting.wsh)
  • RE: Script Error
    ... How to Troubleshoot Script Errors in Internet Explorer ... The following warning message may also appear in the Microsoft Internet ... To update the scripting engine for Internet Explorer on Microsoft Windows ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • RE: IE Script Error
    ... How to Troubleshoot Script Errors in Internet Explorer ... The following warning message may also appear in the Microsoft Internet ... To update the scripting engine for Internet Explorer on Microsoft Windows ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • RE: script error
    ... How to Troubleshoot Script Errors in Internet Explorer ... The following warning message may also appear in the Microsoft Internet ... To update the scripting engine for Internet Explorer on Microsoft Windows ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • RE: script error
    ... How to Troubleshoot Script Errors in Internet Explorer ... The following warning message may also appear in the Microsoft Internet ... To update the scripting engine for Internet Explorer on Microsoft Windows ...
    (microsoft.public.windows.inetexplorer.ie6.browser)