Setting the Active Keyboard Script
The main purpose of the KeyScript procedure is to update the keyboard layout (by using the 'KCHR' and 'itlk' resources) and the keyboard script based
on the verb with which it is called. If the Keyboard menu is displayed,
Verbs can explicitly specify a script, implicitly specify a script (for
example, the next script), or implicitly specify a keyboard (for example, the
next keyboard in the active script). If the verb specifies a script, then the
active default keyboard layout for that script becomes the active keyboard. You
can call KeyScript with an argument that is either an explicit script code or a negative verb with a special meaning. The KeyScript verbs are listed in the Table below.
Note: Beginning with system software version 7.0, KeyScript only loads 'KCHR' and 'itlk' resources if they are present in the
System file.
The smKeyNextScript, smKeySysScript, and smKeySwapScript verbs existed in system software version 6.0, but were not documented. They all set the
active keyboard script. New with system software version 7.0, the
smKeyNextKybd verb switches to the next keyboard within the active
keyboard script. (See the Table below.)
When the user is typing the name of an HFS object-for example, in the Finder
or a standard file dialog box-the keyboard script must be restricted to scripts
that display correctly in the Finder, dialog boxes, menus, and alerts.
KeyScript is called with the smKeyDisableKybds verb to disable keyboard input temporarily in any script except Roman or the system script. Keyboards
in other scripts will appear disabled in the Keyboard menu. When entry of the
name has been completed, KeyScript is called with smKeyEnableKybds to reenable keyboard input in all enabled scripts.
Table Verbs for the KeyScript procedure
Verb Meaning
(any script code) Switch to specified script
smKeyNextScript Switch to next available script
smKeySysScript Switch to system script
smKeySwapScript Switch to previously used script
smKeyNextKybd Switch to next keyboard in active script
smKeySwapKybd* Switch to previously used keyboard in active
script
smKeyDisableKybds Disable keyboards not in script system or
Roman Script System
smKeyEnableKybds Enable keyboards for all enabled scripts
smKeyToggleInline† Toggle inline input for current script
smKeyToggleDirection† Toggle default line direction
smKeyNextInputMethod† Switch to next input method in current
script
smKeySwapInputMethod† Switch to previously used input method in
current script
smKeyDisableKybdSwitch Disable switching from the current keyboard
*Not implemented in system software version 7.0
†Not implemented in U.S. system software, but may be implemented by
appropriate script systems
When keyboard layouts and scripts are being moved into or out of the System
file, it is imperative that no user action changes the active keyboard or active
script system. To ensure the integrity of both the current ( active) script
system and the other enabled script systems, a new KeyScript verb has been provided to remove the possibility of a user corrupting the system. To prevent
all keyboard switching and to disable all the Keyboard menu items, KeyScript is called with the verb smKeyDisableKybdSwitch. When the move has been
completed, KeyScript is called with smKeyEnableKybds to reenable keyboard switching.