1

"Skype for Business" (formerly "Microsoft Lync") is harder to wake up than my daughter. When it is minimized to the taskbar, clicking on the icon to restore it is inteminably slow -- it literally takes 5-10 seconds to restore if it has been idle for a while. This is a known issue that is often complained about (such as here or here), but no resolution or workaround has been provided.

However, there is one glimmer of hope that I would like to exploit, if possible. As I mentioned above, Skype is unresponsive only after it has been idle for some time. If the user is actively using it then it operates just fine. So... I would like to find a way to "jar" it every hour or so -- to keep it active.

My initial strategy: Use Task Scheduler to schedule the following WScript (hourly):

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Skype for Business"     'give app focus
WScript.Sleep 100                             'give app time to load
WshShell.SendKeys "% r"                       'restore app 
WshShell.SendKeys "% n"                       'minimize app

This works fine if the app is already minimized, but if the app is active (in focus) it will suddenly disappear. (If I omit the final line, then the app will pop up on top of whatever else I was currently working on.) I tried replacing the final two lines with this one instead:

WshShell.SendKeys "% {ESC}"

...which just opens and closes a menu. This works better, but it shifts focus to Skype (albeit momentarily) which causes further problems. It also unhides the taskbar and lights up the Skype icon (as if I had a message waiting).

QUESTION: Does anyone know if I can use AutoHotKey for this sort of thing?

Basically, I'm looking for some sort of script that can do this: determine whether the Skype window is currently active; if it is, do nothing. Otherwise, send some invisible command to it (for example: maximize then minimize), but in all cases to restore the window to its previous state.

Any suggestions? (An autohotkey script would be very much appreciated!)

kmote
  • 16,095
  • 11
  • 68
  • 91
  • As much as I feel for you, I'm not sure this is on topic. If you posted your Wscript code, we could take a look... – code11 Nov 01 '16 at 19:05
  • I'd try using **[WinHide](https://autohotkey.com/docs/commands/WinHide.htm)** and **[WinShow](https://autohotkey.com/docs/commands/WinShow.htm)** instead of minimizing the window. – user3419297 Nov 01 '16 at 20:55
  • @code11- I went ahead and added my Wscript code. But I have a feeling this is beyond the limits of Wscript was intended for. It just isn't that flexible. – kmote Nov 01 '16 at 22:42
  • @user3419297- good suggestion, but can you describe how to create a autohotkey script that can determine the current state of the app window and make sure to restore the window to that state at the end of the script? – kmote Nov 01 '16 at 22:47

1 Answers1

1

If Skype does NOT become unresponsive when the window is hidden, try something like this:

; Hide Skype after it has been inactive for 20 seconds:
SetTimer, hide_inactive_Skype_window, 1000
return

    hide_inactive_Skype_window:
IfWinNotActive, Skype for Business
    time++
else
    time := 0     ; reset
if (time = 20)    ; 20 seconds
{
    WinHide, Skype for Business
        time := 0     ; reset
}
return

; Use a hotkey to show/activate Skype:
    !s::  ; Alt+s
time := 0     ; reset
WinShow, Skype for Business
WinActivate, Skype for Business
return
user3419297
  • 9,537
  • 2
  • 15
  • 24
  • I can't find any documentation on "hidden" windows (besides the links you shared in your comment above). What does it mean to hide a window? Does a hidden window's icon appear on the taskbar? If so, how is it different than minimizing it? If not, how do you know that its running? – kmote Nov 02 '16 at 22:43
  • 1
    As far as I know: "WinMinimize" shrinks the window and places it on the taskbar. "WinHide" hides the window and also hides the button on the taskbar (The app is still running and actively updated, but it consumes less graphic resources). The absence of the button on the taskbar can be compensated by creating a shortcut or/and a Gui(-button) to show/activate the hidden window. To check if the application is runnig, use the [IfWinExist](https://autohotkey.com/docs/commands/WinExist.htm) or the [Process, Exist](https://autohotkey.com/docs/commands/Process.htm#Parameters) command. – user3419297 Nov 03 '16 at 08:13