A list of products available on this site
Documentation for XtraMania's xtras
Prices and links to the online store
Xtras, PDFs, samples
Have a question? Ask us!
Contacts
Logo. www.xtramaina.com  
Home Search E-mail
ActiveCompanion Usage/Wrappers/System Helper

ActiveCompanionSet xtras for Macromedia Director

System Helper Object

System Helper object is just a collection of several useful methods and properties.

To find out what it can do for you use:
sys = xtra("VbScriptXtra").CreateWrapper(#System)
put sys.interface()

sys.GetRunningObjectTable( strDisplayNameFilter, strNameFilter )
-- returns the filtered list of scriptable running objects. If filters are specified, only entries that contain these strings will be returned by the list.
Use sys.GetRunningObjectTable() method to get access to all running object known to the system that support Automation. For example to look for currently loaded Word documents try:

vb = xtra("VbScriptXtra")
-- Create System object
sys = vb.CreateWrapper(#System)
put sys.GetRunningObjectTable( ".doc" )
-- [[#DisplayName: "E:\...\VbScriptXtra.doc", #name: "Word._Document", #object: < VbScriptXtra, Word._Document, 0x0023911C, (2) >]]

Call it unfiltered to see what other applications and documents are contained in the ROT:
put sys.GetRunningObjectTable()

sys.ProcessId
-- the Id of the current process. This property together with WMI scripting allows getting detailed memory usage information for the current process. It returns the same values as Windows Task Manager does. See the sample here.

sys.StageHWND -- the window handle (HWND) of the stage
sys.AppHWND -- the window handle (HWND) of the top-level application window

Keyboard layout and language support:
sys.ActivateKeyboardLayout integer hkl
-- Sets the current keyboard layout
-- hkl can be one of the loaded layouts or language identifiers
-- returns the previous layout handle (hkl) or 0 if activation failed

sys.LoadKeyboardLayout string layoutName
-- Loads the specified keyboard layout
-- layoutName can be "00000409" for U.S. English, "00010409" for U.S. English (Dvorak) and so on.

sys.LoadKeyboardLayout integer languageId, optional integer physicalLayoutHandle = 0
-- Loads the specified keyboard layout
-- returns the HKL of the loaded keyboard layout
-- Note: loaded layout is installed at system level use UnloadKeyboardLayout to revert user's settings

sys.UnloadKeyboardLayout integer hkl
-- Unloads the specified keyboard layout

sys.KeyboardLayout
-- returns the property list with the active keyboard layout details
-- Something like: [#LayoutName: "00000409", #LanguageId: 1033, #PhysicalLayout: 1033, #HKL: 67699721]

sys.KeyboardLayoutList
-- returns a list of currently loaded keyboard layouts
-- Every list entry is the property list in a form: [#LanguageIdHex: "0409", #LanguageId: 1033, #PhysicalLayout: 1033, #HKL: 67699721]
-- Use its #HKL property or LanguageId value in ActivateKeyboardLayout method to activate the specific layout

sys.DefaultLocaleInfo
-- returns the property list with some useful information regarding system regional settings. It is something like: [#SystemDefaultLanguageID: 1033, #UserDefaultLanguageID: 1033, #SystemDefaultLocaleID: 1033, #UserDefaultLocaleID: 1033, #ANSICodePage: 1252, #OEMCodePage: 0]

See MSDN for a list of possible code page indentifiers and language identifiers.

Site homeSearchContact author © Eugene Shoustrov. www.xtramania.com