topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday March 28, 2024, 11:15 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: SOLVED: WinWarden send window to back / bottom  (Read 6801 times)

rodp

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
SOLVED: WinWarden send window to back / bottom
« on: September 24, 2014, 08:50 PM »
Hi All,

Please can you help me in settin gup WinWarden...

Briefly, I use a program (called Execute) which processes data and creates multiple tables.  I generally work on other pieces of work whilst this runs (say in word or excel).  Execute has about 20 tables to run.  After finishing each table it closes and brings another little window up to show it's progress (see pic).  The problem is if I am typing away and don't notice that a new instance of Execute has appeared I can be prone to causing it to stop, eg pressing the space bar will cause the Cancel button to be pressed!  I would like to use WinWarden to return the focus back to the previous application (say excel for example).  So far I've been able to setup a line in the ini file that moves the Execute window to the bottom of the sreen but I've been unable to make it lose focus / unactivate it.

Capture.JPG


This line works fine - it detect the correct window when it pops up and moves it to the bottom of the screen.
Active      ,Execute,,,,,-Bottom,,,,,,,,,,,,,

in the ini file it stated the 18th or higher attribute can contain the following features.  I'm guessing I need to use Bottom, as I want the previous application to have the focus back - is this the correct one?

;>17 Maximize       Maximizes the window
;    Minimize       Minimizes the window
;    Restore        Restores the window
;    Show           Shows the window
;    Hide           Hides the window
;    Top            Moves the window on top of the other windows
;    Bottom         Moves the window to the bottom of the other windows
;    Enable         Enables mouse and keyboard input
;    Disable        Disables mouse and keyboard input
;    Ghost          Makes mouse clicks go through to the underlying window

Active      ,Execute,,,,,,,,,,,,,,,,Bottom,,

The problem is this doesn't work and infact none of the other ones seem to work, eg Minimize.

Hope someone can help

Thanks in advance

Rodp


« Last Edit: September 25, 2014, 06:32 AM by rodp »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #1 on: September 24, 2014, 09:59 PM »
i am not sure if what you're asking is possible with WinWarden but if you want to go the Autohotkey route, this might be of help:

this is untested and you may have to change the "Sleep' duration a bit.

Code: Autohotkey [Select]
  1.  
  2. SetTitleMatchMode, 2            ; partial match
  3. SetWorkingDir, %A_ScriptDir%
  4. DetectHiddenWindows, Off        ; they're hidden for a reason.
  5.  
  6. var1 := "NPD PowerView: Execute Table"
  7.  
  8.         {
  9.         WinGetActiveTitle, active_title
  10.         WinGetClass, active_class, A
  11.         }
  12. IfWinActive, % var1
  13.         {
  14.         WinActivate % active_title
  15.         WinActivate % "ahk_class " . active_class
  16.         TrayTip,Note:,The NPD PowerView window has lost focus. `nPlease press Ctrl+Esc if you wish to interact with it.,10,1
  17.         }
  18. Sleep, 500
  19. }
  20. Return
  21.  
  22. ^Esc::Pause                     ; Ctrl + Esc pauses
  23. +Esc::ExitApp                   ; Shift + Esc exits

Edit: added a visual hint for users.
« Last Edit: September 25, 2014, 04:43 AM by lanux128 »

rodp

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #2 on: September 25, 2014, 03:25 AM »
Hi Lanux128,

Thanks very much for the guidance and script - that worked a treat and the focus is returned back to the previous application it seems.  There is one slight change I need.  I need the script to only run when the Execute window is first activated / created.  Currently as soon as I click on the window manually (eg to manually cancel it) the AHK script runs meaning it's hard to click the cancel button.  I could increase the sleep time but then this would impact the response time for when the window pops up initially.

I'm thinking that you could put a line in detecting if the mouse position intersects the same area as the Execute window or if the script registers some sort of session ID that is unique to that instance.  Could you help me with that additional condition?

Many thanks in advance.

Rodp

EDIT...... just came across this example: http://stackoverflow...timer-runs-only-once.  See Update 2.  Do you think this is on the right tracks?
Or... (just reading the syntax list available) would WinWait actually do all what I need or is this more CPU intensive compared to a normal loop?
« Last Edit: September 25, 2014, 03:53 AM by rodp, Reason: google search returned something that might help »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #3 on: September 25, 2014, 04:15 AM »
Hi rodp,

glad to be see the script working. if you want to interact with the said window (Execute window), you can press Ctrl+Esc to pause the script. give it a try and see if that works for you.

rodp

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #4 on: September 25, 2014, 04:21 AM »
ah yes, that would work - sorry wasn't thinking!  Is it possible then to place a brief message (balloon message!) from the H icon in the task bar to state that the window has been deactivated, press Ctrl+Esc to stop the script (incase you need to cancel), or something to that effect?  I might roll this out to other people and they would need to know what's going on you see.

To further my understanding however, are there drawbacks if I was to try using WinWait?

Thanks

Rodp

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #5 on: September 25, 2014, 04:48 AM »
adding a TrayTip command would provide a visual clue to the users as to what is happening, which I have already added in the above code.

I don't see any drawbacks between using WinWait and Loop, it is just a matter of personal preference. feel free to try out the example you linked, and see if there are any differences. you can use WinWaitActive/WinWaitNotActive.

rodp

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: WinWarden send window to back / bottom
« Reply #6 on: September 25, 2014, 06:06 AM »
That worked great - thanks ever so much for your help :)  :Thmbsup: :Thmbsup: