on run
tell application "Finder"
set hostAppl to (container of container of container of (path to me)) as alias
end tell
try
set menuItemScript to load script hostAppl
set menuItemScript's selfRef to hostAppl
tell menuItemScript to someMenuItemHandler()
on error errText number errNr
activate me
"MenuItem Error = " & errNr & return & errText
tell me to display dialog the result buttons {"OK"} default button 1
end try
end run
and in hostAppl:
property selfRef : missing value
on run
set selfRef to (path to me)
-- etc.
end run
And replace all other uses of (path to me) in hostAppl with selfRef.
-Ron Hunsinger