• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: launch broken in Mt Lion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: launch broken in Mt Lion


  • Subject: Re: launch broken in Mt Lion
  • From: Ron Hunsinger <email@hidden>
  • Date: Mon, 14 Jan 2013 14:57:04 -0800


On Jan 14, 2013, at 1:13 PM, Luther Fuller <email@hidden> wrote:

The handler someMenuItemHandler() calls other handlers which contain the line …

set selfRef to (path to me)

but this returns the correct path only if 'me' refers to the hostAppl. But in the script, above, the host code has been moved into menuItem.app and now returns the wrong path. Unfortunately, someMenuItemHandler must also work when called by Main.app, so I can't modify the code in Main.app.

You just need to compute selfRef in the proper context:

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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >launch broken in Mt Lion (From: Luther Fuller <email@hidden>)
 >Re: launch broken in Mt Lion (From: Luther Fuller <email@hidden>)
 >Re: launch broken in Mt Lion (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: launch broken in Mt Lion
  • Next by Date: Re: launch broken in Mt Lion
  • Previous by thread: Re: launch broken in Mt Lion
  • Next by thread: Re: launch broken in Mt Lion
  • Index(es):
    • Date
    • Thread