Contents of the FoxPro for Macintosh FoxTools Readme FileID: Q112787 The information in this article applies to:
SUMMARYBelow is the complete FoxPro for Macintosh "FoxTools Readme" file found in the Goodies:Misc folder in the main FoxPro folder (usually FoxPro).
MORE INFORMATION****************************************************************** ******************************************************************
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.
AddBS() Syntax: AddBS(<expC>) The AddBS() function returns the path specified by the parameter <expC>, with a trailing colon. The function will not add the trailing colon if <expC> already has one or is a null string. <expC>
CleanPath()
Syntax: CleanPath(<expC>) On the Macintosh, the function CleanPath() returns the string passed to it. This function is included for cross-platform compatibility with FoxPro for Windows. <expC>
DefaultExt()
Syntax: DefaultExt(<expC1>, <expC2>) If <expC1> does not contain an extension, the DefaultExt() function returns the parameter <expC1> with the extension specified by <expC2> added to the path:filename. If <expC1> contains an extension, then <expC1> is returned unchanged. <expC1> <expC2>
ForceExt()
Syntax: ForceExt(<expC1>, <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> <expC2>
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> <expC2>
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> alert. 0=CAUTION; 1=STOP; 2=NOTE.
<expN2> 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 which 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> 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>] The following table shows the push buttons displayed on each of the
twelve alerts with the default focus push button shown in parentheses.
257 (Continue)
258 (OK)
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> 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,"<path><filename>").
"MacHD:FoxPro:FoxTools"
@<expC2> the function will store the file type.
@<expC3> 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 the keyboard which registered the last keystroke.
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>
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> type and file creator.
<expC2> 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> 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> 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> 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>
JustExt()
Syntax: JustExt(<expC>) The JustExt() function returns the extension of a path:filename passed to the function with <expC>. <expC> 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> 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>
JustStem()
Syntax: JustStem(<expC>) The JustStem() function returns the stem portion of a path:filename passed to the function through the parameter <expC>. <expC> 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> <expN>
will be the initial character returned by NextWord().
[, <expC2>] 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> <expC2>
<expN>
<expC3>
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> [, <expC2>[, <expN>]]
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> <expC2>
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>
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> <expN>
= 3 would return the third word in <expC1> or a null string if <expC1>
contains fewer than three words.
[, <expC2>] 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> [, <expC2>]
delimiter in <expC2>.
Additional reference words: FoxMac 2.50b KBCategory: kbreadme KBSubcategory: |
|
Last Reviewed: May 16, 1996 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |