Starting an app and cmd without focusing on their windows

The current situation is that I have a mouse button binding in AutoHotkey to kill a process, do some file operations and then start an application (.exe).

I would like to start the app without losing the focus of the current fullscreen window I am using.

Answers


In Autohotkey you have the function WinActivate to give the focus on a windows :

http://www.autohotkey.com/docs/commands/WinActivate.htm


I can think of 2 ways to accomplish this, assuming there are no command line switches to start it minimized or hidden.

  1. FileCreateShortcut allows a RunState parameter. You could create a shortcut with a RunState of minimized, then execute the shortcut. The effectiveness of this depends largely on what type of application it is.
  2. Use WinWait with a timeout period to wait for your executed program to exist, then use WinActivate to reactivate your fullscreen application. This will allow your application start time to vary, and you will not have to hard code sleep times.

  1. Set the window (Mainwindow) that you want to keep the focus on to be always on top. Note that this doesnt work with a fullscreen app (I couldn't find a solution for a true fullscreen app), but it works fine with a windowed one: Winset, Alwaysontop, , Mainwindow

  2. Run the side app and wait until it creates a window: Run, Sideapp.exe, , hide; WinWait, Sideapp

  3. Focus on the main window again: WinActivate, Mainwindow

Thank you for everyone who contributed.


Need Your Help

Vertex buffer object won't render, other primitives will

opengl assimp

I'm loading some scenes/objects from files using assimp, and I had them displaying properly earlier — but rewrote my MVP matrix setup (which had been terribly written and was incomprehensible).

migrating jsf application from weblogic10 to weblogic 12c

weblogic12c

We are encountering issues while deploying the new core SDM modules (wars) in weblogic 12c version. The new SDM core module (wb-tss-core-sdm-web-war-0.9.1.war) uses the JSF ,SeamListeners &