NS BASIC Tech Note                                December 18, 1996

33. Accessing and Using Other Files, Data, and Applications
-------------------------------------------------------------------

The GETROOT() Function returns the root frame of your Newton. Every 
application currently installed on your Newton is accessible via this 
frame. Because of their large size, you should always use the special := 
assignment operator to point to this frame.

The first example program will display all of the items stored in the root 
frame. The output of this list is quite large, and will not be reproduced 
in this technote. This program is completely safe. You can enter and run 
it on your Newton with no risk of data loss.

10 REM getroot() Example
20 rootFrame := getroot()
30 rootElements := elements(rootFrame)
40 numElements = length(rootElements)-1
50 FOR i = 0 TO numElements
60 PRINT rootElements[i]
70 NEXT i

The next example will open the Names application, and is also completely 
safe:

10 getroot().cardFile:open()

The :open() in the above program tells the Names application to open as if 
you had tapped Names. The built-in applications respond to :open() and 
:close(). The names of the built-in applications are paperRoll (Note Pad), 
calendar (Dates), cardFile (Names), extrasDrawer (Extras), and assistant 
(Assist).

The last example program will display all of the fields in your user 
configuration frame. The output of this list is quite large, and will not 
be reproduced in this technote. This program is completely safe. You can 
enter and run it on your Newton with no risk of data loss.

10 REM GETROOT().userConfiguration Example
20 rootFrame := GETGLOBALS().userConfiguration
30 rootElements := ELEMENTS(rootFrame)
40 numElements = LENGTH(rootElements)-1
50 FOR i = 0 TO numElements
60 PRINT rootElements[i]
70 NEXT i

There are several built-in functions that are not documented in this 
handbook that my be used in NS BASIC.

Warning: Many of the built-in functions are not documented. Others may 
freeze your Newton. Do not try to use any function you do not understand. 
Be aware that the use of these functions may cause data loss. Not all 
Newton devices may have the same built-in functions.