Windows Preferences

AceText’s AcePaste, AceType and AceEdit commands, as well as its ability to directly send clips to an application, require AceText to interact with other applications. To do so, AceText makes certain assumptions about the application. These assumptions are valid for most, but not all, Windows applications.

Normally, you’ll use the Applications tab in the Preferences screen to configure AceText to work correctly with your applications. The Windows tab provides similar settings, but configures top-level windows rather than applications. This is more complicated as applications may have multiple windows, but it can be more flexible if different windows in an application behave differently.

If a window matches a window configuration from the Windows tab in the preferences and that window is part of an application that you have configured on the Applications tab in the Preferences, then only the window configuration is used. The application configuration is only used for windows that do not match a window configuration. This system allows you to use the Applications tab to configure an application as a whole, while using the windows tab to use different settings for specific windows in the application.

Preconfigured Windows

The only window that’s preconfigured when you first use AceText is ConsoleWindowClass. This is the window class used by the command shell that is part of Windows. The only special treatment it gets are different keystrokes for pasting (Edit|Paste in the system menu). The AceEdit option is disabled, since the command shell doesn’t have a normal “copy” command.

Adding Windows

AceText identifies windows by their class names. Window class names are used by programmers when building Windows applications. The names are not necessarily meaningful and don’t have to be unique between applications.

To configure a window, switch to the window by clicking on it, and then switch back to the Preferences screen in AceText. Click the button “Add most recently active window class” to configure the window you just briefly switched to. The class name will be indicated below the button, and added to the list. This button uses the same method as the AcePaste and AceType commands to identify the target application for pasting.

The AceEdit button, the Clipboard tab and the ClipHistory use a slightly different method. They identify the application by checking which window last copied something onto the Windows clipboard. Many applications use an invisible helper window to manage the stuff they copy to the clipboard. Those windows often have generic class names used by many applications (developed with the same programming tools) and no captions. You’re better off configuring such applications on the Applications tab.

If you want to identify windows purely by the text displayed in their title bars, click the “Add any window class” button. This window configuration will apply to all windows in all applications. You should only do this when using a regular expression to check the window title.

You can add the same window more than once. If you do, you should use the window title regex to make sure only one window configuration applies to each window. If more than one configuration matches the class name and title, the one higher in the list is used.

Window Titles

Most applications indicate the name of the application and the active document in the title bar of their main windows. AceText can use a regular expression to check the window title. If the regex matches (part of) the title then the window configuration is used. If it does not then AceText checks the other window configurations.

If you simply want to check the title for some literal text, you can type that in normally. If the text includes symbols or punctuation, then you need to escape the characters +*?.\[](){} with a backslash. E.g. the regex \(I\.B\.M\.\) matches (I.B.M.) literally.

If you have RegexBuddy installed, you can click the (...) button to edit the regular expression with RegexBuddy.

There are two main purposes for checking the Window title with a regex. The first reason is that dealing with window classes can be complicated. The regex allows you to use the “add any window class” button and then type in the name of the application as the regex to match the title against.

The other purpose is to make AceText sensitive to the application’s context. A plain text editor that you use to edit HTML and C++ files, for example, may indicate the name of the active file in its caption bar. If you add two window configurations for this application, one using the regex \.html and the other using the regex \.(c|cpp|h|hpp)\b then you can set your HTML collection to be opened when you’re editing HTML files, and your C++ collection when you’re editing C++ files.

Window Configuration

The actual configuration settings for windows are the same as the application configuration settings.