Jump to content

Find last active window


Recommended Posts

Hi,

I've tried to find this but no luck :(

How do i display the previous active window ?

For example :

I'm running notepad, and switch to an AutoIt program, how can i see that notepad is my last active window ?

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

Hi,

thnx works but...

show the alt-tab dialog also quickly.....

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

$PrevWin = WinGetTitle("")
$CurWin = WinGetTitle("")
while 1
  if $CurWin <> WinGetTitle("") Then
    $PrevWin = $CurWin
    $CurWin = WinGetTitle("")
  endif
  Sleep(100)
Wend

This is some off-the-cuff pseudo-code, but maybe you get my drift.

Instead of Sleep, you could implement WinWaitNotActive($CurWin).

I suppose I have not left you a good way to get out of the loop though. :(

J

If I am too verbose, just say so. You don't need to run on and on.

Link to comment
Share on other sites

"last" uses the last successful window match so you don't have to keep specifying the title and text again and again. e.g.

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

This is what they call a "proof of concept." It has a message box which pops up every whipstitch, but maybe it can be refined.

The main prob. I had was with the scope of the variables. I tried several implementations, but my ideas all required some multi-threading, which wasn't working.

;Prog Start
Global $PrevWin = ""
Global $CurWin  = "dummy"
While 1
  Sleep(100)
  WinWaitNotActive($CurWin)
  $PrevWin = $CurWin
  $CurWin = WinGetTitle("")
  MsgBox(4096, "This win excluded", $PrevWin, 5)
WEnd

J

If I am too verbose, just say so. You don't need to run on and on.

Link to comment
Share on other sites

"last" uses the last successful window match so you don't have to keep specifying the title and text again and again. e.g.

Andre

<{POST_SNAPBACK}>

I know, but it worked for me at the start of a script... one that was started via an OS shortcut key... so, thinking about it further, the window that I was interested in never lost focus - so the "last" line probably did nothing for me. Thanks for helping me think thru that. I'll go back to sleep now.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • 3 months later...

Well I guess you could have all you "extra" desktop icons in a folder somewhere and when the boss comes in you hit alt + b or something and it switches them all. As for the windows just do a WinList function and save that list then have autoit close them all, and open a few new "innocent" ones.

Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...