gte Posted September 28, 2009 Share Posted September 28, 2009 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! HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
ctyankeeinok Posted September 28, 2009 Share Posted September 28, 2009 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) Link to comment Share on other sites More sharing options...
gte Posted September 28, 2009 Author Share Posted September 28, 2009 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:") HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
TurionAltec Posted September 28, 2009 Share Posted September 28, 2009 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) Link to comment Share on other sites More sharing options...
gte Posted September 29, 2009 Author Share Posted September 29, 2009 I did not know you could do the "[active]" until I read your script and searched more on it 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) HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now