Thanks!
Keivn
==============
dim WshShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
returnValue = WshShell.AppActivate( "Program Window Name")
' seems as right here I need code to force the program window to normal or
max before sendig the F9 keystroke.
If returnValue = true then
WshShell.sendkeys "{F9}"
Wscript.sleep (1000)
wshShell.sendkeys "{ENTER}"
End if
Set WshShell = Nothing
"Kevin" wrote:
> I have a program that needs to run in the backround on a server 24/7 for
> sales order processing. I need to set the program's user date each night.
> I have a vbscript that runs in the scheduled tasks to do this. The script
> checks to see if the program is active and if it is it performs a F9
> sendkey. This works only if the target program is not minimized. If the
> window is in normal or max mode I guess, it works just fine. How can I
> modify this vbscript to force the program to display it's window full screen
> before I send the F9 key? I'me familiar with coding in VB6 but not
> vbscript! I'm running a Windows XP PC application.
>
> Thanks!
>
> Keivn
> ==============
>
Const MAXIMIZE_WINDOW = 3
> dim WshShell
> Set WSHShell = WScript.CreateObject("WScript.Shell")
> returnValue = WshShell.AppActivate( "Program Window Name"), MAXIMIZE_WINDOW 'This should be on one line with AppActivate.
WshShell.AppActivate does not support this (at least not on
NT4/Win2k/WinXP/Win2k3), but AutoItX does, so this should work:
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetTitleMatchMode 2
oAutoIt.WinActivate "Program Window Name", ""
oAutoIt.WinWaitActive "Program Window Name", ""
oAutoIt.Send "{F9}"
WScript.Sleep 1000
oAutoIt.Send "{ENTER}"
AutoIt/AutoItX is free and can be found here:
http://www.hiddensoft.com/AutoIt/
AutoItX is an ActiveX control version of AutoIt and can be used
from a vbscript.
Note: It's defaults is 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.
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
from
returnValue = WshShell.AppActivate( "Program Window Name"), MAXIMIZE_WINDOW
to
returnValue = WshShell.AppActivate( "Program Window Name", MAXIMIZE_WINDOW)
Thanks for helping, this seems like it ought to be so simple......
Kevin
"thunder2232" <thund...@discussions.microsoft.com> wrote in message
news:4FC89889-9019-4041...@microsoft.com...
Kevin
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:%2327Ba0A...@TK2MSFTNGP11.phx.gbl...