The Labels Suite
Why is There a Label Suite?
Frontier provides two verbs for working with file labels. file.getLabel () and file.setLabel (f, s).
There is no built-in verb for setting a label by 'index', and that can be frustrating at times. If you wish to set the label to the same 'index' on one machine as on another, then various unreliable workarounds are needed, such as using the Finder. I repeat: these workarounds are unreliable. They're also slow, as they require AppleEvents.
This suite uses no AppleEvents: everything happens within Frontier, and it's very fast.
What Is Included In the Suite??
There are four main scripts in the suite, and they are complementary to Frontier's built-in verbs.
labels.getIndex (f) takes any standard Frontier filepath (string, filespec, or alias), gets the label using the standard file.getLabel verb, and looks the index up in a prebuilt table: labels.labelTable.
This script rebuilds the label tables every time it is called, for safety, so it's a little bit slower than labels.getIndexFast ().
labels.getIndexFast (f) is identical to labels.getIndex (), except it only builds labels.labelTable if it isn't already defined. If you want to use this one (perhaps because you have a long list of files to check, and the small speed difference will matter), call labels.utilities.buildLabelTable () first.
labels.setLabel (f, theLabel) takes two arguments. f is any standard Frontier filepath (string, filespec, or alias) or a list of filepaths (!!!), and theLabel is either an index (a number) or a string (label name). If an index is provided, that index is looked up in labels.indexTable. In the end, the standard file.setLabel is called.
This script rebuilds the label tables every time it is called, for safety, but this makes it a little bit slower than labels.setLabelFast ().
labels.setLabelFast (f, theLabel) is identical to labels.setLabel (), except it only builds labels.indexTable if it doesn't already exist. That means that if you have changed your labels since the table was created, then labels.indexTable is out of sync with your system.
You should always call labels.utilities.buildIndexTable () before running this script, which will make certain that the table is in sync with the system.
There is one utility script included, for getting the label data from the system. It's extremely fast, averaging only 7 ticks on my mac. This script is where the magic happens...
Version 1.0 was released on Monday, April 20, 1998 by Seth Dillingham.
Version 1.0b1 worked flawlessly from the very beginning. This version 1.0 is the final release, and no further updates or modifications are planned, ever.
"Don't fix what ain't broke!"
This site built using Frontier 5 with a Macintosh. Last updated Monday, March 29, 1999
Contact Macrobyte Resources with comments or questions.