MacJournalist
Registered: 11/12/00
Posts: 529
Loc: Grand Rapids, Michigan, USA
|
The following isn't a rough equivalent, but the exact equivalent: In reply to:
--Open this script in a new Script Editor window.
display dialog "The Finder must quit and will relaunch after the Launch Services rebuild is complete. The rebuild may take several minutes, during which time you should refrain from using any other apps." buttons {"Cancel", "Rebuild LS Database"} default button 2 with icon caution ignoring application responses tell application "Finder" delay 2 quit end tell end ignoring delay 5 tell application "System Events" to set running_applications_ to get name of every application process if running_applications_ contains "Finder" then do shell script "killall Finder" do shell script "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user" tell application "Finder" delay 2 activate end tell tell me to activate display dialog "The Launch Services rebuild is now complete." buttons {"OK"} default button 1 with icon note
Note that for that link to work, and open correctly in Script Editor, you need to be using OS X 10.3 or later. Actually, nevermind, don't bother, as it appears that the forum software will add an http: protocol in front of what needs to be the applescript: protocol. Instead, try selecting the text, then go to the Services menu, and choose Script Editor > Make New AppleScript. Otherwise, you can copy and paste it into a Script Editor document window.
To run the script, just click the green Play button, and follow the on screen prompts. The Finder needs to be quit while we run this, since normally, it's constantly using that database file. Every attempt is made to politely ask the Finder to quit, rather than blatantly killing it, which not only resets the window states to the last synched setting, but can cause a loss of Finder Comments added through the Get Info window, etc. If the Finder hangs, we have no choice but to kill it, but this usually isn't necessary. Note that "helpful" shareware applications such as Panther Cache Cleaner in particular, will blatantly kill the Finder, and moreover, not even bother to do that until after the rebuild is complete (not wise, IMO).
If you want to save the script, choose Save from the File menu, choose Application in the Format pop-up menu, uncheck all Options, and click the Save button.
What this script does is use the 'lsregister' command line tool that's part of the Launch Services framework, to rebuild the Launch Services database from scratch.
For all of you die-hard OS 9 folks out there, feel free to hold down the Command and Option keys before clicking the Play button, if it makes you feel better .
Note that rebuilding the LS database file has consequences. The same can be said for any instance where you delete a file. I would advise you that anytime you use one of those "wonderful" utilities to purge your cache files, that you know exactly which files they're deleting, and what the consequences of deleting those files will be. Not knowing will only cause more confusion in the long run.
For instance, since the latest security update, the Launch Services framework keeps track of a flag for each discovered application on your system, as to whether or not that application has been launched for the first time. Rebuilding the LS cache file, or deleting it, will start you over from scratch. So, you may be warned each time a new application is indirectly launched for the first time, all over again. Anyway, just keep that in mind.
Hope this helps....
------------------------- [This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
_________________________
Dual 2.7 GHz G5, 4.5 GB RAM; 17" MacBook Pro, 2 GB RAM
|