Nov 96 Tips
Volume Number: | | 12
|
Issue Number: | | 11
|
Column Tag: | | Tips & Tidbits
|
Tips & Tidbits
by Steve Sisak
Avoiding Preloads
When you open a resource file, all the resources marked 'preload' are automatically loaded. If the file contains a lot of preload resources, HOpenResFile (or OpenResFile, or FSPOpenResFile) can take a long time, or even fail with an error -108 (not enough memory).
If you do not want preload resources to be loaded when you open a resource file, you should set ResLoad to false before opening the file. For example:
SetResLoad ( false );
refNum = HOpenResFile ( vol, dirID, name, fsRdWrPerm );
SetResLoad ( true );
if ( refNum < 0 )
err = ResError (); // Which error occurred
else {
.... // file was opened correctly
}
- Marshall Clow, Aladdin Systems
mclow@mailhost2.csusm.edu
Using Labels to Organize Yourself
Until several months ago, I had never thought too much of Labels; never used them, pretty much ignored their existence altogether. It was only when I found myself repeatedly re-installing and/or upgrading my system (and thus needing to replace all of my custom files from the old System Folder), that I found a truly blessed purpose for the Finders Labels.
The beauty of Labels is that they provide a generic mechanism for the Finder to aide in the users organization of files. Other customization features like Comments are not so useful in a lot of cases, because there is no intuitive way to quickly use the information to increase efficiency. Thanks to the View by Label feature of the Finder, labels can save the day.
A case where I find this especially useful is in the organization of my System Folder. I will describe a system of Labels which I use to ease the task of keeping track of all the system, custom, and 3rd party files which inevitably find their way into my System Folder.
Assign a unique Finder Label to each of the following categories:
1. System: Files or folders which will be completely re-installed by the Installer in the case of an update or clean System Software install.
2. Custom: Files or folders which were installed or instantiated by some action of the user. Anything which you will want to replicate in your new folder but which the Installer will not create.
3. Contains Custom: For folders which contain some but are not entirely filled with custom files.
Now, go to your System Folder and view by Label. Proceed to label every file and folder with one of these labels. If you have some files which dont fit in these categories, you have 4 additional labels to work with.
Now that this initial time consuming task is out of the way, you are ready to reap the benefits of your effort. Periodically, you can use the System 7.5 Find File to keep your folder up to date. Simply do a Find by Label is None in the System Folder, and adjust the labels as appropriate.
When it comes time to re-install or update, you can View by Label to quickly arrange your files. Drag all Custom items directly to the new folder. Open and repeat for all Contains Custom folders. Ignore all System items, and spend your valuable mental energy only on unlabeled items you may have missed.
This process has taken a lot of the fear and effort out of making drastic changes to my System Folder. If it still sounds like too much work, then my final suggestion will make you smile: Since almost all of the thinking is being done by the Finder, the scriptable Finder can be caused to do almost all of this automatically. With an AppleScript that intelligently traverses the System Folder and does the right thing with the right label, youll almost never need to agonize over them again.
Daniel Jalkut
San Francisco, CA