5511
Comment: Minor improvements
|
5075
New version
|
Deletions are marked like this. | Additions are marked like this. |
Line 37: | Line 37: |
]ListObjects | ]ListObjects -v |
Line 55: | Line 55: |
The `-v` stands for "verbose". Without it it would report just the names. |
|
Line 61: | Line 63: |
⎕NC Name Type === ==== ==== 3.1 Hello3 Traditional Function |
Hello3 |
Line 70: | Line 70: |
⎕NC Name Type === ==== ==== 3.1 Hello3 Traditional Function |
Hello3 |
Line 80: | Line 78: |
]ListObjects #.MyForm | ]ListObjects #.MyForm -v |
Line 90: | Line 88: |
There are two optional switches available: | There are three optional switches available: |
Line 94: | Line 92: |
By default all objects are listed. You can specify the nameclass(es) you are interested in by specifying the `-nc` switch: | By default all objects are listed. You can specify the name class(es) you are interested in by specifying the `-nc` switch: |
Line 105: | Line 103: |
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`. === "Verbose" switch === By specifying `-v` for "verbose" the type and the name class of all objects are reported, too. {{{ ]ListObjects -nc=3 4 -v |
|
Line 114: | Line 145: |
=== "Start with" switch === With the `=s` switch you can specify one or more characters. Note that the filter is case sensitive. {{{ ]ListObjects -s=H ⎕NC Name Type === ==== ==== 3.1 Hello Traditional Function 3.2 Hello2 Direct Function ]ListObjects -s=HM ⎕NC Name Type === ==== ==== 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 }}} Note that this switch works in the same way as the (optional) left argument to `⎕NL`. |
== Help == |
Line 164: | Line 172: |
The script is version 1.0.1 from 2012-07-19 | The script is version 1.0.3 from 2013-02-03 |
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? 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.
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'
Example
Calling ListObjects without an argument and switch:
]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
The -v stands for "verbose". Without it it would report just the names.
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 -v ⎕NC Name Type === ==== ==== 9.2 Label1 Label (Instance) 9.2 Label2 Label (Instance) 9.2 webbr Class Instance
Switches
There are three 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.
"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
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.0.3 from 2013-02-03 Author: KaiJaeger