Article Preview
Buy Now
| PDF: |
Ask The Experts
Article
Issue: 1.1 (August/September 2002)
Article Description: No description available.
Article Length (in bytes): 8,429
Starting Page Number: 32
RBD Number: 1008
Resource File(s):
1008.sit Updated: Friday, October 17, 2003 at 12:19 PM
Related Web Link(s):
http://www.geocities.com/d_h_l_h/
http://www.freaksw.com/
Known Limitations: None
Excerpt of article text...
Q: In a program I'm writing, I'd like to inlude a menu where the users can add their own AppleScripts and execute them. How can I implement this?
A:
A fully implemented Scripts menu is seemingly involved, but easily implemented through the use of available third party plugins and modules. The two main parts of a Scripts menu are handling the dynamic menu items, and executing the script as it is selected from the menu. To add a little flavor, we can also add icons to the menu title as well as the individual menu items.
Dynamic Menu Items
This portion of the menu is by far the most involved step in creating a working Scripts menu. The idea is to create a menu that can hold a variable number of menu items pointing to scripts. The menu itself will have one menu item called ScriptItem which will have an index value of 0. With this menu instated we can create two properties in the Aplication class; Scripts(-1) as folderitem and ScriptItems as integer. Next we can use the code in the listing to dynamically create the menuitems in the EnableMenuItems event. The code depends on folderitems in the Scripts array that point to the scripts themselves. You can choose how to handle adding those folderitems on your own.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|








