[Update] – Change the ahk_class on line 2 of the ahk script to LyncConversationWindowClass for Lync 2013
Some organizations have decided to remove the ability for Lync to automatically save conversations so I put together the following script to create a shortcut to save conversations.
1. Install AutoHotkey (autohotkey.com)
2. Execute the Express Installation
3. Exit AutoHotKey
4. Open Notepad and save the following script with the .ahk extension
; Hide title bar on enter key to remind the user to use the shortcuts to save a conversation. Define a shortcut of Ctrl-Enter to show the title bar if there is a need to reposition the window but the title bar will hide when Enter has been clicked again. Define shortcuts to save and close on Escape, Ctrl-F4 or Alt-F4. These are common close keys but you can define your own shortcut key – reference http://www.autohotkey.com/docs/Hotkeys.htm#Symbols – [Update] Use ahk_class LyncConversationWindowClass for Lync 2013 or use ahk_class IMWindowClass for Lync 2010
#IfWinActive ahk_class IMWindowClass
; Hide title bar to only allow the use of escape to close the IM window. This was added to ensure the window X could not be used to close which the IM would then not be saved
WinGetTitle, currentWindow, A
WinSet, Style, -0xC00000 ; hide title bar
WinSet, Style, -0x800000 ; hide thin-line border
WinSet, Style, -0x400000 ; hide dialog frame
WinSet, Style, -0x40000 ; hide thickframe/sizebox
; Show title bar to allow moving around window but the title bar will hide again on the next enter.
WinGetTitle, currentWindow, A
WinSet, Style, -0xC00000 ; show title bar
WinSet, Style, -0x800000 ; show thin-line border
WinSet, Style, -0x400000 ; show dialog frame
WinSet, Style, -0x40000 ; show thickframe/sizebox
; Send the keystrokes to save and then close
; reference link – https://github.com/lancehilliard/BrokenLync/blob/master/AutoHotKey/SaveOnImWindowClose.ahk
5. Right click on the saved .ahk file and click Compile Script to create an .exe
6. Move the .exe to the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup and double click to start.
7. The script hides the title bar once Enter has been clicked on a Lync IM window (a reminder to not use the X to close the window which won’t save) and then defines the shortcuts of Esc, Ctrl-F4 or Alt-F4 to save the conversation and close the window. The window menus can still be accessed after the title bar has been removed by clicking the Alt key. There is also a shortcut of Ctrl-Enter to show the title bar if there is a need to reposition the Lync IM window but the title bar will hide when Enter has been clicked again.
8. Now that the script has been compiled you can uninstall autohotkey if you like and keep using the executable stand alone. I would just provide the executable but I’m sure most people might not want to just use some executable they have no idea where it came from. Plus now you know how to play with AutoHotkey for your other shortcuts needs 😉