FAQ
Frequently asked questions for self help.
Please take a quick look at common questions (and answers) in the default list. If you can't find what you're looking for, start off by selecting your Ability Office version and then narrow it down by entering search text and/or category.
Knowledge base article 93
Sending "any" keys to an applicationTo program Ability, use the OLE Automation features in combination with macros. This is described in the on-line help.
For functionality not supported by OLE Automation, you can use a general routine to send keyboard characters to Ability. You can do this from both inside Ability and outside Ability. The method is "SendKeys" and it's part of Windows Scripting Host that comes with Microsoft Windows (98 and later).
Example:
Sub SendAbilityKeys
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "Ability Write"
WshShell.SendKeys "Any old plain text" ' Some
text in the document
End Sub
To access special characters, use the following key codes:
Key | Key code |
---|---|
Alt | % |
Ctrl | ^ |
Shift | + |
Esc | {ESC} |
Ins | {INS} |
Functions keys | {Fn} eg {F1}. {F12} |
Home | {HOME} |
End | {END} |
Delete | {DEL} |
Enter | {ENTER} |
To use Alt, Ctrl or Shift in combination with other characters, simply precede the character with the Alt, Ctrl or Shift key code from the above table.
Examples
Sub SendAbilityKeys
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "Ability Write"
WshShell.SendKeys "^P"
' Displays the Print dialog (Ctrl-P)
WshShell.SendKeys "+{F3}%U{ENTER}" ' Converts
selected text to uppercase
WshShell.SendKeys "%{F4}Y" '
Exit and answer "Yes" to save changes
End Sub
References
For general info on scripting, including latest downloads, see:
http://msdn.microsoft.com/scripting/
For more info on "Sendkeys" in particular see:
http://msdn.microsoft.com/scripting/windowshost/doc/wsMthSendKeys.htm