AutoHotkey Shortcut to Save Lync Conversations

[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
1

3. Exit AutoHotKey
2

4. Open Notepad and save the following script with the .ahk extension
3

; 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
Enter:: HideTitleBar()
$^Enter:: ShowTitleBar()
Escape:: SaveAndClose()
$^F4:: SaveAndClose()
$!F4:: SaveAndClose()
return
#IfWinActive

; 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
HideTitleBar()
{
WinGetTitle, currentWindow, A
IfWinExist %currentWindow%
{
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
}
send, {Enter}
return
}

; Show title bar to allow moving around window but the title bar will hide again on the next enter.
ShowTitleBar()
{
WinGetTitle, currentWindow, A
IfWinExist %currentWindow%
{
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
}
return
}

; Send the keystrokes to save and then close
SaveAndClose()
{
send, ^s{Escape}
return
}

; 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
4

6. Move the .exe to the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup and double click to start.
5

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 ;-)

Vincen

Configuring localhost for Oracle XE on Windows 7

While at a client the installation of Oracle XE set the host to my computer name which included a sub-domain that would not resolving because I was on the client network. This was causing an ORA-12545 error (Connect failed because target host or object does not exist) which was resolved by change the host name to 127.0.0.1 in C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora and C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora

Next I encountered an ORA-12514 error (listener does not currently know of service requested in connect descriptor) that took me awhile to figure out. I finally found the answer in this thread. Turns out the XE service needs to be registered by adding the following SID_DESC to the SID_LIST in C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora

1
2
3
4
(SID_DESC =
      (SID_NAME = XE)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
    )

Here is the complete C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = XE)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
    )
  )
 
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
  )
 
DEFAULT_SERVICE_LISTENER = (XE)

Happy Coding!
Vincen Collins