I frequently want to view the contents of a Finder package, but I can’t find any way to set a keyboard shortcut for the “show contents” item available from the Finder’s contextual menu.
I came up with the following script, which asks the Finder to open the folder “Contents” inside the selected package. This isn’t exactly what the Finder does when you “Show Package Contents,” but really it’s more useful since you almost never want to look at the top-level folder which just has the “Contents” folder.
tell application "Finder"
try
set selectedItems to selection
set selectedItem to item 1 of selectedItems as alias
open folder ((selectedItem as string) & "Contents:")
on error
display dialog "You must select a package before running this script."
end try
end tell
It’s very handy if you set up an app-specific keyboard shortcut for the Finder. I’ve got mine set to always show package contents if I press “cmd-opt-O” from the FInder.
When I get the reference to the package without Finder, I get a colon. So this works:
set the_file to (choose file) as string – some package
tell application “Finder”
open folder (the_file & “Contents”)
end tell
for app files that end with .app. If I get the reference to the package with the Finder and coerce to string, I don’t get the colon. So this works:
set the_folder to (path to At Ease applications folder from local domain)
tell application “Finder”
set the_package to some item of the_folder whose name ends with “.app”
open folder ((the_package as string) & “:” & “Contents”)
end tell
I don’t know yet if this means anything regarding your post. I can’t test what’s going on in Panther.