Sign in to follow this  
Followers 0
gte

Looking for a winDEactivate command

5 posts in this topic

I have a window that I'm sending key strokes too after a certain amount of idle time, in order for the window to receive the key strokes it has to be activated by the winactive command, which puts it in the foreground.

How can I place it back in the background and bring the window that was in the foreground, back to its original location in the foreground?

If anyone requests, I'll post my code, but it won't work unless you have peregrine software on your machine. Controlsend does not work for this, unless the window is active, by the way.

Thanks!

Share this post


Link to post
Share on other sites



Here is an outline of what I understand of your request...

$handle = WinGetHandle("title of current window to save")

WinActivate("title of second window","")

...actions on second window...

WinSetState("title of second window","subtitle",@SW_MINIMIZE)

WinActivate($handle)

Share this post


Link to post
Share on other sites

Here is the top part of my code with a bit of a work around, it makes it transparent before it activates it, only if the window is < 8 but less than 15 and then it runs the controlsend commands and then minimizes it (as there is no set to background command that I can find) and windows automatically restores the previous window that was in the foreground

#include <GUIConstantsEx.au3>
#include <Timers.au3>
#include <Array.au3>

Opt("WinTitleMatchMode", 1)
Opt("SendKeyDelay", 50)

While 1

If ProcessExists('scguiw32.exe') Then
    
    If _Timer_GetIdleTime () <= "5000" Then
        Sleep(2000)
        
    Else
    
    $originalwindow = WinGetState("ServiceCenter - [Incident", "Incident Queue:")

    If $originalwindow < 8 OR $originalwindow > 15 Then 
        WinSetTrans ("ServiceCenter - [Incident", "Incident Queue:", 0)
        EndIf
    
        WinActivate("ServiceCenter - [Incident", "Incident Queue:")

Share this post


Link to post
Share on other sites

Here is an outline of what I understand of your request...

Slight modification

$handle = WinGetHandle("[active]")

WinActivate("title of second window","")

...actions on second window...

WinSetState("title of second window","subtitle",@SW_MINIMIZE)

WinActivate($handle)

Share this post


Link to post
Share on other sites

I did not know you could do the "[active]" until I read your script and searched more on it :D

That's great! I'm going to tweak my script tomorrow for this, I was having to minimize it before after finishing what I needed to do with ctrlsend, but this is better, thank you both

Here is an outline of what I understand of your request...

$handle = WinGetHandle("title of current window to save")

WinActivate("title of second window","")

...actions on second window...

WinSetState("title of second window","subtitle",@SW_MINIMIZE)

WinActivate($handle)

Slight modification

$handle = WinGetHandle("[active]")

WinActivate("title of second window","")

...actions on second window...

WinSetState("title of second window","subtitle",@SW_MINIMIZE)

WinActivate($handle)

Share this post


Link to post
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
Sign in to follow this  
Followers 0