Part of Nobumi Iyanaga's website. 6/6/98.

logo picture

Add Shared Menu

OSA Menu by Leonard Rosenthol is a great tool, and we can now add shared menu for any application. However, to add a shared menu, we have to use ResEdit, and some people may find this not very simple.

I wrote a little script (1K to download) (helped by John Delacour and John Baxter) which can add a new shared menu to OSA Menu automatically. Here it is:

on addSharedMenu ()
   local (appPath)
   if not file.getFileDialog ("Locate the application...", @appPath, 'APPL')
   if file.type (appPath) != 'APPL'
   local (OSAMenuPath, theId, theName, temp)
   if not file.getFileDialog ("Locate OSA Menu...", @OSAMenuPath, 'INIT')
   OSAMenuPath = file.getSpecialFolderPath ("", "Extensions", false)
      + "OSA Menu"
   theId = file.creator (appPath)
   theName = file.fileFromPath (appPath)
   rez.getResource (OSAMenuPath, 'OSMs', 128, @temp)
   temp = string (temp)
   pascalNumber = string.length (theName)
   temp = temp + string (theId) + char (pascalNumber) + theName + 
      string.filledString ('x00', 35 - pascalNumber)
   temp = binary (temp)
   setBinaryType (@temp, 'OSMs')
   rez.putResource (OSAMenuPath, 'OSMs', 128, @temp)
   return (theId)

You can store this script anywhere you like.

When you want to add a shared menu to an application that hasn't one, run once this script. Make a new menubar with the creator of the application (if you haven't it, you can get it with the command "print (addSharedMenu ())"). Then restart the machine. Now, you will find your new shared menu working...

I used this script several times without any problem. But as it alters OSMs resource in OSA Menu, please use it AT YOUR OWN RISK!

Return to Frontier Main Page
Go to Home Page

Mail to Nobumi Iyanaga

frontierlogo picture

This page was last built with Frontier on a Macintosh on Sat, Jun 6, 1998 at 20:32:38. Thanks for checking it out! Nobumi Iyanaga