• 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: Martin's Package-Opening Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Martin's Package-Opening Script


  • Subject: Re: Martin's Package-Opening Script
  • From: Daniel Jalkut <email@hidden>
  • Date: Tue, 31 May 2005 10:09:31 -0700

As an aside to this - I've noticed that (starting in Tiger?) the "such and such item's folder" command seems smarter. For instance, if you ask the Finder for the folder of a .app application, it returns the bundle's Contents folder.

It also seems to work on Frameworks, though unfortunately, in that case it gives the "Versions" folder when I think it should just give you the root of the bundle.

Daniel

On May 31, 2005, at 6:11 AM, Jonathan Levi, M.D. wrote:

It's very nice -- opens packages of type .mbox, .bundle, .pkg -- in short, probably any package file with a suffix.

Except for application packages -- not the original subject, admittedly, but why not include them, too? But a slight modification of Martin's script solves this:

set foo to choose file
tell application "Finder"
    --following string conversion could also be to Unicode text
    if (foo as string) ends with ".app:" then
        open alias ((foo as string) & "Contents:")
    else
        set bar to name of foo
        set myName to my killExt(bar)
        set name of foo to myName
        open foo
        set name of foo to bar
    end if
end tell

on killExt(x)
    set oldDelims to AppleScript's text item delimiters
    set AppleScript's text item delimiters to "."
    return word 1 of x
    set AppleScript's text item delimiters to oldDelims
end killExt

It still doesn't work with .nib packages, because because choose file stops at the nib's application. Perhaps the "default location" option of choose file may help

Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40red-sweater.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Martin's Package-Opening Script (From: "Jonathan Levi, M.D." <email@hidden>)

  • Prev by Date: Re: Javascript OSA
  • Next by Date: Scripting Mail.app suggestions requested
  • Previous by thread: Martin's Package-Opening Script
  • Next by thread: <no subject>
  • Index(es):
    • Date
    • Thread