• 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: Luther Fuller <email@hidden>
  • Date: Mon, 14 Jan 2013 15:13:00 -0600

On Jan 14, 2013, at 9:12 AM, I wrote:

There are two distinct problems here.
I've solved one and think I know how to solve the other.

I will let you know about the other problem when I've finished testing it.

I tried what I thought would be a simple fix, but encountered some problems.
The fix isn't simple. Here's how it went …

The Main.app contains, in Contents/Resources/ an application
named "menuItem.app" whose original script was ...

on run
tell application "Finder"
set hostAppl to (container of container of container of (path to me)) as text
end tell
try
launch application hostAppl
tell application hostAppl 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 -----------------------------

The launch application command won't work here because of the 'run' error. (Main.app has a run handler.)
I tried changing the menuItem.app script to …

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
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 -----------------------------

This worked on one of the simpler menu items, but it does not work in general.

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.

The only alternative for a work-around seems to be to copy the handlers I need into menuItem.app and modify them to work properly there.

This is becoming a mess. I hope Apple fixes the launch application bug soon, but I can't afford to wait.



 _______________________________________________
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

  • Follow-Ups:
    • Re: launch broken in Mt Lion
      • From: Shane Stanley <email@hidden>
    • Re: launch broken in Mt Lion
      • From: Ron Hunsinger <email@hidden>
    • Re: launch broken in Mt Lion
      • From: Shane Stanley <email@hidden>
References: 
 >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: splitter group
  • 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