Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Fixing "Change All"' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fixing "Change All"
Authored by: Uncle Asad on Mar 13, '08 07:06:44PM
[robg adds: While I could make this script work for files on a one-at-a-time basis, I could not get the Change All solution to work -- regardless of how I specified the app, or set the file's extension, Change All had no effect. Only the selected file was modified to open with vi; a commenter on the queue review site had the same experience. If you know how to resolve that issue, please comment...]

This is because the applet doesn't have a unique bundle identifier or bundle signature ("creator code") by default; when Script Editor saves an Application Bundle (or a PPC-only Application), it uses the dplt (or aplt, for applets that don't handle on open) bundle signature (and does not specify a bundle identifier at all). dplt and aplt are shared with every other applet/droplet on your Mac—not useful for trying to set a default binding to a specific app….

First, make sure you're saving the script as an "Application Bundle" in Script Editor, not an "Application", because you can't fix this problem with an old-school "Application" (and because Applications are PPC-only; who wants to start Rosetta to launch vi on an Intel Mac?!).

The easiest way to fix this is to change the bundle signature in your applet's Info.plist and PkgInfo files to something unique; I used dpVI when verifying this. "Show Package Contents" on your app and open both of those files in a text editor (vi, even!) and find dplt in each file, replace it with dpVI, and save. Finally, move the VI.app out of the Applications folder to the Desktop, and then back in to Applications (to get LaunchServices to pick up your Info.plist changes). The drawback to this change is that every time you open the app in Script Editor to make further changes, you have to dismiss an alert about the app not being scriptable.

You could also (or in addition) add a CFBundleIdentifier key to the Info.plist, something like:

<key>CFBundleIdentifier</key>
<string>com.macosxhints.vi-app</string>
Simply add that with your favorite text editor (or Property List Editor) among the other CFBundle* keys in your Info.plist, save, and repeat the "move the app from the Applications folder" dance to get LaunchServices on board.

If it still doesn't work, be sure to launch the app once manually (by double-clicking) to clear the "you've never run this app before" roadblock, but that roadblock shouldn't be hit by apps built on your own Mac.

[ Reply to This | # ]
Fixing AppleScript apps
Authored by: hayne on Mar 13, '08 08:27:49PM
I wrote a Bash script a while back to fix this kind of issue in AppleScript apps - you can get my script here:
http://hayne.net/MacDev/Bash/fixAppleScriptApp


[ Reply to This | # ]
Fixing "Change All"
Authored by: robg on Mar 17, '08 06:18:03AM

Thanks for explaining the reason for the problem!

-rob.



[ Reply to This | # ]