Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendKeys 2 running App.

Status
Not open for further replies.

NW

Programmer
Feb 3, 2000
61
GB
does anyone know how to send a shortcut key to a particular running program
 
if SendKeys doesn't work what does?

retvalue = shell("appname",mode) ' mode usually 1
AppActivate retvalue
SendKeys "% ",False ' false is easier to handle
' "% " = {ALT Space} is the exit/maximise menu in all apps.

I use it a lot and found that I have to AppActivate often and worse the app may have been around for an hour so I have to get it off the Task Bar and the only way I know is to shell again. The problem then is the retvalue has no meaning. So you have to AppActivate with the Title Bar Text - which for Outlook (say) can be one of many possibilities. eg
AppActivate "Outbox Microsoft Outlook",False
or
AppActivate "Inbox Microsoft Outlook",False

Each Hotkey or letter neads an individual SendKey to be sure and I put XX mSecs (from a timer) between each one and chose a time delay for each situation (20 mSecs to 5 secs if my HDD has to wake-up)
The last problem is that you can't do this in interpreter mode AND hope to stop it each time (but trying to AppActivate between each one may help)

The SendKeys statement is a doddle - using it in real situations needs a lot of thought - you can't blame MS for all of the problem either.

Good Luck
PS if you find a way of listing loaded apps in the Task Bar I am looking for same.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top