?
Solved

Set windows focus from DOS

Posted on 2003-03-13
4
Medium Priority
?
1,700 Views
Last Modified: 2006-11-17
I have a continuously-running DOS application on an unattended Win95 station. This DOS app MUST have focus for optimum performance. It runs as an app server, polling a queue looking for batch files to execute. Some of those batch files may launch windows apps (which spawn in their own windows, of course) and THOSE apps have splash screens which grab focus, no matter what shortcut or "start /m" settings you use. (The EGO of these people!)

This puts the app server into the background.

What I would like is a command line utility that can switch focus BACK to the app server. I would put it at the end of batch files being executed, forcing Windows to put the app server in the foreground. Given the complexity of Windows processes, etc. I would imagine that the utility would take the app server's windows title as the parameter...

Has anyone written such a beast?

Crash

0
Comment
Question by:CrashAlpha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Accepted Solution

by:
easoccer earned 160 total points
ID: 8130898
There's a freeware utility called AutoIt that works for me. It's hard to use because you have to learn the script language, but in your case:

WinActivate, Command Prompt

is the entire script. The script can then be converted to an executable and called from the command line. There are many other uses for this handy util that will allow you to control the windows side from DOS. Get it here:

http://www.hiddensoft.com/AutoIt/index.html

Cheers.
0
 
LVL 10

Assisted Solution

by:pbarrette
pbarrette earned 140 total points
ID: 8135038
Hi CrashAlpha,

You can also do this using VBScript:
set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "App Title"

Put that in a file called "Whatever.VBS" then run it from your batchfile using:
CSCRIPT Whatever.VBS

pb
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 9635522
Hi Pasha,

Recommend points split between easoccer and pbarrette (me).

pb
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question