home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-05 | 2.0 KB | 72 lines | [TEXT/MPS ] |
- #
- # File HierarchicalExample.vu
- #
- # Contains: An example of selecting menuitems which belong to submenus
- # Prerequisite : AppleLink application with Help enabled (should
- # have the help file) should be launched and be the frontmost app.
- # Get rid of the login dialog, either by logging in or Working off
- # line.
- #
- # Conventions: Global variables begin with a capital letter
- #
- # Written by: P Nagarajan
- #
- # Copyright: © 1990 by Apple Computer, Inc., all rights reserved.
- #
- # Change History:
- #
- # 2/21/90 naga creation
- #
-
-
- ####
- # First make sure if the target is configured right
- match[application t:?app_name]!;
- if not (app_name ~= /AppleLink≈/)
- begin
- println "This script will requires Apple Link to be the frontmost application";
- exit;
- end; #check if Apple Link is running
-
- if not (match [menuItem t:'Help' e:true m:[menu o:1]]!)
- begin
- println "Your Apple Link does not have Help installed";
- println "Please try installing Help file into AppleLink folder and try again";
- exit;
- end;# check if Help menuitem is enabled
-
- if (match [window s:dialog o:1]!)
- begin
- if (match[button t:'Work off line' w:[window o:1]]!)
- select [button t:'Work off line' w:[window o:1]]!;
- else
- begin
- println "Sorry cannot get rid of the dialog";
- exit;
- end;
- end; #Check if there is a dialog up on the front(maybe Connect/Login dialog)
-
- ####
- # Now do some menu item selections
- select [menuItem t:'Saving'
- m:[menuItem t:'Working With Memos'
- m:[menuItem t:'Help' m:[menu o:1]]]]!;
-
- ####
- # The following two statements will also work but are not as efficient
- select [menuItem t:'Saving'
- m:[menuItem t:'Working With Memos']]!;
-
- select [menuItem t:'Saving']!;
-
- ####
- # Now some matching:
- match [menuItem t:?item_title
- h:{ [menuItem t:'Introduction'],
- [menuItem t:'Using the personal menu']}]!;
-
- # This match takes a lot of time, since there are a lot of submenus and a lot
- # of item in each. Hence avoid giving the 'h:' trait if possible in your scripts.
- # Here we used it as an illustration of its utility.
-
- println item_title;