Home > Articles > Operating Systems, Server > MAC OS X/Other

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Running Classic Applications

The first time that you launch a Classic application, you'll notice that several interesting things happen. Things don't quite match, as you can see in Figure 4.9. The graphing calculator window is shown using the Classic platinum appearance, and the Apple menu is back, but the rest of the screen contains Mac OS X elements such as windows and the Dock!

Visually, Classic applications look just as they would under Mac OS 8 and 9. The Aqua appearance does not carry over to the windows, buttons, and other interface elements.

The Dock and process manager both recognize Classic applications. The Dock will show the older applications' icons, just as if they were native Mac OS X applications. Figure 4.10 shows the process manager (Command+Option+Escape) with several Classic applications listed.

TIP

A glaring visual difference when running most Classic applications is the quality of the icons in the Dock. You'll be pleased to know that you can paste high-quality OS X icons onto Classic apps. Chapter 3, "The Finder: Working with Files and Applications," covers this process.

If you use the process manager to force quit a Classic application, you should follow up immediately by saving your open documents (within Classic apps) and restarting the environment. This is another area in which Classic has not benefited from the advanced features of Mac OS X. A force quit within Classic is identical to a force quit in Mac OS 8 and 9. At best, it will work and leave your Classic system usable and slightly less stable. At worst, it will immediately crash all running Classic software.

Figure 4.9 Classic looks a little weird.

Figure 4.10 The Force Quit process manager lists Classic applications along with native apps.

Usability Issues and Anomalies

Classic is largely usable without any need for knowledge of how it interacts with Mac OS X. You continue to use programs in a manner that is identical to System 9.x. There are, however, a few exceptions that might be confusing for you:

  • Copy and Paste/Drag and Drop--Two of the most common means of moving data within Mac OS suffer when working between native and Classic applications. Data copied from one environment can take several seconds before it is available for pasting within another. Dragging and dropping text and images between native and Classic applications fails altogether.

  • Desktop pictures and patterns-- Mac OS X has its desktop background, but that doesn't mean Classic won't load its own. You will encounter instances when the screen does not refresh correctly and there are "holes" in the Mac OS X desktop that reveal the 9.x background image underneath. This is not a serious problem and can be ignored.

  • Favorites--Although Favorites are available in the OS 9.x environment, they do not transfer between Classic and Mac OS X.

  • Mac OS 9 Desktop--A Mac OS 9 Desktop folder alias is one of the default icons at the top level of your Mac OS X drive. This alias is specific to Mac OS 9 when it is booted directly. It does not apply to the Classic environment. When using Classic, items that are saved to the Desktop will appear, as expected, in the Mac OS X desktop.

  • Open/Save dialog boxes--Mac OS X applications are aware of the special folders and files used by the system and take care to hide them. The same cannot be said for Classic apps. The Open and Save dialog boxes often (but not always) show the invisible items. Although it's harmless, this is probably not the best way for a new user to be introduced to Macintosh software.

  • Printing--Printing services from Mac OS X are extended to Mac OS 9.x. If you intend to print from within the Classic environment, you should configure your printer through Mac OS X. If the printer does not work under Mac OS X, you can configure it directly in Classic--but even this is not guaranteed to produce the desired results.

Users who are expecting a completely seamless work environment might be disappointed by these shortcomings, but many of them can be overcome through additional software or by working within the BSD subsystem, described in Chapter 12, "Introducting the BSD Subsystem."

Integrating Mac OS X and Mac OS 9

In order to better integrate the Mac OS 9 and Mac OS X environments, Apple has added the ability to provide separate Classic settings folders for each user. This goes a long way toward making Classic usable in a school or lab setting, but does not fully integrate features (such as the Desktop) between Mac OS X and Classic. To do that, we'll make a few modifications of our own.

Individual User Preferences

A big problem with the first version of the Classic environment was the inability for each user to have his own settings, such as application preferences. In Mac OS X 10.2, Apple solved the problem by adding the Use Preferences from Home Folder option to the Classic panel's Advanced tab. This setting, when active, places separate copies of the Preferences, Favorites, Internet Search, Apple Menu Items, Launcher, Shutdown Items, and Startup Items folders into ~/Library/Classic.

When Classic boots, these items are copied to the Mac OS 9 system folder and used for the duration of the session. From the user's perspective, they have their own customized Classic environment.

TIP

The first time you start Classic after activating this feature, it will ask if you want to copy the current contents of the corresponding folders from within your Mac OS 9 installation into the user's Classic folder, or leave it empty. If you want each user to be able to customize their environment completely, choose Empty. If you'd like to create a standardized environment for each, you should run Mac OS 9 directly first, set it up as you want, and then, when starting Classic, have your users use the Copy option to copy the default configuration to their account.

Shared Folders

Even though Mac OS X provides a means for each user to have his or her own Mac OS 9 preferences, it makes no attempt to link similar information between Mac OS X and Mac OS 9. For the cases of both the Desktop folder and the Favorites folder, it is possible to create unified shared folders that store the same data, no matter where you are in the operating system. As with many modifications to the base Mac OS installation, there are drawbacks to doing this, so proceed at your own risk.

CAUTION

Much of the following information should be used only if you are comfortable with potentially disrupting the functionality of your computer--to be clear, it is a hack. Even though these tips are not expected to cause any problems with Mac OS X now, Apple might make future changes that eliminate the usefulness of this information or introduce system errors.

To create a shared folder, you must use the Unix equivalent of the Mac OS alias command--that is, ln -s. The ln or link command creates a link between a filename and a real file on your system. For example, if you have a directory named My Data that you also want to be able to access from the folder named My Files, you could use the following command within the Terminal application (path: /Applications/Utilities):

ln -s "My Data" "My Files"

There are two ways that this can be applied within Mac OS X. You can link files from Mac OS 9.x to Mac OS X, or in the reverse direction. Unfortunately, Mac OS 9 does not understand Mac OS X links unless they are being used in the Classic environment. This provides some limitations on how complex you can be with your links.

TIP

These instructions do not require an understanding of the command line, but some readers might prefer to refer to "Introduction to BSD" in Chapter 12 before continuing.

Mac OS 9 to Mac OS X Linking

To create a desktop that is shared between Mac OS 9.x (when running directly) and Mac OS X, you can link the 9.2 Desktop folder into the Desktop folder in your home directory. Any files you store on your desktop in 9.2 will automatically be a part of the Mac OS X environment as well, and vice versa. After creating this link, you can completely do away with the Desktop (Mac OS 9) alias that is placed on your OS X drive.

You must first make sure that your Mac OS X desktop is empty. Drag any files within the desktop to your home directory. Next, determine the path of your OS 9.x Desktop folder. If you've installed on a two-partition system, the folder will be something similar to /Volumes/Mac OS 9.x/Desktop Folder; single-partition systems will always be /Desktop Folder. A quick way to check the desktop folder's path is to use the Finder's Get Info command while the Desktop (Mac OS 9) alias is selected.

From within a terminal window, use the following commands to set up the link (replacing the appropriate portions with the path you've determined):

  1. cd ~/--First, change to your home directory.

  2. rmdir Desktop--Next, remove the existing Mac OS X desktop. If your Desktop folder is not empty, this command will fail. To permanently remove the Desktop folder and its contents, use rm -r Desktop instead.

  3. ln -s <Path to your 9.2 Desktop Folder> Desktop--Finally, create the link from your Mac OS 9.x Desktop folder to the Desktop folder in your home directory.

This same procedure can be used to link other folders, such as the Favorites folder, to your Mac OS X Favorites (~/Library/Favorites). Unfortunately, if multiple users are using the system, they'll all end up with the same desktop and the same Favorites folder. Obviously, this isn't the most desirable effect.

TIP

The link command works on any file (not just directories/folders), but it can often be replaced simply by using Finder aliases. For example, if you'd like to use the same bookmark file in Mac OS X's Internet Explorer as in IE on 9.2, you can create an alias from the bookmarks in 9.2 to their location in OS X (~/Library/Preferences/Explorer). Test both the ln and alias approaches. Each uses a different method to locate the original file, but both generally work.

Mac OS X to Mac OS 9 Linking

To turn the tables around a bit, instead of altering the Mac OS X file system, you can change Classic's Mac OS 9.x. This requires the use of ln to link folders from Mac OS X back into your OS 9 installation each time you log in. Doing so enables such nifty tricks as creating a Favorites folder that is unique for every user on the Mac OS X system, and that, unlike the default, is shared between Classic and Mac OS X. Because Mac OS X links are recognized by System 9.x only when it is running within Classic, this technique might produce undesirable results when booting directly into Mac OS 9.x. If your only exposure to Mac OS 9 is from within Classic, this produces the most seamless link between the environments.

NOTE

The following trick should not be used with Apple's option to use preferences from each user's home folder. It is a different means of accomplishing a similar result, but, at the same time, bridges the Mac OS X and 9 environments--whereas Apple's solution keeps them separate.

What we're attempting to do now is slightly more complex than creating a single link. Our example will focus on the Favorites folder. To make a link work on a per-user basis, we need to create a simple script that

  • Starts up when a user logs in

  • Deletes the current link to Favorites within Classic's 9.x installation

  • Establishes a new link from the current user's Favorites folder to Classic

To do this, a shell script must be created and then set to launch via the Login System Preferences panel. Shell scripts provide a means of controlling the BSD subsystem that lies beneath Mac OS X. You'll learn how to create your own shell scripts in Chapter 18, "Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)."

To create a linked Favorites script, you'll need to navigate your Mac OS 9.x installation (from within Mac OS X), and determine the path to the Favorites folder (it should be directly inside the Mac OS 9.x folder).

Next, open a text editor such as TextEdit (path: /Applications/TextEdit) and enter the following lines (without the line numbers):

1: #!/bin/sh
2: FAVORITES="/Volumes/Mac OS 9.x/System Folder/Favorites"
3: rm -r $FAVORITES
4: ln -s ~/Library/Favorites $FAVORITES

There are only four lines in this simple script. Line 1 provides the path to the shell that will be used to interpret the script. This essentially tells the system what application can run the little program we've written. Line 2 sets a variable to the location of the Favorites folder within Mac OS 9.x. The sample script assumes a dual volume/partition setup; you might have to adjust this path accordingly.

Line 3 removes the existing Favorites link within the Classic System folder. Finally, line 4 re-creates a new link from the current user's folder to the Classic System Folder.

Save the file anywhere you'd like with the name setfavorites.command. If you want all users to have access to the script, save it outside your home directory. Because the script does not hard-code a particular user's name, any user can use it to link her Favorites folder to Classic.

NOTE

It is assumed that you are using a standalone Mac OS X installation. If you are using a clustered configuration or are not the administrator of the machine, you will need to check with the system administrator before continuing.

Saving the script with the filename extension .command enables Mac OS X to determine that the file isn't just another text file; rather, it is a shell script. When a .command file is double-clicked, it automatically launches the Terminal application, which then executes the file.

If you attempt to run the file manually, the Terminal launches, but the execution will fail, as shown in Figure 4.11.

Figure 4.11 The script will fail unless execute permissions are set.

One final step is needed to turn the script you entered into a executable program: setting execution permission. You will need to open a Terminal window manually for this step and enter the following command (using the appropriate path, of course):

chmod +x <Path to the .command file you created>

Any user who runs the command file will instantly have his OS X and OS 9.x Favorites folders linked together.

We're not quite done yet. Convincing a user to run an application each time he logs in is usually impossible. Creating a truly seamless environment requires that the system automatically run the script file each time a user logs in to the system. The Login System Preferences panel can automate this process for you.

Automating Scripts Using the Login Panel

To set a script (or any double-clickable application or document) to launch when you first log in to Mac OS X, open the System Preferences application and click the Login Items icon. The panel shown in Figure 4.12 will appear.

Figure 4.12 Automate script startup using the Login System Preferences panel.

The Login Items window contains a list of applications that are automatically executed when you log in. To add to the list, use the Add button to browse the file system and choose an item. Alternatively, you can drag the file to launch from a Finder window directly into the list. Remove entries in the list by highlighting them and clicking the Remove button.

If there are multiple applications that must start, you can change the order in which they execute by dragging the lines up and down within the listing. The command files that you create should be located near the top of the list.

Finally, click the Hide check box in front of the .command script file so that it is hidden as it executes. Your system is now set up to automatically link the Favorites folders at login time.

NOTE

This process is almost completely transparent, except for starting and hiding the Terminal application. When the script is finished executing, the terminal remains active. One simple way to get around this is to kill the terminal at the end of the script. Although the specifics won't be covered until later in the book, you can include the following line at the end of any script to be able to quit the Terminal application after a script has finished executing:

killall -9 Terminal

PDF Printing

If you find yourself in the position of having a working printer under Mac OS X, but no print solution from within Classic, there is a reasonably simple way to transfer your print jobs from Classic into OS X.

Mac OS X uses the Portable Document Format (PDF) as its display language. Without any additional software, OS X can read, create, and print PDF files. This capability can be exploited by the Mac OS 9.x Classic environment and provides a convenient and efficient way to transfer documents between the two environments.

If you're lucky enough to have a copy of Adobe Acrobat, you can use the included PDF printer software to create high-quality PDF files that are readable on Mac OS X. If your budget is limited, the standalone product PrintToPDF performs the same function at a fraction of the price ($20). You can download PrintToPDF from http://www.jwwalker.com/pages/pdf.html.

After downloading, drag the PrintToPDF icon into Mac OS 9.x's System Extensions folder. This will add a new item to the Classic Chooser. You will need to open the Chooser and select the PrintToPDF icon to activate the new driver, as shown in Figure 4.13.

Figure 4.13 PrintToPDF creates documents that Mac OS X can easily open and print.

With PrintToPDF selected in the Chooser, Classic applications will prompt you for a filename when you print from them, allowing you to save a full PDF of your print job. To finish printing, you need only launch the Mac OS X Preview application (path: /Applications/ Preview), open the PDF produced by Classic, and use Print as you normally would. Chapter 10, "Printer and Font Management," covers Mac OS X printer configuration.

TIP

You might find yourself in the opposite situation: Printing works under Classic, but not directly within Mac OS X. If this is the case, you can reverse the process by producing PDFs in Mac OS X and printing them in Classic. Creating PDFs is covered in Chapter 10. You will also need to download Acrobat Reader for Mac OS 9 (free) from Adobe (http://www.adobe.com).

Over time, fixes such as these should become less necessary as the Mac OS X software library grows. If at all possible, you should strive to build a native-only computer. You'll find that application interoperability and reliability are much higher.

  • + Share This
  • 🔖 Save To Your Account