Size: 5075
Comment: New version
|
← Revision 12 as of 2019-05-30 07:55:01 ⇥
Size: 4544
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
`ListObjects` is a utility useful to list all sorts of objects in a given namespace. Tired of looking up all the different 9.1, 9.2, 9.3, 9.4, 9.5, 9.6 and 9.8 in the help? Flabergasted by a name class `¯8.6` or similar exotic values not mentioned in the documentation at all as of yet (2012)? Want to know what's an instance of an ordinary class and what's an instance of a form? Then you will love `ListObjects`. | `ListObjects` is a utility useful to list all sorts of objects in a given namespace. Tired of looking up all the different 9.1, 9.2, 9.3, 9.4, 9.5, 9.6 and 9.8 in the help? Flabbergasted by a name class `¯8.6` or similar exotic values not mentioned in the documentation at all as of yet (2012)? Want to know what's an instance of an ordinary class and what's an instance of a form? Want to tell references from the "real thing"? Then you will love `ListObjects`. |
Line 30: | Line 30: |
RefToClassMyCl←MyCl | |
Line 37: | Line 38: |
]ListObjects -v ⎕NC Name Type === ==== ==== 9.2 ClInst Class Instance 4.2 Dop Direct Operator 3.1 Hello Traditional Function 3.2 Hello2 Direct Function 9.4 MyCl Class 9.2 MyForm Form (Instance) 9.1 MyNS1 Namespace 9.1 MyNS2 Namespace 3.1 Test Traditional Function 4.1 Top Traditional Operator 9.2 WEBBROWSER OCXClass (Instance) ¯8.6 onBeforeNavigate2 External (inherited) 2.1 vars1 Vars |
]ListObjects ⎕NC Name Type === ==== ==== 9.2 ClInst Class Instance 4.2 Dop Direct Operator 3.1 Hello Traditional Function 3.2 Hello2 Direct Function 9.4 MyCl Class 9.2 MyForm Form (Instance) 9.1 MyNS1 Ref to Namespace 9.1 MyNS2 Namespace 9.4 RefToClassMyCl Ref to Class 4.1 Top Traditional Operator 9.2 WEBBROWSER OCXClass (Instance) 2.1 vars1 Vars |
Line 54: | Line 54: |
The `-v` stands for "verbose". Without it it would report just the names. |
|
Line 78: | Line 76: |
]ListObjects #.MyForm -v | ]ListObjects #.MyForm |
Line 88: | Line 86: |
There are three optional switches available: | There are two optional switches available: |
Line 130: | Line 128: |
=== "Verbose" switch === By specifying `-v` for "verbose" the type and the name class of all objects are reported, too. {{{ ]ListObjects -nc=3 4 -v ⎕NC Name Type === ==== ==== 4.2 Dop Direct Operator 3.1 Hello Traditional Function 3.2 Hello2 Direct Function 3.1 Test Traditional Function 4.1 Top Traditional Operator }}} |
|
Line 169: | Line 152: |
[[attachment:ListObjects.zip | Download]] the script. | [[attachment:ListObjects.dyalog | Download]] the script. |
Line 172: | Line 155: |
The script is version 1.0.3 from 2013-02-03 | The script is version 1.1.0 from 2017-04-27 |
User Command ListObjects
Contents
Overview
ListObjects is a utility useful to list all sorts of objects in a given namespace. Tired of looking up all the different 9.1, 9.2, 9.3, 9.4, 9.5, 9.6 and 9.8 in the help? Flabbergasted by a name class ¯8.6 or similar exotic values not mentioned in the documentation at all as of yet (2012)? Want to know what's an instance of an ordinary class and what's an instance of a form? Want to tell references from the "real thing"? Then you will love ListObjects.
Let's assume that you are in a clear workspace. Let's create a couple of objects in this workspace:
⎕FX'r←Hello' 'r←''World''' Hello2←{'Universe'} ⎕FX'r←(f Top)v' 'r←f v' Dop←{⍺⍺ ⍵} MyNS1←⎕NS'' MyNS1.⎕FX'r←Hello3' 'r←''World3''' 'MyNS2'⎕NS'' MyNS2.⎕FX'r←Hello4' 'r←''World4''' ⎕FIX':Class MyCl' '∇Make' ':Access Public Instance' ':Implements Constructor' '∇' ':EndClass' ClInst←⎕NEW MyCl 'MyForm'⎕WC'Form'('KeepOnClose' 1)('Coord' 'Pixel')('Posn'(40 40))('Size'(200 300)) 'MyForm.Label1'⎕WC'Label'('KeepOnClose' 1)('Posn'(15 15)) 'MyForm.Label2'⎕WC'Label'('KeepOnClose' 0)('Posn'(55 15)) MyForm.Label1.onGotFocus←'{1}' vars1←1 2 3 'WEBBROWSER'⎕WC'OCXClass' 'Microsoft Web Browser' 'MyForm.webbr'⎕WC'WEBBROWSER'('Coord' 'Prop')('Posn'(0 0))('Size'(100 100)) MyForm.webbr.onBeforeNavigate2←'OnNavigate' RefToClassMyCl←MyCl
Example
Calling ListObjects without an argument and switch:
]ListObjects ⎕NC Name Type === ==== ==== 9.2 ClInst Class Instance 4.2 Dop Direct Operator 3.1 Hello Traditional Function 3.2 Hello2 Direct Function 9.4 MyCl Class 9.2 MyForm Form (Instance) 9.1 MyNS1 Ref to Namespace 9.1 MyNS2 Namespace 9.4 RefToClassMyCl Ref to Class 4.1 Top Traditional Operator 9.2 WEBBROWSER OCXClass (Instance) 2.1 vars1 Vars
Argument
By default ListObjects looks into the namespace it was called from; in our example this is #. If you want to list the contents of a different namespace or instance you can specify the name of that object as an argument:
]ListObjects #.MyNS1 Hello3
Note that if you don't qualify the name fully then ListObjects adds the name of the object it was called from. So this works as well:
]ListObjects MyNS1 Hello3
Note the missing #.
One can also list all objects in a GUI instance:
]ListObjects #.MyForm ⎕NC Name Type === ==== ==== 9.2 Label1 Label (Instance) 9.2 Label2 Label (Instance) 9.2 webbr Class Instance
Switches
There are two optional switches available:
Name class switch
By default all objects are listed. You can specify the name class(es) you are interested in by specifying the -nc switch:
]ListObjects -nc=3 ⎕NC Name Type === ==== ==== 3.1 Hello Traditional Function 3.2 Hello2 Direct Function 3.1 Test Traditional Function ]ListObjects -nc=3 4 Dop Hello Hello2 Test Top
"Start with" switch
With the =s switch you can specify one or more characters. Note that the filter is case sensitive.
]ListObjects -s=H Hello Hello2 ]ListObjects -s=HM Hello Hello2 MyCl MyForm MyNS1 MyNS2
Note that this switch works in the same way as the (optional) left argument to ⎕NL.
Help
Help is available of course:
]?ListObjects Command "ListObjects". Syntax: 1S arguments; accepts switches -nc= -s= Returns information about all names found in the namespace the command was called from OR in the namespace specified with the (optional) "s" switch. With another optinal switch one can specify the name class one is interested in. Examples: ]ListObjects ]ListObjects #.CertainNamespace ]ListObjects -nc=3.1 ]ListObjects -s=St ]ListObjects #.CertainNamespace -nc=3.1 -s=St
Download
Download the script.
Version
The script is version 1.1.0 from 2017-04-27 Author: KaiJaeger