topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 6:48 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: "CloseInactiveWin"  (Read 5739 times)

basc

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 21
  • Life Live Love Dough
    • View Profile
    • Donate to Member
"CloseInactiveWin"
« on: December 06, 2009, 08:54 AM »
IDEA:

CloseInactiveWin

Somethimes it takes a long while for the window to close if it has to be redrawn on the foreground first (whether I'd be a fast computer or not), which is something Mocrosoft overlooked.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: "CloseInactiveWin"
« Reply #1 on: December 06, 2009, 02:35 PM »
The easiest way would be using the command line with NirCmd

A .cmd file with this command in a directory in your Path should do it:

nircmd.exe win close stitle %1

(of course NirCmd.exe should also be in the path to keep it simple)

Say you named it cl.cmd and the inactive window had a title EditPadLite
then typing  cl EditP  <Enter>

or as much of the title as needed to identify it by the starting characters, and NirCmd should close it.  Otherwise you'd have to collect all the windows on the system and sift through them to avoid making the window the active window to get the info.  There are lots of hidden windows that you really don't need to deal with.  Just unnecessarily complex.  If you absolutely hate using a command prompt you could make an alias for FARR using the $$1 placeholder for the command line param with the partial window title, and use the alias instead of the .cmd file.




basc

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 21
  • Life Live Love Dough
    • View Profile
    • Donate to Member
Re: "CloseInactiveWin"
« Reply #2 on: December 09, 2009, 05:26 PM »
Thank you for this possibility. I haven't tried it yet but it looks promising.

I don't want to push my luck, but is it possible to assign this command to the X button?

Of course I may not have to; when I've time, I'll figure out its ways.

Thanks again.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: "CloseInactiveWin"
« Reply #3 on: December 09, 2009, 07:01 PM »
I don't use many of the window minimizer,closer,enhancer type utilities so I'm not sure what's already out there.

Avoiding making the window active pretty much limits you to using either the window title or window class(for example an explorer window will have either CabinetWClass or ExploreWClass as a class name.)

You can try searching the big freeware sites like: softpedia, snap-files, download.com, etc..

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: "CloseInactiveWin"
« Reply #4 on: December 10, 2009, 01:31 PM »
btw I've confirmed the NirCmd method does work.

Open notepad and enter these 2 lines:

@echo off
nircmd win close stitle "%1"



save it to a folder in your path as "nclose.cmd" (if you don't know what folders are in your path open a command prompt and type Path and hit enter.  It will show you all the folders in the path.)

Download NirCmd and put NirCmd.exe in the same folder in the path.

As a test, open notepad and cover it with a few windows. Open a command prompt and enter "nclose Untitled".  If notepad was open with no file it should close.  You can change the "stitle" in the batch cmd file for different types of window matching.  See NirCmd.chm help file for details.