Microsoft KB Archive/47352

= Double-Clicking Text File Runs Program of Chosen Creator Code =

Article ID: 47352

Article Last Modified on 11/21/2006



This article was previously published under Q47352



SUMMARY
On the Apple Macintosh desktop, double-clicking on a file causes the Finder to run the application that created the file, and the application then loads in the file.

You can change which application runs when you double-click on a file by changing the file's Creator. You can change a file's Creator using QuickBASIC's SetCreate toolbox (MBLC) routine, or using ResEdit, as shown farther below. Normally, this change is appropriate only for files of Type &quot;TEXT&quot; (ASCII only).

To view (or change) the Creator of a file, you can run ResEdit, select the file, and choose Get Info from the File menu. The &quot;Creator&quot; is the four-character code representing the program that created the file. The &quot;Type&quot; is a four-character code describing the save format for a file created under the application. Creator and Type codes are case-sensitive.

Apple's ResEdit program comes with Microsoft QuickBASIC version 1.00 for Apple Macintosh.



How QuickBASIC Assigns the Creator and Type of Files
Microsoft QuickBASIC (b) (binary math) version 1.00 for Apple Macintosh saves all Types of source files with a Creator code of &quot;MSBB&quot;. Microsoft QuickBASIC (d) (decimal math) version 1.00 for Apple Macintosh saves all source files with a Creator code of &quot;MSBA&quot;.

If you double-click a file that has a Creator value of &quot;MSBB&quot; or &quot;MSBA&quot;, the Finder loads Microsoft QuickBASIC (b) or (d), respectively, and then loads the file you double-clicked.

To make a double-clicked text file load itself into a QuickBASIC compiled program and to customize the icons, just look in the README file for QuickBASIC, or search for a separate article with the following words:

Creating and Custom and Icon and BNDL

The following is a table of Creator codes and file Types:   Method of File Creation               Creator Code   File Type ---                 -

Saved in QuickBASIC (b) as Text          MSBB         TEXT Saved in QuickBASIC (b) as Compressed    MSBB         MSBC Saved in QuickBASIC (b) as Protected     MSBB         MSBD Programs compiled in QuickBASIC (b)      MBCB         APPL --  Saved in QuickBASIC (d) as Text           MSBA         TEXT Saved in QuickBASIC (d) as Compressed    MSBA         MSBB Saved in QuickBASIC (d) as Protected     MSBA         MSBP Programs compiled in QuickBASIC (d)      MBCD         APPL --  Random and Sequential access files       (blank)       TEXT created by QuickBASIC programs -- The Open command on the File menu in QuickBASIC displays and opens source files created in that version (decimal or binary) of QuickBASIC, plus all files of Type &quot;TEXT&quot; (regardless of the Creator).

The FILES$(1) function displays files of a given Type (but not of a given Creator). By default, FILES$(1) shows only files of Type &quot;TEXT&quot; and &quot;APPL&quot; For an example, run the following statement PRINT FILES$(1) To see a list of files of all file Types that QuickBASIC (b) makes, type the following:

PRINT FILES$(1,&quot;TEXTAPPLMSBCMSBD&quot;)

Creator and Type Codes for Common Applications
                                Type for      Type for Files Saved Application           Creator  Application      in Application ---           ---  ---

Finder                  MACS       FNDR         Not applicable System                  MACS       ZSYS         Not applicable Mouse (driver)          CDEV       mous         Not applicable Desk accessories        DMOV       DFIL         Not applicable Fonts                   DMOV       FFIL         Not applicable Desktop (a hidden file) ERIK       FNDR         Not applicable Microsoft Word          MSWD       APPL         WDBN (default) TEXT (optional) MacWrite                WORD       APPL         MACA (default) TEXT (optional) WriteNow                nX^n       APPL         nX^d PageMaker 2.0           ALD2       APPL         PUBF Microsoft Excel         XCEL       APPL         XLBN FileMaker Plus          FMKR       APPL         FMKD Cricket Draw            CRDW       APPL         CKDT FullPaint               PANT       APPL         PNTG Graphics Works          MMCB       APPL         CBOK Adobe Illustrator       ARTY       APPL         TEXT MacDraft                MDFT       APPL         DRWG SuperPaint              SPNT       APPL         SPTG Video Works II          MMVW       APPL         VW2P Macintosh Applications, including QuickBASIC and programs compiled in QuickBASIC, usually have the Type &quot;APPL&quot;.

Below are three methods to alter the Creator and Type codes of a file:

Method 1: Change Creator by Resaving in Desired Application
First, run the original application and save a file as &quot;text only.&quot; Then, run the destination application and load the alien text file. If the text file can be loaded, most applications will change the file's Creator field when you save the file. For example, if you create a file in Apple's Edit program and load and save it in Microsoft Word for the Macintosh, that file will then load into Word the next time you double-click it from the desktop.

Note: QuickBASIC's editor should be used only to edit the BASIC language, not non-BASIC text or data. QuickBASIC's editor parses and reformats numbers and statements in text files as if they composed a QuickBASIC program. A subsequent Save writes the reformatted text file.

Method 2: Change Creator with SetCreate
SetCreate, a toolbox (MBLC) routine built into QuickBASIC, can change any file's Creator code as follows: filename$=&quot;myname&quot; creator$=&quot;MSWD&quot;   ' Creator code for Microsoft Word 4.00 SetCreate filename$,creator$ In QuickBASIC, save the above program with a filename of &quot;myname&quot; in Text format (NOT compressed or protected). Run myname, and then exit WITHOUT resaving. When you next double-click myname, it will load into Microsoft Word (if present).

To load the file back into QuickBASIC, run QuickBASIC itself, and reopen the file. Resaving in QuickBASIC changes the Creator back to QuickBASIC (&quot;MSBB&quot; or &quot;MSBA&quot;).

The NAME statement in QuickBASIC can be used to change the file Type (but not the Creator) of any file: filename$=&quot;myname&quot; type$=&quot;TEXT&quot; NAME filename$ AS filename$,type$ However, changing the Type is usually unnecessary.

Method 3: Change Creator in ResEdit
The following steps show how to change a file's Creator (and optionally its Type) in ResEdit:


 * 1) Before changing a file's Creator and Type, determine what Creator and Type you want to substitute. One way to determine this is to first load into ResEdit a file that was created under the destination application. Write down the four-character Creator and Type codes of this file.

For each application there may be different Type codes for different methods of saving (and loading) the file. For example, in Microsoft QuickBASIC, there are three methods of saving files -- text, compressed, and protected. It would be undesirable to change a file with Type &quot;TEXT&quot; to Type &quot;MSBD,&quot; which labels a protected file, or to Type &quot;MSBC,&quot; which labels a compressed file. Normally, you would want to change only file types for files that have the same physical data format in their data fork.
 * 1) Start ResEdit by double-clicking on its icon. ResEdit comes with Microsoft QuickBASIC version 1.00 on the Examples Disk and is located in the Tools folder.
 * 2) Select a file created by the destination application.
 * 3) From ResEdit's File menu, choose Get Info.
 * 4) An Info dialog box should appear and the two fields, Creator and Type, should have four-character codes filled in. Write down at least the Creator code.
 * 5) Close the dialog box.
 * 6) Select the file you want to change.
 * 7) Choose Get Info from the File menu.
 * 8) Change the Creator field to the new four-character code that you had previously written down. You can also change the Type field if the file's data format and new Type coincide with the destination application.
 * 9) Close the dialog window.
 * 10) Select Yes to save the Info for the file.
 * 11) To return to the Desktop, choose Quit from the File menu.
 * 12) Close the Desktop window that contains the name of the file you just changed.
 * 13) Reopen the Desktop window that contains the changed file to see that the information under the Kind field now reflects your changes. (Select By Name or By Kind from the Finder's View menu).

You should now be able to double-click the file to load the corresponding application that you encoded in the Creator field.

Again, if you encounter any problems with changing the ownership of the file, make sure that the file's data format and Type are compatible with the destination application.

Additional query words: MQuickB

Keywords: KB47352

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.