• 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: Showing a Package's Contents - NOT SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Showing a Package's Contents - NOT SOLVED


  • Subject: Re: Showing a Package's Contents - NOT SOLVED
  • From: kai <email@hidden>
  • Date: Sun, 29 May 2005 13:12:06 +0100


On Sunday, May 29, 2005, at 11:50 am, Martin Orpen wrote:

All you need to do is temporarily remove the extension:

set foo to choose file
tell application "Finder"
    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 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

Dunno how useful this is now as the original thread was about looking into
an mbox? On my laptop a Tiger mbox is now an ordinary folder...

That's very neat, Martin. As is so often the case with solutions like this, its simplicity belies the head-banging that preceded the eureka moment. ;-)


Even with folks migrating to Tiger, I've no doubt the technique could prove useful in other situations...

One thing I notice here is that, when a Mail.app folder contains subfolders, Finder usually has a regular folder (containing the relevant subsidiary mboxes) as well as an mbox of the same name. Since simply stripping the mbox's name extension in cases like this will fail (dupFNErr -48: duplicate filename), I'd suggest a small modification that appends an unlikely string to the temporary name - something like this:

-------

set foo to choose file
tell application "Finder"
	set bar to name of foo
	set name of foo to my tempOpen(bar)
	open foo
	set name of foo to bar
end tell

on tempOpen(x)
	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "."
	set x to x's text item 1
	set AppleScript's text item delimiters to oldDelims
	x & " (temp open mbox)"
end tempOpen

-------

---
kai

_______________________________________________
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: 
 >Re: Showing a Package's Contents - NOT SOLVED (From: Martin Orpen <email@hidden>)

  • Prev by Date: Re: Showing a Package's Contents - NOT SOLVED
  • Next by Date: Entourage's "path to me" in Tiger
  • Previous by thread: Re: Showing a Package's Contents - NOT SOLVED
  • Next by thread: Re: Showing a Package's Contents - NOT SOLVED
  • Index(es):
    • Date
    • Thread