DonationCoder.com Forum

Main Area and Open Discussion => Living Room => Topic started by: nudone on May 13, 2010, 09:19 AM

Title: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 09:19 AM
i'm using filezilla - which brings up a dialog asking me if i want to upload edited files that it is monitoring...

the problem is that this dialog hardly ever has focus when it appears - and i can't alt+tab to bring it into focus. okay, i can use the mouse to click the buttons on it but it's annoying as it would be about a million times more convenient to keep my hands on the keyboard.

any idea how to bring a dialog window into focus that doesn't respond to alt+tab?

thanks.

(is this vista being dumb or just me.)
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 09:27 AM
maybe this tool by Skrommel could help - ShowDialogsToo (https://www.donationcoder.com/forum/index.php?topic=1075.msg7107#msg7107)?

(https://www.donationcoder.com/Software/Skrommel/ShowDialogsToo/ShowDialogsTooScreenP.gif)
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 09:47 AM
ooh, that looks promising.

i shall test it out now.

thanks, lanux128.

(i'll say what happens later.)
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 10:26 AM
oh well. it nearly worked. it does display the dialog in the taskbar - BUT there still doesn't appear to be a way of using the keyboard to get to it.

alt+tab, ctrl+tab and using vistaswitchers ctrl+alt+tab doesn't work.

and yet, the dialog will come in to focus if you click on and use other programs that are running.

maybe it's a bug in filezilla.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 10:55 AM
maybe AHK can help here? get the dialog's title/class with AU3 Spy then use something like WinActivate (http://www.autohotkey.com/docs/commands/WinActivate.htm) to bring it to focus.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 11:09 AM
yes, i think that might be the way to go. i'll see if i can figure something out - but i'll probably have to post a coding snack request.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 11:29 AM
here, you go.. just substitute your own dialog box's id in the WindowsID section.

#Persistent
#SingleInstance force
#NoEnv
SetTitleMatchMode 2 ; partial title match

WindowsID=Open ahk_class #32770  ; windows title and ahk class goes here. either will do..

SetTimer, ActivateMe, 500  ;increase or decrease timer
Return

ActivateMe:
;auto-activate
IfWinExist %WindowsID%
  {
  WinActivate
  ;do something here like press the ok button
  ;ControlClick, OK
  ;sleep for a while - good for cpu cycle
  Sleep, 3000
  }
Return

Source: http://www.autohotkey.com/docs/commands/IfWinExist.htm
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 11:43 AM
excellent. i think this is working correctly.

thanks very much for that, lanux128. i'm sure it would have taken me a few hours to figure that out.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 12:24 PM
aaaaargh. i can't believe it. it doesn't work. seems to have been just the stupid nature of how it comes into focus of it's own accord sometimes.

i'm blaming FileZilla on this. it's making itself unfocussed somehow. the swine.

edit:
i think the little ahk script is working - something just upsets it sometimes.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 12:30 PM
i use filezilla too. where is this option? maybe i can try to get it to appear on my PC.

Edit:
in this thread here (http://forum.filezilla-project.org/viewtopic.php?f=2&t=15974). this guy has the opposite problem, it seems but the reply is quite enlightening.

FileZilla only sets the focus window of its own process to the file exists dialog, it does not mark itself as the active program. Further, it requests user attention through some well-documented API. Either GTK+ or your window manager misinterprets this and makes the program active.
-site admin


Edit2: maybe the script's timing is flaky, try changing Sleep, 3000 to a smaller number.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 12:41 PM
for the edit monitoring to work you have to open/edit a file from the panel inside FileZilla - otherwise it doesn't know you are editing things.

then you'll get the prompt to appear when you save your opened/edited file.

[ You are not allowed to view attachments ]

[ You are not allowed to view attachments ]
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 12:55 PM
try changing the "windows id" line to this:

WindowsID=File has changed ahk_class #32770  ; windows title and ahk class goes here. either will do..

that would help, i guess.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 01:01 PM
erm, that's what i'd changed it to - BUT i'd put quote marks around the File has changed bit.

i'll try again though - perhaps it was looking for a title with " " marks in it - never thought of that.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 01:03 PM
ooooh, i think that's working properly now...

i did say it would take me several hours to do on my own - as you can see, i should pay more attention to whether ahk will actually accept things like " " thrown randomly around the place.

thanks very much, lanux128.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 13, 2010, 01:11 PM
you're welcome.. :) just curious why did you put the quote marks?

btw, the title matching mode is set to partial match so any of the word will do.
SetTitleMatchMode 2   ; partial title match

however, with the quote marks, AHK will look for one of these words:
"File
has
changed".

which leaves "has" as the only match.

Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 01:23 PM
i put the quote marks in as i just thought as the string had spaces in it (in File[space]has[space]changed) that's how ahk would work. i didn't realise it was clever enough to just take the whole string as it is - and i didn't understand what the partial match thing was doing. i definitely didn't expect it to match single words.

which all explains why my own ahk scripts tend not to work.

Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 13, 2010, 03:59 PM
a dialog window that won't come into focus
Actual Window Manager www.ActualTools.com is pretty good at this stuff.
I was using Ultramon 3 and a bunch of home-made macros for stuff like this but found AWM suited me a bit better.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 05:28 PM
thanks. i've looked at Actual Window Manager a long time back - i might find it more useful this time around. i'll investigate and then say how i get on...
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 13, 2010, 05:39 PM
hmm, haven't tested Actual Window Manager yet (can't until tomorrow); just reading what it can do - it looks like it would instantly replace several programs i have constantly running.

looks pretty good to me.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 04:24 AM
i've been running Actual Window Manager (AWM) for a while now and it could almost be described as a "super" tool. i say almost as it has not managed to replace 100% of the small apps i was hoping for - but it's still impressive.

so far, i've turned off these system tray running utils, as AWM replaces many of their functions:

1. DialogMove - my can't live without app (that jgpaiva was kind enough to make for me).

2. Taskbar Shuffle - drag taskbar items about.

3. WindowSpace - like win7 aero snap (i'm on vista).

4. UltraMon - multi-monitor support taskbars, etc.

5. AutoHotKey scripts that were needed to control specific program windows and dialogs boxes.

AWM has the ability to display the Alt+tab box on every screen on a multi-monitor setup. BUT, as it only replicates the default appearance of the alt+tab box it looks absolutely awful (does anyone on this planet think the Aero alt+tab is usable). i was hoping for a little more in this area and then i could have replaced the otherwise excellent VistaSwitcher - which is the best alt+tab replacement i've seen (you can make it very minimal) but it doesn't display on all monitors simultaneously.

(i've just been searching for a solution to the alt+tab situation.)
i've found that you can re-enable the old alt+tab in win7 by unchecking "Enable Aero Peek" in the Performance settings of System Properties (not tried it myself).

AND, in Vista use this in your registry to get the good old basic alt+tab back again.

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"AltTabSettings"=dword:00000001

so, at the moment, i'm undecided what i'll be keeping.

Ultramon has better methods of sending windows to adjacent screens. but AWM has far better options for each taskbar on each screen

VistaSwitcher still looks the best (and has more options for alt+tabbing on multi-monitors in many ways).

WindowSpace might have more options for snapping windows around the screen, not sure yet.

DialogMove works more automatically at controlling small windows - but maybe AWM has more power in this area that i need to look into.

Actual Window Manager can do a lot of the functions i use AutoHotKey for - but nothing will completely replace AHK, it's just less convenient to use for a novice like me.

i was trying not to, but it might just be that Actual Window Manager will be running alongside all of the above tools (except for Taskbar Shuffle). the battle for supremacy begins...
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 05:07 AM
more standard alt+tab registry modifications:

HKEY_CURRENT_USER\Control Panel\Desktop
CoolSwitchColumns - set the number of icon columns
CoolSwitchRows - set the number of icon rows

there appears to be a bit of a delay when AWS displays the alt+tab box on all screens at the same time. it's a bit annoying having a slight pause when tabbing through the open programs - so, it looks like i'll be keeping VistaSwitcher (i posted a feature request on their forum to have simultaneous screen support).
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 06:59 AM
i said i didn't want to do it but i'm now using Actual Window Manager with everything else. This is probably overkill as it is only replacing functions that can be done with AutoHotKey - well, and it adds a few buttons to the titlebars that might come in handy.

the problem with all of these programs is that they never quite go for enough. e.g. AWM doesn't allow complete control of right clicking on the title bar buttons - so i've got WindowSpace still performing those functions.

it seems using ready made apps it's a trade-off all the time - whereas AutoHotKey would allow for total freedom in the long run.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 14, 2010, 10:53 AM
i was trying not to, but it might just be that Actual Window Manager will be running alongside all of the above tools (except for Taskbar Shuffle). the battle for supremacy begins...
  ;D ;D ;D ;D ;D
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 14, 2010, 11:06 AM
Nudone
There are reasonably frequent updates to Actual Window Manager, and I've found the developer open to ideas and suggestions.

If you're using as many screens as you are, and you haven't already investigated WiLMA, (http://www.stefandidak.com/ramble/2009/01/04/window-layout-manager-manage-many-windows-on-many-screens/) you might find it useful. Although I'm just a poor relation with only two screens, WiLMA is great for a few tasks where I prefer a bunch of windows to be in specific places on each.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 11:11 AM
thanks. i'd no idea about WiLMA. i'll probably not get chance to look at it until monday - it must be useful though when that guy has got about 50 screens plugged into it.

is there no end to this quest?

edit:
things were so simple back when i had only one screen - and yet, there is no going back now...
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 14, 2010, 11:18 AM
is there no end to this quest?
Yes, it's "ion".  ;)

Good luck with WiLMA, it seems a good match with your layout.
(You may find you have to suspend AWM in some cases but that can be automatic.)

Thanks for all the info you're posting here. You're on an interesting journey.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 11:27 AM
i'm glad someone else is finding it interesting.

when you say AWM can be suspended automatically, do you mean it will suspend operation when a specific window has focus? i'd seen how you can set rules/exclusions but not a "global" kind of suspend.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 14, 2010, 11:28 AM
also there is a Actual Window Manager (https://www.donationcoder.com/forum/index.php?topic=18160.0) mini review by tranglos.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 11:42 AM
also there is a Actual Window Manager (https://www.donationcoder.com/forum/index.php?topic=18160.0) mini review by tranglos.
oh right. i didn't know that either. i must have brushed past it when i wasn't after such a tool. thanks, lanux128.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 14, 2010, 12:11 PM
when you say AWM can be suspended automatically, do you mean it will suspend operation when a specific window has focus? i'd seen how you can set rules/exclusions but not a "global" kind of suspend.
Oh, sorry, no.
I meant only that you, yourself, could set up however you call WiLMA to switch off AWM.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 12:14 PM
oh right. that's intersting though. if WiLMA can disable things then that does open up possibilities.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: cranioscopical on May 14, 2010, 12:22 PM
oh right. that's intersting though. if WiLMA can disable things then that does open up possibilities.
Oh dear, sorry again, I must learn to express myself better.  :-[
I don't think WiLMA will do that, so you'd just call WiLMA by launching something (of your own): step 1 stop AWM, step 2 start WiLMA -- batch file, a line or two of ahk, whatever. You'll need to see if you need that, and what if any interactions you have on your system, and what works best for you.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 14, 2010, 12:28 PM
oooohhh. i see. well, thanks for clarifying that.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 29, 2010, 12:14 AM
this is a newer version of this script (https://www.donationcoder.com/forum/index.php?topic=22730.msg205396#msg205396). the changes are ini file support for adding new windows/dialogs to be watched and tray menu customization. please give it a try.

Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on May 31, 2010, 05:18 AM
thanks very much, lanux128.

i've commented out the tooltip in the loop as it wouldn't stop floating around my cursor when it appeared.

is it a complicate addition to make the loop perform different actions depending on which window is activated?

currently it works fine for me - as the "Yes" button is always the one to click in the dialogs used. but i expect this will not always be the case.

here's the current script.

Code: AutoIt [Select]
  1. #Persistent
  2. #SingleInstance force
  3. #NoEnv
  4. ;#NoTrayIcon
  5. SetBatchLines, -1
  6. SetTitleMatchMode, 2    ; partial title match
  7. SetWorkingDir, %A_ScriptDir%
  8. DetectHiddenWindows, Off ; they are hidden for a reason..
  9.  
  10. Gosub, Get_INI              ; go to INI section
  11. IfExist, %TrayIcon%         ;TrayMenu Customisation
  12.   Menu, Tray, Icon, %TrayIcon%
  13.   Menu, Tray, Tip, Activate the specified window/dialog whenever it appears.
  14. SetTimer, ActivateMe, 500   ; timer starts - increase or decrease the value as necessary
  15.  
  16. ActivateMe:
  17. ;parse and auto-activate
  18. Loop, Parse, WatchThese, |
  19. {
  20.         ;Tooltip, %A_LoopField%
  21.         IfWinExist %A_LoopField%
  22.         {    
  23.                 WinActivate    ;do something here like press the ok button
  24.                 ControlClick, Yes
  25.                 ;sleep for a while - good for cpu cycle
  26.                 Sleep, 2000
  27.         }
  28. }
  29.  
  30. Get_INI:
  31. If (!FileExist("ActivateDialogs.ini")) ;if the ini file doesn't exist, create it with the info below
  32. {
  33.         FileAppend, [Settings]`nWatchThese=File has changed ahk_class #32770|Delete Shortcut ahk_class #32770`nTrayIcon=Application-warn.ico, ActivateDialogs.ini
  34. }
  35.  
  36. IniRead,WatchThese,ActivateDialogs.ini,Settings,WatchThese
  37. IniRead,TrayIcon,ActivateDialogs.ini,Settings,TrayIcon
  38.  
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on May 31, 2010, 09:49 PM
thanks very much, lanux128.

i've commented out the tooltip in the loop as it wouldn't stop floating around my cursor when it appeared.

is it a complicate addition to make the loop perform different actions depending on which window is activated?

currently it works fine for me - as the "Yes" button is always the one to click in the dialogs used. but i expect this will not always be the case.

ah, apologies for the tooltip, it's a left-over debug tool.. :)

yes you can perform different actions based on the activated window, put something like this in the inner loop (lines 24-27).

Code: AutoIt [Select]
  1. If A_LoopField = metapad ahk_class metapad
  2.     MsgBox The metapad window is detected.
  3. Else If A_LoopField = ahk_class notepad
  4. {
  5.         ;notepad window - let's do something else
  6.         WinActivate
  7.         ;do something else
  8. }
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: nudone on June 01, 2010, 03:03 AM
thanks, lanux128. that works great. i think that is going to come in very handy now.
Title: Re: how to get to a dialog window that won't come into focus by using the keyboard?
Post by: lanux128 on June 01, 2010, 03:48 AM
you're welcome.. :)