PRB: Creators and Types Are Reset After Transport to Macintosh

ID: Q114999

2.50b 2.50c 3.00b MACINTOSH

 kbprb

The information in this article applies to:

SYMPTOMS

After you have transported an application from FoxPro for Windows or FoxPro for MS-DOS to FoxPro for Macintosh, the icons, file types, and creators appear to be incorrect for all the files in the application.

NOTE: This behavior does not occur under Visual FoxPro for Macintosh.

CAUSE

The creator, type, and subsequent icon are determined by the application that created the file on the Macintosh. When an application is transported, the creator may become Apple File Exchange or another program instead of FoxPro for Macintosh.

However, using the code example below, you can programmatically change the creator and type for an entire folder of files at a time.

RESOLUTION

The following program will change all files with standard FoxPro extensions, within a single folder, to a creator of "FOXX". Files without standard FoxPro extensions will be ignored.

The code example below uses the FxSetType() function in FOXTOOLS.MLB to change the creator and type for the files. The SYS(2027) syntax returns the filenames in Macintosh notation. Both FxFileType() and FxSetType() require the filename to be specified in Macintosh notation.

   *********************************************************************
   * Begin Code Example
   * Variables used
   * dochange        Logical     Flag to indicate whether to change
   * filetype        Character   New type of file
   * filecreator     Character   FOXX as new creator type
   * i               Numeric     Counter for FOR loop
   * filearray       Array       File information for folder
   * searchfld       Character   Name of folder to search
   * fileext         Character   File extension for comparison
   *********************************************************************

   SET LIBRARY TO foxtools
   filetype = ""
   filecreator = "FOXX"
   dochange = .T.
   searchfld = ""
   fileext = ""

   * Obtain folder name
   searchfld = GETDIR("Folder to search")

   * Create array of filenames in folder
   =ADIR(filearray,searchfld + "*.*")

   * Replace filename if necessary
   FOR i = 1 TO ALEN(filearray,1)
      fileext = RIGHT(filearray(i,1),4)
      dochange = .T.
      DO CASE
         CASE fileext = ".FPT"
         * FoxPro Memo file
              filetype = "F+DT"
         CASE fileext = ".DBF"
         * DBF file
              filetype = "F+DB"
         CASE fileext = ".SCX"
         * screen file
              filetype = "F+FR"
         CASE fileext = ".SCT"
         * screen memo file
              filetype = "FSCT"
         CASE fileext = ".FRX"
              filetype = "F+RP"
         * Report File
         CASE fileext = ".FRT"
              filetype = "FFRT"
         * report memo file
         CASE fileext = ".MNX"
              filetype = "FMNX"
         * menu file
         CASE fileext = ".MNT"
         * menu memo file
              filetype = "FMNX"
         CASE fileext = ".PJX"
         * project file
              filetype = "FPJX"
         CASE fileext = ".PJT"
         * project memo file
              filetype = "FPJT"
         CASE fileext = ".CDX"
         * compound index file
              filetype = "FCDX"
         CASE fileext = ".PRG"
         * program source code
              filetype = "F+PR"
         CASE fileext = ".FXP"
         * compiled .PRG
              filetype = "FFXP"
         CASE fileext = ".QPR"
         * Query program
              filetype = "F+QU"
         CASE fileext = ".APP"
         * compiled application
              filetype = "FAPP"
         CASE fileext = ".SPX"
         * compiled screen program
              filetype = "FSPX"
         CASE fileext = ".MPX"
         * compiled menu program
              filetype = "FMPX"
         OTHERWISE
              dochange = .F.
      ENDCASE
      IF dochange = ;
         FxSetType(SYS(2027,searchfld+filearray(i,1)), ;
               filetype,filecreator)
      ENDIF
   ENDFOR

   * End Code Example
   ************************************************************************

REFERENCES

For more information about FOXTOOLS.MLB, see the FoxTools ReadMe file in the GOODIES:MISC folder.

"Developer's Guide," version 2.5b, pages 402-403

"Language Reference," version 2.5b, pages 868-869

Additional reference words: FoxMac 2.50b 2.50c KBCategory: kbprb KBSubcategory:

Keywords          : kbcode kbprb
Version           : 2.50b 2.50c 3.00b
Platform          : MACINTOSH

Last Reviewed: May 21, 1998