Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

newbie question - use sendkeys to send <Alt><F4>

2,248 views
Skip to first unread message

Mark Oliver

unread,
Jan 27, 2001, 1:18:31 PM1/27/01
to
Hi, i have tried %{F4} and {%F4}. Any other ideas?
Thanks,
Mark


Michael Harris

unread,
Jan 27, 2001, 2:47:31 PM1/27/01
to
set shell = createobject("wscript.shell")
rcSuccess = shell.AppActivate("the window title to activate")
if rcSuccess = 1 then shell.sendkeys "%{F4}"

Whether AppActivate is successful depends on the OS. For example, on Win2K (and I *think* WinME and
Win98) AppActivate won't "steal the focus" from another application.

The latest version of TweakUI (1.33) lets users configure that OS-specific behavior (it's on the
General tab)...

Windows Update: Tweak UI 1.33
http://www.microsoft.com/ntworkstation/downloads/PowerToys/Networking/NTTweakUI.asp

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Mark Oliver" <mark_...@worldnet.att.net> wrote in message
news:XhEc6.11005$7b2.7...@bgtnsc05-news.ops.worldnet.att.net...

Mark Oliver

unread,
Jan 29, 2001, 9:48:58 AM1/29/01
to
Hi, Thanks for the reply. I am using Windows 2000 server, the AppActivate
works, I can sendkey anything but %{F4}. Is the problem something I can
fix with TweakUI?
Thanks,
Mark

"Michael Harris" <mik...@mvps.org> wrote in message
news:OEU2VkJiAHA.1180@tkmsftngp05...

Tom Lavedas

unread,
Jan 29, 2001, 11:33:09 AM1/29/01
to
It may be that the target program is not correctly responding to the
keyboard entry. A common work around is to try ...

WSHShell.Sendkeys "%Fx"

If that doesn't help, I'd suggest you consider a third party control
called AutoIt. It seems to work a bit better than WSH's Sendkeys. If
you want to try it, see:

http://www.hidden.demon.co.uk/AutoIt/index.html

(This is merely informational, I have no vested interest nor can I take
any responsibility for the outcome.)

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Michael Harris

unread,
Jan 30, 2001, 2:17:04 AM1/30/01
to
What app are you trying to sendkeys to? As Tom suggested, does it even recognize Alt+F4 as meaning
anything to start with?

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Mark Oliver" <mark_...@worldnet.att.net> wrote in message

news:upfd6.3243$r%.261835@bgtnsc04-news.ops.worldnet.att.net...

pat...@my-deja.com

unread,
Jan 31, 2001, 8:09:27 PM1/31/01
to
Is there any way to enable/disable the "steal
focus" property for AppActivate from a VB app?
I.e. where is it in the registry?
Thanks
Gerald

In article <OEU2VkJiAHA.1180@tkmsftngp05>,

> news:XhEc6.11005$7b2.749728@bgtnsc05-


news.ops.worldnet.att.net...
> > Hi, i have tried %{F4} and {%F4}. Any other
ideas?
> > Thanks,
> > Mark
> >
> >
> >
> >
>
>

Sent via Deja.com
http://www.deja.com/

Michael Harris

unread,
Jan 31, 2001, 9:26:32 PM1/31/01
to
Run a registry monitor (like RegMon) while you change the value via Tweak UI to see what registry
keys/named values are affected. But just changing the registry without notifying the system of a
"settings change" *may* not be effective...

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

<pat...@my-deja.com> wrote in message news:95ad01$fkj$1...@nnrp1.deja.com...

Mark Oliver

unread,
Feb 2, 2001, 9:51:32 AM2/2/01
to
%F4 works with calc, but not with the 16 bit application I am trying to
close. Is there a trick to playing with 16 bit applications?


"Michael Harris" <mik...@mvps.org> wrote in message
news:OEU2VkJiAHA.1180@tkmsftngp05...

Michael Harris

unread,
Feb 2, 2001, 7:58:43 PM2/2/01
to
don't know... I don't have any!

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Mark Oliver" <mark_...@worldnet.att.net> wrote in message

news:UPze6.9691$mA1.6...@bgtnsc06-news.ops.worldnet.att.net...

0 new messages