Monday, November 19, 2018

Automatically Closing the Outlook Window when Creating Packages in SDL Trados Studio

If, like me, you find it annoying to have the Outlook window popping up whenever you create a package after opening SDL Trados Studio, then you may find this useful.

This workaround uses an AutoHotkey script, so if you are not currently an AutoHotkey user, read the section at the end of this article for detailed instructions on how to use the script.

In this case, the script I'm using to get rid of the Outlook window (closing it automatically as soon as it pops up) looks like this:


#IfWinActive ahk_exe SDLTradosStudio.exe

Loop

{
WinWait,Welcome to Microsoft Outlook 2016
WinClose,Welcome to Microsoft Outlook 2016
Send, y
}

How does it work? The script simply runs in a loop, waiting for a window called "Welcome to Microsoft Outlook 2016" to appear, and when it does, it closes it.

Hint: If your window has a different title, substitute it in the script. The window title has to match exactly for this to work.




But that's not the end of the story, because you know that after you try to close the window, you will see a message like this:


So that last line of the script sends the keystroke "y" to activate the "Yes" button in this window. Again, if your window says something different, substitute the appropriate keystroke in the script.

Here's a video showing Trados Studio's default behavior:


And here's what happens when the script is running:





Creating the AutoHotkey script and running it

First, download AutoHotkey here and install it. Don't expect to see anything different in your computer after installing the program. AutoHotkey runs in the background and allows you to run custom-made scripts to automate tasks.

To use this script, first you will need to create and AutoHotkey file.

1. In Windows Explorer, select a folder where you'd like to keep your script and right-click in any white space within the folder. From the menu, select New and then AutoHotkey Script.

2. Name your file.

The file, which will have an ahk extension, can be opened in a plain text editor, such as Notepad (I personally prefer Notepad++). Double-clicking the file won't open it, but instead it will load the script, making it active. To edit the file, you will need to either open it directly from within your text editor or right click on the file name and select Open with.

3. Open the file in Notepad (or your preferred plain text editor), and paste the script below the text already contained in the file.

4. Save and close the file.

5. Double-click the file to activate the script. After you do this, there will be a green square with a white "H" in it in your system tray.

And that's it! With the script running, that annoying Outlook window will be closed automatically as soon as it pops up.