Microsoft KB Archive/120372

{| = Contents of the FPM 2.6a "FoxTools Readme" File =
 * width="100%"|

ID: Q120372

The information in this article applies to:


 * Microsoft FoxPro for Macintosh, version 2.6a

SUMMARY
Below is the complete FoxPro 2.6a for Macintosh "FoxTools Readme" file found in the Goodies:Misc folder in the main FoxPro folder (usually "Microsoft FoxPro 2.6").

MORE INFORMATION


FoxPro for Macintosh FoxTools ReadMe

Microsoft(R) FoxPro(R) for Macintosh(R) and Power Macintosh (TM) Version 2.6a

(C)1994 Microsoft Corporation. All rights reserved. FOXTOOLS is a FoxPro library that exposes Macintosh system functions for use in FoxPro for Macintosh. Functions in the FOXTOOLS library allow you to set and retrieve file information, manipulate paths and filenames, use Macintosh system alerts, and perform many other functions.

When you install FoxPro for Macintosh, FOXTOOLS.MLB is installed in the System Folder:Extensions folder. To use the FOXTOOLS functions, use the command SET LIBRARY TO FOXTOOLS.

FOXTOOLS Functions AddBS

Syntax: AddBS()

The AddBS function returns the path specified by the parameter , with a trailing colon. The function doesn't add the trailing colon if  already has one or is a null string.



Specifies the path. CleanPath Syntax: CleanPath()

On the Macintosh, the function CleanPath returns the string passed to it. This function is included for cross-platform compatibility with FoxPro for Windows.



Specifies the path:filename. DefaultExt Syntax: DefaultExt(, )

If  does not contain an extension, the DefaultExt function returns the parameter  with the extension specified by  added to the path:filename. If  contains an extension, then  is returned unchanged.



Specifies the path:filename to be returned.  Specifies the default extension. ForceExt Syntax: ForceExt(, <expC2>)

The ForceExt function returns <expC1> with the extension changed to the extension specified by the parameter <expC2>. If <expC1> does not have an extension, the new extension is added.

<expC1>

Specifies the path:filename that will get a new extension. <expC2> Specifies the new extension for <expC1>. ForcePath Syntax: ForcePath(<expC1>, <expC2>)

The ForcePath function returns the parameter <expC1> with the path portion changed to the path specified by the parameter <expC2>.

<expC1>

Specifies the path:filename that will get a new path. <expC2> Specifies the new path for <expC1>. FxAlert Syntax: FxAlert(<expN1>, <expN2>, <expN3>, <expN4>[, <expC1>] [, <expC2>][, <expC3>][, <expC4>])

The FxAlert function displays an alert and waits for a user response. One of three icons will be displayed on the alert, based on the type of alert that you specify in <expN1>. FxAlert returns a value representing the user exit action.

<expN1>

Specifies a number that indicates the icon to be displayed on the alert. 0=CAUTION; 1=STOP; 2=NOTE. <expN2>

Specifies the resource number. FOXTOOLS contains the same twelve alerts provided in the FOXUSER file of FoxBASE+ for Macintosh. In FOXTOOLS, the resource numbers are 257 through 268 instead of 1 through 12 as in FoxBASE+ for Macintosh. An alert contains different possible push button combinations that you can choose. For example, resource number 259 contains the push buttons "Yes" and "No" with the focus initially on the "Yes" push button. <expN3>, <expN4>

Specify the coordinates, measured in pixels from the top left of the screen, at which the alert will be placed. Use a value of -1 for <expN3> and/or <expN4> to accept the default position. The default position is centered. [, <expC1>][, <expC2>][, <expC3>][, <expC4>]

Specify text that will appear on the alert. The following table shows the push buttons displayed on each of the twelve alerts with the default focus push button shown in parentheses. Res#  Button 1     Button 2    Button 3   Note 257 (Continue) 258 (OK) 259   (Yes)         No 260     Yes         (No) 261   (Yes)         No         Cancel 262    Yes         (No)        Cancel 263   (Continue)                          Bigger alert than 257 264   (OK)                                Bigger alert than 258 265   (Yes)         No                    Bigger alert than 259 266    Yes         (No)                   Bigger alert than 260 267   (Yes)         No         Cancel     Bigger alert than 261 268    Yes         (No)        Cancel     Bigger alert than 262 FxFileType Syntax: FxFileType(<expC1>, @<expC2>, @<expC3>)

The FxFileType function stores the type of a file to the variable <expC2> and stores the creator of the file to the variable <expC3>. FxFileType returns 0 for no error or returns a Macintosh Operating System error number.

<expC1>

Specifies the path:filename for which you want to obtain the file type and file creator. The path:filename should be a Macintosh path:filename. If you want to use MS-DOS conventions for paths and filenames, you need to convert the path and filename for Macintosh use by using SYS(2027," "). Example: SYS(2027,"MacHD:\FoxPro\FoxTools") will return "MacHD:FoxPro:FoxTools" @<expC2>

Specifies the pre-created variable, passed by reference, to which the function will store the file type. @<expC3>

Specifies the pre-created variable, passed by reference, to which the function will store the file creator. FxGDepth

Syntax: FxGDepth

The FxGDepth function returns the number of colors available with the current graphics device.

FxGVolume

Syntax: FxGVolume

The FxGVolume function returns a list of volume names created by the SET VOLUME command. For example, the following will return "E MacHD:\FoxPro" and any other volume names created by SET VOLUME:

SET VOLUME e TO "MacHD:FoxPro" ?FxGVolume

FxKeyboard

Syntax: FxKeyboard

The FxKeyboard function returns an integer value that indicates the type of keyboard that is currently attached to the system. If the Apple Desktop Bus (ADB) is being used and multiple keyboards are attached, the value returned indicates which keyboard registered the last keystroke.

0 = unable to determine 1 = MacKbd 2 = MacAndPad 3 = MacPlusKbd 4 = ExtADBKbd 5 = StdADBKbd 6 = PrtblADBKbd 7 = PrtblISOKbd 8 = StdISOADBKbd 9 = ExtISOADBKbd 10 = ADBKbdII 11 = ADBISOKbdII 12 = PwrBookADBKbd 13 = PwrBookISOADBKbd FxNewFolder Syntax: FxNewFolder(<expC>)

The FxNewFolder function creates a new folder with the path:foldername specified by the parameter <expC>. FxNewFolder returns 0 for no error or returns a Macintosh Operating System error number.

<expC>

Specifies the path:foldername of the new folder. FxSetType Syntax: FxSetType(<expC1>, <expC2>, <expC3>)

The FxSetType function sets the type and creator of a file. FxSetType returns 0 for no error or returns a Macintosh Operating System error number.

<expC1>

Specifies the path:filename for which you want to set the file type and file creator. <expC2>

Specifies the pre-created variable that contains a value to set the file type. Since the file type is four bytes long, <expC2> should be four characters. Strings longer than four characters are truncated. Strings shorter than four characters are padded with '0'. <expC3>

Specifies the pre-created variable that contains a value to set the file creator. Since the file creator is four bytes long, <expC3> should be four characters. Strings longer than four characters are truncated. Strings shorter than four characters are padded with '0'. FxStripLF

Syntax: FxStripLF(<expC>)

The FxStripLF function opens a file specified by the parameter <expC>, removes all the line feed characters (CHR(10)), and saves the file using its original path:filename. FxStripLF always returns .T., but generates a standard "File Read Error" (#1104) if it cannot read or find the file passed to it by <expC>, or generates a "File Write Error" (#1105) if it cannot save the file.

<expC>

Specifies the path:filename for which you want to remove all the line feed characters. FxSystem

Syntax: FxSystem(<expN>)

The FxSystem function returns the path of the System, Extensions, or Preferences folder on the boot disk, depending on the value of the parameter <expN>.

<expN>

Specifies the folder for which the path is returned: 0=System; 1=Extensions; 2=Preferences. If you do not specify 1 or 2, the default value is 0, so the System Folder path will be returned. FxVolume

Syntax: FxVolume

The FxVolume function returns either a semicolon-delimited list of mounted volume names (hard drives, floppy disks, network connected volumes) or a Macintosh Operating System error number.

JustDrive

Syntax: JustDrive(<expC>)

The JustDrive function returns the drive designation of a path:filename passed to the function with <expC>.

<expC>

Specifies the path:filename. JustExt Syntax: JustExt(<expC>)

The JustExt function returns the extension of a path:filename passed to the function with <expC>.

<expC>

Specifies the path:filename. For example, the following will return "txt": JustExt("MacHD:FoxPro:foxtools.txt")

JustFName

Syntax: JustFName(<expC>)

The JustFName function returns the filename portion of a path:filename passed to the function with <expC>.

<expC>

Specifies the path:filename. For example, the following will return "foxtools.txt": JustFName("MacHD:FoxPro:foxtools.txt")

JustPath

Syntax: JustPath(<expC>)

The JustPath function returns the path portion of a path:filename passed to the function with <expC>.

<expC>

Specifies the path:filename. JustStem Syntax: JustStem(<expC>)

The JustStem function returns the stem portion of a path:filename passed to the function through the parameter <expC>.

<expC>

Specifies the path:filename. For example, the following will return "foxtools": JustStem("MacHD:FoxPro:foxtools.txt")

NextWord

Syntax: NextWord(<expC1>, <expN>[, <expC2>])

The NextWord function returns the characters between the character index specified by <expN> and the following word delimiter (or the end of the string).

<expC1>

Specifies the string. <expN> Specifies the numeric position of the character in the string that will be the initial character returned by NextWord. [, <expC2>]

Specifies the string of word delimiters. If <expC2> is not used, then the default delimiters are assumed to be spaces and tabs. Pict2File

Syntax: Pict2File(<expC1>, <expC2>, <expN>, <expC3>)

The Pict2File function takes a PICT, ICON, or ICN# resource and creates a separate file containing the image. The new file is a PICT type file. Pict2File returns: 0 for no error; -2 for not enough memory to complete the operation; -3 for resource not found; or a Macintosh Operating System error.

<expC1>

The path:filename of the file containing the resource. <expC2> The type of resource to move: "PICT", "ICON" or "ICN#". <expN> The number of the resource to move. <expC3> The path:filename where the new image will be saved. Reduce Syntax: Reduce(<expC1>[, <expC2>[, <expN>]])

The Reduce function reduces multiple white space characters to a single space and trims all leading and trailing white space. If the optional parameter <expN> is non-zero, strings in quotation marks will be unaffected. <expN> can only be used with the optional parameter <expC2>, which specifies the string of word delimiters. Reduce returns the modified string.

<expC1>

Specifies the string to be reduced. [, <expC2>[, <expN>]] <expC2> specifies the string of word delimiters. If <expC2> is not used, then the default delimiters are assumed to be spaces and tabs. When <expN> is 0, Reduce will process strings inside quotation marks. The use of <expN> requires the use of <expC2>. StrFilter

Syntax: StrFilter(<expC1>, <expC2>)

StrFilter removes all the characters from <expC1> that are not in <expC2>. StrFilter returns all the characters in <expC1> that are also included in <expC2>.

<expC1>

Specifies the string to be filtered. <expC2> Specifies the characters that are valid for <expC1>. Characters included in <expC2> are not filtered from <expC1>. ValidPath

Syntax: ValidPath(<expC>)

On the Macintosh, the ValidPath function always returns .T. regardless of the path passed to it. This function is included in FoxTools for cross-platform compatibility with FoxPro for Windows.

<expC>

Specifies the path:filename. WordNum Syntax: WordNum(<expC1>, <expN>[, <expC2>])

The WordNum function returns the specified word in the string <expC1>. The words are delimited by the optional parameter <expC2>. If <expC2> is not included, WordNum assumes that words are delimited by spaces and tabs.

<expC1>

Specifies the string of words. <expN> Specifies the numeric position of the word to be returned. <expN> = 3 would return the third word in <expC1> or a null string if <expC1> contains fewer than three words. [, <expC2>]

Specifies the string of word delimiters. If <expC2> is not used, then the default delimiters are assumed to be spaces and tabs. Words

Syntax: Words(<expC1>[, <expC2>])

The Words function counts the number of words in a string. Words are delimited by the optional parameter <expC2>. If <expC2> is not supplied, then words are delimited by spaces and tabs. Words returns the number of words in <expC1>.

<expC1>

Specifies the string of words to be counted. [, <expC2>] Specifies the word delimiters. You can include more than one delimiter in <expC2>. **End of Readme** Additional reference words: FoxMac 2.60a KBCategory: kbreadme kbprg KBSubcategory:
 * }