Any idea what's going on or how I can get by this?
Nate Hekman
Yes. Save yourself some grief, and take a look at the free AutoIt/AutoItX
(AutoItX: COM component that can be used from VBScript):
http://www.hiddensoft.com/AutoIt/
There are several cases where WSH AppActivate will not be able to bring a window
to the top on Win98/ME/2k/XP (but will work for Win95 and NT 4.0). The AutoItX
WinActivate method does not have this shortcoming.
AutoItX also has much more windows handling functionality, and also a _lot_ more
other stuff. All this in a 49 KB dll :-)
Note:
AutoItX window handling defaults to match the start of a window title that you
specify,use "SetTitleMatchMode 2" to specify ANY substring of the window title
you want to match. Also, the Windows titles and text are case sensetive.
--
torgeir
-------------------------------------------------------------------
var oShell = WScript.CreateObject("WScript.Shell");
var sMainWindowTitle = "Prassi PrimoDVD 2.0 - [Job 1";
oShell.Run("d:\\images\\releases\\currentrelease.pxj");
WScript.Sleep(8000);
// at this point the application is running, but does not
// always have the focus
oShell.AppActivate(sMainWindowTitle);
WScript.Sleep(1000);
// I tried the above line in order to give it the focus, but
// if it doesn't have the focus automatically when it starts,
// this doesn't help.
//
// I found that sometimes I could get around the problem
// by have a second application running. If I could switch
// the focus (AppActivate) to the 2nd app and then back
// to the one I really want, that would often work.
-------------------------------------------------------------------
"Michel Gallant" <neu...@istar.ca> wrote in message
news:3D3843FC...@istar.ca...
If WshShell.AppActivate("Prassi PrimoDVD 2.0") then
WScript.Sleep 500
...send your keys here...
else
wscript.quit
> var oShell = WScript.CreateObject("WScript.Shell");
> var sMainWindowTitle = "Prassi PrimoDVD 2.0 - [Job 1";
>
> oShell.Run("d:\\images\\releases\\currentrelease.pxj");
> WScript.Sleep(8000);
>
> // at this point the application is running, but does not
> // always have the focus
>
> oShell.AppActivate(sMainWindowTitle);
> WScript.Sleep(1000);
>
> // I tried the above line in order to give it the focus, but
> // if it doesn't have the focus automatically when it starts,
> // this doesn't help.
Hi
This is child's play for AutoItX:
Set oShell = CreateObject("WScript.Shell")
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetTitleMatchMode 2
sMainWindowTitle = "Prassi PrimoDVD 2.0 - [Job 1"
oShell.Run "d:\images\releases\currentrelease.pxj"
' Loop until the window exists and is active
Do
' Add a sleep so the loop doesn't become a CPU hog.
Wscript.Sleep 100
oAutoIt.WinActivate sMainWindowTitle, ""
Loop Until oAutoIt.IfWinActive(sMainWindowTitle, "") = 1
' Continue script here
*********************
Here is a demo of another way of doing it, just to show AutoItX's capabilities:
oShell.Run "d:\images\releases\currentrelease.pxj"
' Stop script execution until the specified window exists.
' The window does not need be active. Set timeout to
' 5 seconds (optional)
' Checking for timeout
If oAutoIt.WinWait(sMainWindowTitle, "", 5) = 1 Then
WScript.Echo "Timed out. No window found. Quitting!"
WScript.Quit
End If
' If you do not want timeout, you can use this instead:
'oAutoIt.WinWait sMainWindowTitle, ""
' Window exists, now make it active
oAutoIt.WinActivate sMainWindowTitle, ""
' Continue script here
--
torgeir
"Mark A. Bystry" <mby...@ziggity.com> wrote in message
news:#cwYUM2LCHA.2024@tkmsftngp10...
Nate
"Torgeir Bakken" <Torgeir...@hydro.com> wrote in message
news:3D384B76...@hydro.com...
I'll see if I can find an AutoIt newsgroup or mailing list where I can see
if others have this problem.
Nate
"Torgeir Bakken" <Torgeir...@hydro.com> wrote in message
news:3D387B03...@hydro.com...
--
Please respond in the newsgroup so everyone may benefit.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting
"Nathaniel Hekman" <hekmanATgeo...@no.spam> wrote in message
news:O$Xetj#MCHA.2024@tkmsftngp11...
<Alex K. Angelopoulos (MVP)> wrote in message
news:uzr0ht#MCHA.2100@tkmsftngp12...
This is yet another annoyance with having to manipulate "real" windows
as opposed to the data and logic behind them.
--
Please respond in the newsgroup so everyone may benefit.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting
"Nathaniel Hekman" <hekmanATgeo...@no.spam> wrote in message
news:e9WYCy#MCHA.2420@tkmsftngp11...