home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / downloads / 401065 / WPO11 / Data1.cab / _D282F044329B4AC4A4FDA70F5C0A646C < prev    next >
Text File  |  2003-03-07  |  37KB  |  1,564 lines

  1. numeric := Factorial
  2.  
  3. Syntax
  4.  
  5. (Nth: numeric)
  6.  
  7. Description
  8.  
  9. Return the Nth factorial, which is the product of all numbers in a series (1, 1, 2, 5, 24,...) less than or equal to a specified value.
  10.  
  11. Example
  12.  
  13. x = Factorial (5)
  14.  
  15. MessageBox (Caption:"Example"; Message:" Factorial (5) = "+ x; Style:OK!)
  16.  
  17. Return Value
  18.  
  19. Nth factorial.
  20.  
  21. Parameters
  22.  
  23. Nth: numeric    Compute the Nth term in the series.
  24.  
  25. boolean := False
  26.  
  27. Description
  28.  
  29. The constant boolean value FALSE.
  30.  
  31. numeric := Fibonacci
  32.  
  33. Syntax
  34.  
  35. (Nth: numeric)
  36.  
  37. Description
  38.  
  39. Return the Nth term in a Fibonacci sequence (0, 1, 1, 2, 3,...). The Fibonacci is the sum of the preceding two terms in the series.
  40.  
  41. Return Value
  42.  
  43. Nth term in a Fibonacci sequence.
  44.  
  45. Parameters
  46.  
  47. Nth: numeric    Term of the Fibonacci sequence to return.
  48.  
  49. numeric := FileCheckSum
  50.  
  51. Syntax
  52.  
  53. ([Filename: filename]; [Options: enumeration]; [Seed: numeric])
  54.  
  55. Description
  56.  
  57. The command computes a checksum for the contents of a file.
  58.  
  59. Return Value
  60.  
  61. The checksum is computed on the file contents, and returned.
  62.  
  63. Parameters
  64.  
  65. Filename:
  66.  
  67. filename    The file to compute the checksum on. This file is opened as a binary file, and a cumulative checksum is computed on every byte of data in the file.
  68.  
  69. Options:
  70.  
  71. enumeration    The checksum type to compute. Different types of checksums return checksums that are less prone to error than others. If missing, CheckSum32! Is used.
  72.  
  73. CheckSum16! Compute a 16 bit checksum. This is the 16 bit checksum used internally by the PerfectFit shared code. The checksum in the loword of the return value.
  74.  
  75. CheckSum32! Compute a 32 bit checksum. This is the 32 bit checksum used interally by the PerfectFit shared code.
  76.  
  77. CRC_16! Compute a 16 bit checksum based on the CRC 16 polynomial. The checksum in the loword of the return value.
  78.  
  79. CCITT! Compute a 32 bit checksum based on the CCITT polynomial.
  80.  
  81. AUTODIN_II! Compute a checksum based on the AUTODIN_II polynomial.
  82.  
  83. Seed: numeric    A checksum from a previous piece of data that is used as a starting point for the checksum. This allows long streams of data to be computed, by passing the checksum from the previous piece of data into the Seed parameter of a subsequent piece. On the first piece of data, ommit this parameter, or specify as a 0. If missing, an initial seed is used that depends on the value of the Options parameter above.
  84.  
  85. enumeration or numeric := FileConvert
  86.  
  87. Syntax
  88.  
  89. (SourceFilename: string; [SourceFileType: enumeration]; DestinationFilename: string; DestinationFileType: enumeration or numeric)
  90.  
  91. Description
  92.  
  93. Converts a file of one type to a file of another type. The available file types depends on the converters installed by the user. Not all conversions are available on all systems.
  94.  
  95. A file can be converted only to a similar file type (documents to documents, graphics to graphics, and so on).
  96.  
  97. Return Value
  98.  
  99. The common return values indicate the status of the command. Any value not equal to Success! is an error. Other error values are returned as numeric values. Enumeration values have been defined for many of the common error values. The same enumerations are returned from the command as the enumerations returned from the FileConvertError() command. See the return value for that command for the return enumeration types for this command. 
  100.  
  101. DetectDriverMissing! Detection driver unavailable.
  102.  
  103. DiskFull! Out of disk space.
  104.  
  105. DocumentCorrupt! Document appears to be corrupted.
  106.  
  107. EntriesNotConverted! Several entities were not convertible.
  108.  
  109. FileLocked! The file is locked.
  110.  
  111. FileNotSpreadsheet! The file is not a spreadsheet.
  112.  
  113. IgnoringDetectedType! Detected file format is set to be ignored.
  114.  
  115. InAndOutSame! Input and output filenames were the same (they must be different).
  116.  
  117. Incompatible! Destination file type is incompatible with the source file type.
  118.  
  119. IncorrectSourceFormat! Input file is not format specified.
  120.  
  121. InvalidDestination! Invalid destination filename.
  122.  
  123. InvalidDestinationName! Invalid drive/path on output filename.
  124.  
  125. InvalidDestinationSpec! Invalid drive/path on output filespec.
  126.  
  127. InvalidSource! Invalid source filename.
  128.  
  129. InvalidSourceData! Invalid data found in input file.
  130.  
  131. InvalidSourceName! Invalid drive/path on input filename.
  132.  
  133. InvalidSourceSpec! Invalid drive/path on input filespec.
  134.  
  135. NoConvertibleData! No convertible data was received.
  136.  
  137. NoDriver! Conversion driver not available for requested conversion. It may need to be installed.
  138.  
  139. NoFileDescriptors! No available file descriptors.
  140.  
  141. NoGraphicConverter! No graphics converter to call.
  142.  
  143. OutOfFileMemory! Out of file memory
  144.  
  145. OutOfMemory! Out of memory
  146.  
  147. Success! Successful conversion.
  148.  
  149. ThirdPartyError! Unknown error in Third Party Conversion
  150.  
  151. UnknownGraphic! Graphics file type cannot be converted.
  152.  
  153. UnknownType! File type unknown.
  154.  
  155. UnknownTypeDetected! Unknown file format detected.
  156.  
  157. UnknownTypeSpecified! Unknown file format entered.
  158.  
  159. UnsupportedFormat! Unsupported file format detected.
  160.  
  161. Parameters
  162.  
  163. SourceFilename: string    Name of file to convert.
  164.  
  165. SourceFileType: enumeration (optional)    Type of source file to convert. If missing, AutoDetect! is used. Many of the file types returned by the FileType command are valid source file types. Types not listed may be specified as numeric values.
  166.  
  167. AutoDetect! Automatically detects the file type using the FileType command.
  168.  
  169. WordPerfect42!
  170.  
  171. WordPerfect50!
  172.  
  173. WordPerfect51!
  174.  
  175. WordPerfect6789! This the same as the obsolete enumeration WordPerfect678!
  176.  
  177. WordPerfect6x!
  178.  
  179. WordPerfect7!
  180.  
  181. WordPerfect8!
  182.  
  183. WP6xText! This file contains WordPerfect word character text data only. This is not a WordPerfect documnet, but just the text data from a WordPerfect document in word characters.
  184.  
  185. WordPerfectCompound!
  186.  
  187. WPMac31!
  188.  
  189. WordStar70!
  190.  
  191. MSWord55!
  192.  
  193. Word60!
  194.  
  195. Word97!
  196.  
  197. RichTextFormat!
  198.  
  199. AsciiText!
  200.  
  201. AsciiDelimited!
  202.  
  203. AsciiCRLFtoSRT!
  204.  
  205. AnsiText
  206.  
  207. AnsiDelimited!
  208.  
  209. AnsiCRLFtoSRT!
  210.  
  211. AmiPro30!
  212.  
  213. WindowsWrite!
  214.  
  215. WPG1!
  216.  
  217. WPG2!
  218.  
  219. TIFF!
  220.  
  221. WMF!
  222.  
  223. BMP!
  224.  
  225. GIF!
  226.  
  227. JPG!
  228.  
  229. CorelDRAW7!
  230.  
  231. CorelDRAW8!
  232.  
  233. CorelDRAW9!
  234.  
  235. Excel70!
  236.  
  237. Excel97!
  238.  
  239. Lotus123v4!
  240.  
  241. AdobePhotoshop!
  242.  
  243. CorelDRAWClipart!
  244.  
  245. CorelPHOTOPaint7!
  246.  
  247. KodacPhotoCD!
  248.  
  249. PCPaintBrush!
  250.  
  251. QuattroPro6!
  252.  
  253. QuattroPro7!
  254.  
  255. QuattroPro78!
  256.  
  257. QuattroPro8!
  258.  
  259. SDIF!
  260.  
  261. UnicodeText!
  262.  
  263. DestinationFilename: string    Name of the output file.
  264.  
  265. DestinationFileType: enumeration or numeric    Type of file to convert to. These values may change between major releases of PerfectScript. The common file types follow. Types not listed may be specified as numeric values.
  266.  
  267. WordPerfect42!
  268.  
  269. CorelPHOTOPaint7!
  270.  
  271. Lotus123v4!
  272.  
  273. PCPaintBrush!
  274.  
  275. PresentationsShow!
  276.  
  277. SDIF!
  278.  
  279. UnicodeText!
  280.  
  281. WordPerfect9!
  282.  
  283. WordPerfect50!
  284.  
  285. WordPerfect51!
  286.  
  287. WordPerfect6789! This is the same as the obsolete enumeration WordPerfect678!
  288.  
  289. WP6xText! The file contains WordPerfect word character text data only. This is not a WordPerfect document, only text data from a WordPerfect document in word characters.
  290.  
  291. WordPerfectCompound!
  292.  
  293. WordStar70!
  294.  
  295. MSWord55!
  296.  
  297. Word60!
  298.  
  299. Word97!
  300.  
  301. RichTextFormat!
  302.  
  303. AsciiText!
  304.  
  305. AsciiDelimited!
  306.  
  307. AsciiGenericWP!
  308.  
  309. AnsiText
  310.  
  311. AnsiDelimited!
  312.  
  313. AnsiGenericWP!
  314.  
  315. AmiPro30!
  316.  
  317. WindowsWrite!
  318.  
  319. WPG1!
  320.  
  321. WPG2!
  322.  
  323. TIFF!
  324.  
  325. WMF!
  326.  
  327. BMP!
  328.  
  329. GIF!
  330.  
  331. JPG!
  332.  
  333. string := FileConvertError
  334.  
  335. Syntax
  336.  
  337. (ErrorCode: enumeration or numeric)
  338.  
  339. Description
  340.  
  341. Returns the name of a file conversion error.
  342.  
  343. Return Value
  344.  
  345. A value indicating the status of the command. Printable name of the error returned by the FileConvert command. If the return value is not equal to Success!, an error occurred. Enumeration values have been defined for many of the common error values.
  346.  
  347. Parameters
  348.  
  349. ErrorCode: enumeration or numeric    Error code for which to return a name, returned by the FileType command. The more common values follow. Specify other error values as numeric values.
  350.  
  351. InAndOutSame! Input and output filenames were the same (they must be different).
  352.  
  353. NoDriver! Conversion driver not available for requested conversion. It may need to be installed.
  354.  
  355. UnknownType! File type unknown.
  356.  
  357. UnknownGraphic! Graphic file type cannot be converted.
  358.  
  359. InvalidSource! Invalid source filename.
  360.  
  361. InvalidDestination! Invalid destination filename.
  362.  
  363. Incompatible! Destination file type is incompatible with the source file type.
  364.  
  365. Success! Success
  366.  
  367. UnknownTypeSpecified! Unknown file format entered
  368.  
  369. UnknownTypeDetected! Unknown file format detected
  370.  
  371. InvalidSourceSpec! Invalid drive/path on input filespec
  372.  
  373. InvalidSourceName! Invalid drive/path on input filename
  374.  
  375. InvalidDestinationSpec! Invalid drive/path on output filespec
  376.  
  377. InvalidDestinationName! Invalid drive/path on output filename
  378.  
  379. UsupportedFormat! Unsupported file format detected
  380.  
  381. DetectDriverMissing! Detection driver unavailable
  382.  
  383. ThirdPartyError! Unknown error in ThirdParty Conversion
  384.  
  385. OutOfMemory! Out of memory
  386.  
  387. OutOfFileMemory! Out of memory
  388.  
  389. IncorrectSourceFormat! Input file is not format specified
  390.  
  391. FileLocked! The file is locked
  392.  
  393. DiskFull! Out of disk space
  394.  
  395. NoFileDescriptors! No available file descriptors
  396.  
  397. NoGraphicConverter! No graphics converter to call
  398.  
  399. DocumentCorrupt! Document appears to be corrupted
  400.  
  401. IgnoringDetectedType! Detected file format is set to be ignored
  402.  
  403. FileNotSpreadsheet! File is not a spreadsheet
  404.  
  405. EntriesNotConverted! Several Entities were not convertable
  406.  
  407. NoConvertableData! No convertible data was received
  408.  
  409. InvalidSourceData! Invalid data found in input file
  410.  
  411. numeric := FileError
  412.  
  413. Example
  414.  
  415. Description
  416.  
  417. Return the error associated with the last file command.
  418.  
  419. Return Value
  420.  
  421. Returns the error type; The entire return value may be compared to the following enumerations:
  422.  
  423. Success!
  424.  
  425. UnknownError!
  426.  
  427. Error!
  428.  
  429. The following enumerations may be returned in the loword of the return value:
  430.  
  431. AccessDenied!
  432.  
  433. AllocationError!
  434.  
  435. BadFileFormat!
  436.  
  437. CantLockFile!
  438.  
  439. CantOpenFile!
  440.  
  441. DiskFull!
  442.  
  443. FileExists!
  444.  
  445. FileLocked!
  446.  
  447. FileNotFound!
  448.  
  449. FileReadError!
  450.  
  451. InvalidDrivePath!
  452.  
  453. InvalidFileHandle!
  454.  
  455. NoFileHandles!
  456.  
  457. OutOfMemory!
  458.  
  459. string := FileFind
  460.  
  461. Example
  462.  
  463. Syntax
  464.  
  465. ([Filename: string]; [Attributes: enumeration]; [Context: numeric])
  466.  
  467. Description
  468.  
  469. Find a file that matches user-defined search criteria (filename and DOS attributes).
  470.  
  471. Return Value
  472.  
  473. Success!    File found
  474.  
  475. CancelConditionAsserted!    Cancel condition was asserted
  476.  
  477. ErrorConditionAsserted!    Error condition was asserted
  478.  
  479. NotFoundConditionAsserted!    Not Found condition was asserted
  480.  
  481. UserDefinedCondition!    This value defines the base value for assertions of user-defined conditions. See the Assert command for more information about the value of user-defined condition codes.
  482.  
  483. Parameters
  484.  
  485. Filename: string (optional)    Include the full path. If missing, the next matching file is found (see Context below).
  486.  
  487. Attributes: enumeration (optional)    Default: Normal!
  488.  
  489. Normal!
  490.  
  491. ReadOnly!
  492.  
  493. Hidden!
  494.  
  495. System!
  496.  
  497. Label!
  498.  
  499. Directory! In addition to files, directories are also returned. This does not return directories only.
  500.  
  501. Archive!
  502.  
  503. SkipDotDirs! When the attributes include Directory!, "." and ".." directories are skipped and not returned.
  504.  
  505. SearchSubDirs! Search sub-directories for files that match the specified attributes.
  506.  
  507. MatchAnyAttribute! Files are returned that have at least one of the specified attributes. The files may include attributes other than the specified attributes.
  508.  
  509. MinimumAttributes! Files are returned that have all the specified attributes. The files may include attributes other than the specified attributes.
  510.  
  511. ExactAttributes! Files are returned that have all the specified attributes. The files may not include other attributes.
  512.  
  513. Context: numeric (optional)    A user-defined number which identifies the search. Default: 0. To find the next file to match the search criteria, change the context to 1. For example,
  514.  
  515. vFilename = FileFind (Filename: "*.WPD"; Attributes: Normal!; Context: 0)
  516.  
  517. finds the first occurrence of a file with a WPD extension. The following statement finds the next file to match the same search criteria:
  518.  
  519. vFilename = FileFind (Filename: ""; Context: 1)
  520.  
  521. Use different Context values to perform multiple searches simultaneously. If you perform more than one search before the macro ends, you can continue any search by using the appropriate Context value. The subsequent search begins where it left off.
  522.  
  523. boolean := FileFlushData
  524.  
  525. Syntax
  526.  
  527. (FileID: numeric)
  528.  
  529. Description
  530.  
  531. When a file is written to by the FileWrite command, the operating system will sometimes buffer the data and not actually write it to the disk until later. This command flushed the buffered data to the disk, forcing it to be written to the disk.
  532.  
  533. Return Value
  534.  
  535. True if the command was successful. If not, False. If could return False if the FileID parameter does not specify an open file, or if the file is not open for write.
  536.  
  537. Parameters
  538.  
  539. FileID: numeric    The ID of the file to flush the data for. This value is returned fro the FileOpen command.
  540.  
  541. filename := FileGetLongName
  542.  
  543. Syntax
  544.  
  545. ([Filename: filename])
  546.  
  547. Description
  548.  
  549. This command returns the full long name of a filename.
  550.  
  551. Return Value
  552.  
  553. The long filename for a short filename containing the short 8.3 DOS name format.
  554.  
  555. Parameters
  556.  
  557. Filename:
  558.  
  559. filename    The short 8.3 filename form  of the file.
  560.  
  561. filename := FileGetShortName
  562.  
  563. Syntax
  564.  
  565. ([Filename: filename])
  566.  
  567. Description
  568.  
  569. This command returns the short 8.3 DOS form of a filename.
  570.  
  571. Return Value
  572.  
  573. The short filename for a long filename containing the long name format.
  574.  
  575. Parameters
  576.  
  577. Filename:
  578.  
  579. filename    The long filename form  of the file.
  580.  
  581. boolean := FileIsEOF
  582.  
  583. Example
  584.  
  585. Syntax
  586.  
  587. (FileID: numeric)
  588.  
  589. Description
  590.  
  591. Return True if the insertion point is at the end of a file, False if not.
  592.  
  593. The access mode must be Read! (see OpenFile).
  594.  
  595. Return Value
  596.  
  597. True/False.
  598.  
  599. Parameters
  600.  
  601. FileID: numeric    See OpenFile.
  602.  
  603. string := FileNameDialog
  604.  
  605. Syntax
  606.  
  607. ([StyleOptions: enumeration]; [CaptionText: string]; [ButtonText: string]; [InitialFolder: string]; [InitialFileName: string]; [FileTemplate: string]; [RecentFiles: string]; [Separator: string] [;Parent: string])
  608.  
  609. Description
  610.  
  611. Display the Open or Save As dialog. The parent of this dialog is maintained by the macro and is initially set to the application that started the macro. The dialog may be attached to a different application or window by setting a new default parent with the SetDefaultParent command.
  612.  
  613. Return Value
  614.  
  615. The name(s) of the file(s) to open or save, or "" if Cancel is pressed.
  616.  
  617. Parameters
  618.  
  619. StyleOptions: enumeration (optional)    Specifies the type of dialog to open and the options associated with the dialog. Type | between enumerations to combine styles. For example: OpenDialog! | FileMustExist!. If missing, OpenDialog! and PerfectFitDialog! are used.
  620.  
  621. OpenDialog! Display the Open dialog.
  622.  
  623. SaveAsDialog! Display the Save As dialog.
  624.  
  625. DirectoryDialog! The displayed dialog is a directory selection dialog, not a file selection dialog. If FileMustExist! is also specified, the directory must already exist.
  626.  
  627. WindowsDialog! The displayed dialog is the Windows common dialog.
  628.  
  629. EnhancedDialog! The displayed dialog is the Corel PerfectFit Enhanced custom dialog. The EnhancedDialog! Enumeration replaces the PerfectFitDialog! Enumeration.
  630.  
  631. FileMustExist! Use with OpenDialog!. The file selected for Open must exist.
  632.  
  633. MultipleFiles! Allow the selection of multiple files or directories. The return value is a list of files or directories, separated by a string (see Separator parameter below).
  634.  
  635. PromptOnReplace! Use with SaveAsDialog!. If the file already exists, a prompt is displayed asking whether the file should be replaced.
  636.  
  637. CaptionText: string (optional)    Text displayed in the caption bar. If missing or "", Open or Save As is displayed.
  638.  
  639. ButtonText: string (optional)    Text displayed on the Open button. If missing or "", Open is displayed.
  640.  
  641. InitialFolder: string (optional)    Initial folder to display. If missing or "", the current folder is displayed.
  642.  
  643. InitialFileName: string (optional)    Initial filename to display. If missing or "", FileTemplate is displayed.
  644.  
  645. FileTemplate: string (optional)    Template for the files to display. If missing or "", *.* files are displayed.
  646.  
  647. RecentFiles: string (optional)    Name of registry subkey where the recent files list is maintained. For example, "HKEY_CURRENT_USER\Software\..." The list can contain up to fifteen filenames. If missing, no history is given. Include the full Registry path where the recent file list is maintained.
  648.  
  649. Separator: string (optional)    String that separates multiple files or directories. If missing, ";" is used.
  650.  
  651. Parent:
  652.  
  653. string
  654.  
  655. (optional)    Used for setting the parent of the dialog: The parameter is the region name or window handle of the window that is the parent of the file name dialog. If missing, the default parent is determined by the macro system based on the application that started the macro, and if a new default parent has been specified by the SetDefaultParent command. 
  656.  
  657. Example
  658.  
  659. MyFile = FileNameDialog (StyleOptions:MultipleFiles! )
  660.  
  661. MyFileType = (FileType (Filename:MyFile))
  662.  
  663. MessageBox(Message: MyFileType)
  664.  
  665. MessageBox(Message:FileTypeName (FileType:MyFileType))
  666.  
  667. numeric := FilePosition
  668.  
  669. Example
  670.  
  671. Syntax
  672.  
  673. (FileID: numeric; [NewPosition: numeric]; [PositionFrom: enumeration])
  674.  
  675. Description
  676.  
  677. Return the current marker position or set a new position.
  678.  
  679. A user can pre-allocate file size by setting the position marker past the end-of-file marker.
  680.  
  681. Return Value
  682.  
  683. The position of the old position marker, or a negative number if an error occurs.
  684.  
  685. Parameters
  686.  
  687. FileID: numeric    See OpenFile.
  688.  
  689. NewPosition: numeric (optional)    The number of bytes to move the position marker. Default: 0.
  690.  
  691. PositionFrom: enumeration (optional)    Move the position marker relative to one of the following positions. Default: FromBeginning!
  692.  
  693. FromBeginning!
  694.  
  695. FromCurrentPosition!
  696.  
  697. FromEnd!
  698.  
  699. numeric := FileRead
  700.  
  701. Example
  702.  
  703. Syntax
  704.  
  705. (FileID: numeric; Data: variable)
  706.  
  707. Description
  708.  
  709. Read text data from an open file.
  710.  
  711. Return Value
  712.  
  713. The number of bytes read, or a negative number if an error occurs.
  714.  
  715. Parameters
  716.  
  717. FileID: numeric    See OpenFile.
  718.  
  719. Data: variable    Starting from the position marker, one line of data is converted to a WP character string and returned in this variable.
  720.  
  721. numeric := FileSize
  722.  
  723. Example
  724.  
  725. Syntax
  726.  
  727. (Filename: string)
  728.  
  729. Description
  730.  
  731. Return a file's size in bytes.
  732.  
  733. Return Value
  734.  
  735. The file size in bytes, or a negative number if an error occurs.
  736.  
  737. Parameters
  738.  
  739. Filename: string    Include the full path.
  740.  
  741. numeric := FileTruncate
  742.  
  743. Example
  744.  
  745. Syntax
  746.  
  747. (FileID: numeric)
  748.  
  749. Description
  750.  
  751. Remove all text data after the position marker (see FilePosition).
  752.  
  753. Return Value
  754.  
  755. The truncated file size (bytes) if successful, or a negative number if an error occurs.
  756.  
  757. Parameters
  758.  
  759. FileID: numeric    See OpenFile.
  760.  
  761. enumeration or numeric := FileType
  762.  
  763. Syntax
  764.  
  765. (Filename: string)
  766.  
  767. Description
  768.  
  769. Return a file's type; If there is an error in determining file type, several special enumerations are returned to indicate the error.
  770.  
  771. Success! (This value is never returned, but maybe used as a check to determine if an error has occurred. All error enumerations are less than this value.)
  772.  
  773. OpenReadError! (An error occurred opening or reading the file)
  774.  
  775. OutOfMemory! (An out of memory condition occurred)
  776.  
  777. PasswordProtected! (The specified file is password protected)
  778.  
  779.  
  780.  
  781. Return Value
  782.  
  783. Detected file type (get errors from the FileError command). The more common file types are listed below. Since over 200 file types are recognized, those not listed are returned as numeric values. The values returned may change in future releases of PerfectScript.
  784.  
  785. Unknown! (File doesn't exist, or the file type is unknown.)
  786.  
  787. AdobePhotoshop!
  788.  
  789. CorelDRAW8!
  790.  
  791. CorelPHOTOPaint7!
  792.  
  793. KodakPhotoCD!
  794.  
  795. Paradox!
  796.  
  797. PCPaintBrush!
  798.  
  799. PresentationsMaster!
  800.  
  801. PresentationsMaster3!
  802.  
  803. QuattroPro6!
  804.  
  805. QuattroPro78!
  806.  
  807. UnicodeText!
  808.  
  809. XML!
  810.  
  811. Zip!
  812.  
  813. WordPerfect42!
  814.  
  815. WordPerfect50!
  816.  
  817. WordPerfect51!
  818.  
  819. WordPerfect678!
  820.  
  821. WordPerfectCompound!
  822.  
  823. WPMac31!
  824.  
  825. COJava!
  826.  
  827. WordStar70!
  828.  
  829. MSWord55!
  830.  
  831. Word60!
  832.  
  833. Word97!
  834.  
  835. RichTextFormat!
  836.  
  837. AsciiText!
  838.  
  839. AnsiText!
  840.  
  841. AmiPro30!
  842.  
  843. WindowsWrite!
  844.  
  845. HTML!
  846.  
  847. SGML!
  848.  
  849. WPG1!
  850.  
  851. WPG2!
  852.  
  853. TIFF!
  854.  
  855. WMF!
  856.  
  857. BMP!
  858.  
  859. GIF!
  860.  
  861. JPG!
  862.  
  863. CorelDRAW7!
  864.  
  865. CorelDRAW9!
  866.  
  867. Excel70!
  868.  
  869. Excel97!
  870.  
  871. Lotus123v4!
  872.  
  873. PresentationsShow!
  874.  
  875. PresentationsShow3!
  876.  
  877. SDIF!
  878.  
  879. Parameters
  880.  
  881. Filename: string    Name of file to detect.
  882.  
  883. string := FileTypeExtension
  884.  
  885. Syntax
  886.  
  887. (Filetype: enumeration or numeric)
  888.  
  889. Description
  890.  
  891. Return the default filename extension of a file type returned by the FileType command. 
  892.  
  893. Return Value
  894.  
  895. The default filename extension of FileType (usually two or three characters). If FileType does not have an extension, or if you specify an invalid file type, an empty string is returned.
  896.  
  897. Parameters
  898.  
  899. Filetype: Enumeration or numeric    Type of file for which to return the default filename extension. This value is returned by the FileType command. The following list contains some of the possible values for FileType. Types not listed can be specified as numeric values.
  900.  
  901. WordPerfect42!
  902.  
  903. WordPerfect50!
  904.  
  905. WordPerfect51!
  906.  
  907. WordPerfect6789!
  908.  
  909. WordPerfectCompound!
  910.  
  911. WPMac31!
  912.  
  913. COJava!
  914.  
  915. WordStar70!
  916.  
  917. MSWord55!
  918.  
  919. Word60!
  920.  
  921. Word97!
  922.  
  923. RichTextFormat!
  924.  
  925. AsciiText!
  926.  
  927. AnsiText!
  928.  
  929. AmiPro30!
  930.  
  931. WindowsWrite!
  932.  
  933. HTML!
  934.  
  935. SGML!
  936.  
  937. WPG1!
  938.  
  939. WPG2!
  940.  
  941. TIFF!
  942.  
  943. WMF!
  944.  
  945. BMP!
  946.  
  947. GIF!
  948.  
  949. JPG!
  950.  
  951. CorelDRAW7!
  952.  
  953. CorelDRAW9!
  954.  
  955. Excel70!
  956.  
  957. Excel97!
  958.  
  959. Lotus123v4!
  960.  
  961. SDIF!
  962.  
  963. PresentationsShow3!!
  964.  
  965. XML!
  966.  
  967. Zip!
  968.  
  969. array := FileTypeList
  970.  
  971. Syntax
  972.  
  973. (FileType: enumeration)
  974.  
  975. Description
  976.  
  977. Return an array (list) of detected file types.
  978.  
  979. Return Value
  980.  
  981. An array of file type enumerations (the same types returned by the FileType command). Associated names are obtained by passing the file types to the FileTypeName command.
  982.  
  983. Parameters
  984.  
  985. ListType: enumeration    Type of list to obtain.
  986.  
  987. Detect! Detected file types.
  988.  
  989. Source! File types that are recognized as source file types when calling the FileConvert command.
  990.  
  991. Destination! File types that can be destinations when calling the FileConvert command.
  992.  
  993. CorelDRAW9!
  994.  
  995. Notes
  996.  
  997.   In previous versions of PerfectScript, when there was no data to be returned, a single element array with either a numeric value of 0 or a string value of "" was returned. Now, when there is no data to be returned, an empty array is returned.
  998.   
  999.   The Destination! enumeration and the Source! enumeration can not be used together.
  1000.   
  1001. string := FileTypeName
  1002.  
  1003. Syntax
  1004.  
  1005. (FileType: enumeration or numeric)
  1006.  
  1007. Description
  1008.  
  1009. Returns the name of a file type.
  1010.  
  1011. Return Value
  1012.  
  1013. Printable name of the file type returned by the FileType command. If the specified file type is not recognized, an empty string ("") is returned.
  1014.  
  1015. Parameters
  1016.  
  1017. FileType: enumeration or numeric    Type of file for which to return a printable name. This value is returned by the FileType command. The following list contains some of the possible values for FileType. Types not listed can be specified as numeric values.
  1018.  
  1019. WordPerfect42!
  1020.  
  1021. WordPerfect50!
  1022.  
  1023. WordPerfect51!
  1024.  
  1025. WordPerfect6789!
  1026.  
  1027. WordPerfectCompound!
  1028.  
  1029. WPMac31!
  1030.  
  1031. COJava!
  1032.  
  1033. WordStar70!
  1034.  
  1035. MSWord55!
  1036.  
  1037. Word60!
  1038.  
  1039. Word97!
  1040.  
  1041. RichTextFormat!
  1042.  
  1043. AsciiText!
  1044.  
  1045. AnsiText!
  1046.  
  1047. AmiPro30!
  1048.  
  1049. WindowsWrite!
  1050.  
  1051. HTML!
  1052.  
  1053. SGML!
  1054.  
  1055. WPG1!
  1056.  
  1057. WPG2!
  1058.  
  1059. TIFF!
  1060.  
  1061. WMF!
  1062.  
  1063. BMP!
  1064.  
  1065. GIF!
  1066.  
  1067. JPG!
  1068.  
  1069. CorelDRAW7!
  1070.  
  1071. CorelDRAW9!
  1072.  
  1073. Excel70!
  1074.  
  1075. Excel97!
  1076.  
  1077. Lotus123v4!
  1078.  
  1079. SDIF!
  1080.  
  1081. PresentationsShow3!
  1082.  
  1083. XML!
  1084.  
  1085. Zip!
  1086.  
  1087. Example
  1088.  
  1089. MyFile = FileNameDialog (StyleOptions:MultipleFiles! )
  1090.  
  1091. MyFileType = (FileType (Filename:MyFile))
  1092.  
  1093. MessageBox(Message: MyFileType)
  1094.  
  1095. MessageBox(Message:FileTypeName (FileType:MyFileType))
  1096.  
  1097. numeric := FileWrite
  1098.  
  1099. Example
  1100.  
  1101. Syntax
  1102.  
  1103. (FileID: numeric; Data: string; [NewLine: enumeration]; {[ParameterData: string]})
  1104.  
  1105. Description
  1106.  
  1107. Write text data to a file.
  1108.  
  1109. Return Value
  1110.  
  1111. The number of bytes written, or a negative number if an error occurs.
  1112.  
  1113. Parameters
  1114.  
  1115. FileID: numeric    See OpenFile.
  1116.  
  1117. Data: string    Text data is converted to the type specified when the file is opened. A caret (^) followed by a number is replaced by the corresponding character string in the ParameterData parameter. To write a caret, use two carets (^^).
  1118.  
  1119. NewLine: enumeration (optional)    Default: NoNewLine!
  1120.  
  1121. NoNewLine! Inserts an end-of-line marker.
  1122.  
  1123. NewLine!
  1124.  
  1125. FlushData! Force the data to be flushed to the disk after this operation.
  1126.  
  1127. ParameterData: string (optional)    The text data inserted in the data string (see Data parameter). Up to 10 strings separated by semicolons are allowed. Numbering begins with 0. For example,
  1128.  
  1129. FileWrite (FileID; Data: "My friend ^0 is ^1 years old."; NewLine: NewLine!; ParameterData: {"Dan"; "41"})
  1130.  
  1131. writes "My friend Dan is 41 years old." followed by an end-of-line marker.
  1132.  
  1133. enumeration := FileWriteLine
  1134.  
  1135. Syntax
  1136.  
  1137. ([FileID: numeric]; [Options: enumeration])
  1138.  
  1139. Description
  1140.  
  1141. This command will write a blank line to the file specified by the FileID. This is the same as calling FileWrite with an empty string and specifying NewLine! To the NewLine parameter.
  1142.  
  1143. Return Value
  1144.  
  1145. The number of bytes of data written to the file. An enumeration may also be returned. Error! is returned if there was an error writing a blank line to the file.
  1146.  
  1147. Parameters
  1148.  
  1149. FileID:
  1150.  
  1151. numeric    The ID of the file to write an empty line to. This value is returned from the FileOpen command.
  1152.  
  1153. Options: enumeration    Options controlling additional actions performed by this command. If missing, BufferData! Is used.
  1154.  
  1155. BufferData! Allow the operating system to buffer the data.
  1156.  
  1157. FlushData! Force the data to be flushed to the disk after this operation.
  1158.  
  1159. numeric := Floor
  1160.  
  1161. Syntax
  1162.  
  1163. (Value: numeric)
  1164.  
  1165. Description
  1166.  
  1167. Return the largest integer that is less than or equal to a specified value (the floor of a number).
  1168.  
  1169. Example
  1170.  
  1171. x = Floor (5.25)
  1172.  
  1173. MessageBox (Caption:"Example"; Message:" Floor (5.25) = "+ x; Style:OK!)
  1174.  
  1175. Return Value
  1176.  
  1177. Integer.
  1178.  
  1179. Parameters
  1180.  
  1181. Value: numeric    Return the floor of this number.
  1182.  
  1183. For
  1184.  
  1185. Example
  1186.  
  1187. Syntax
  1188.  
  1189. (<ControlVariable> variable; <InitialValue> any; <TerminateExp> boolean; <IncrementExp> any)
  1190.  
  1191. Description
  1192.  
  1193. A control statement (loop) that executes a specified number of times.
  1194.  
  1195. The loop executes only if TerminateExp is true, and continues to execute until ControlVariable's value makes TerminateExp false. EndFor closes a For statement.
  1196.  
  1197. The general form of a For statement is:
  1198.  
  1199. For (<ControlVariable>; <InitialValue>; <TerminateExp>; <IncrementExp>)
  1200.  
  1201. ...statement block...
  1202.  
  1203. EndFor
  1204.  
  1205. For example, the following statement initializes vTest to one, repeats the statement block while vTest is less than ten, and increments vTest by two after each loop.
  1206.  
  1207. For(vTest; 1; vTest < 10; vTest + 2)
  1208.  
  1209. ...statement block...
  1210.  
  1211. EndFor
  1212.  
  1213. Parameters
  1214.  
  1215. ControlVariable: variable    The control variable.
  1216.  
  1217. InitialValue: any    The value assigned to ControlVariable at the start of a loop.
  1218.  
  1219. TerminateExp: boolean    The loop executes while TerminateExp is true.
  1220.  
  1221. IncrementExp: any    The value to increment ControlVariable after each loop.
  1222.  
  1223. ForEach
  1224.  
  1225. Example
  1226.  
  1227. Syntax
  1228.  
  1229. (<ControlVariable> variable; {<ValueList> any})
  1230.  
  1231. Description
  1232.  
  1233. A loop statement that executes a number of times equal to the number of specified expressions.
  1234.  
  1235. ControlVariable is assigned the first value before the first loop; the second value before the second loop; the third value before the third loop; and so forth. The statement block uses the value of ControlVariable to direct macro execution. EndFor closes a ForEach statement.
  1236.  
  1237. The general form of a ForEach statement is:
  1238.  
  1239. ForEach (ControlVariable; {ValueList; ...})
  1240.  
  1241. ...statement block...
  1242.  
  1243. EndFor
  1244.  
  1245. For example, the following statement repeats three times. The variable vTest is initialized to "Apples" before the first loop, to "Oranges" before the second, and to "Bananas" before the third.
  1246.  
  1247. ForEach(vTest; {"Apples"; "Oranges"; "Bananas"})
  1248.  
  1249. ... statement block ...
  1250.  
  1251. EndFor
  1252.  
  1253. Parameters
  1254.  
  1255. <ControlVariable> variable    The control variable.
  1256.  
  1257. <ValueList> any    Variables, arrays, constants, or expressions, enclosed in braces and separated by a semicolon.
  1258.  
  1259. ForNext
  1260.  
  1261. Example
  1262.  
  1263. Syntax
  1264.  
  1265. (<ControlVariable> variable; <InitialValue> any; <FinalValue> any; [<IncrementValue> any])
  1266.  
  1267. Description
  1268.  
  1269. A loop statement that executes a specified number of times.
  1270.  
  1271. The loop executes if ControlVariable is less than or equal to FinalValue, and executes until ControlVariable is greater than FinalValue. If you use a negative value in IncrementValue, the loop executes until ControlVariable is less than FinalValue. EndFor closes a ForNext statement.
  1272.  
  1273. The general form of a ForNext statement is,
  1274.  
  1275. ForNext (<ControlVariable>; <InitialValue>; <FinalValue>; <IncrementValue>)
  1276.  
  1277. ...statement block...
  1278.  
  1279. EndFor
  1280.  
  1281. The following statement initializes vTest to one, repeats the statement block while vTest is less than or equal to five, and increments vTest by two after each loop.
  1282.  
  1283. ForNext(vTest; 1; 5; 2)
  1284.  
  1285. ...statement block...
  1286.  
  1287. EndFor
  1288.  
  1289. Example
  1290.  
  1291. In this example, IncrementValue equals -1 and counts backward:
  1292.  
  1293. ForNext(x;16; 1)
  1294.  
  1295. Prompt(x) Wait(3)
  1296.  
  1297. EndFor
  1298.  
  1299.  
  1300.  
  1301. In this example, IncrementValue equals 1 and counts forward:
  1302.  
  1303. ForNext(x; 1; 16)
  1304.  
  1305. Prompt(x) Wait(3)
  1306.  
  1307. EndFor
  1308.  
  1309. Parameters
  1310.  
  1311. ControlVariable: variable    The control variable.
  1312.  
  1313. InitialValue: any    The value assigned to ControlVariable at the start of a loop.
  1314.  
  1315. FinalValue: any    A variable, constant, or expression. The loop executes while FinalValue is greater than ControlVariable, or less than ControlVariable if IncrementValue is a negative value.
  1316.  
  1317. IncrementValue: any (optional)    The value to increment ControlVariable after each loop. If you do not specify another value, this value will be either 1 or -1, based on the calculation.
  1318.  
  1319. Do not set this value to 0.
  1320.  
  1321. numeric := Fraction
  1322.  
  1323. Example
  1324.  
  1325. Syntax
  1326.  
  1327. (Value: numeric)
  1328.  
  1329. Description
  1330.  
  1331. Return the fractional portion of a real number.
  1332.  
  1333. Return Value
  1334.  
  1335. A fraction.
  1336.  
  1337. vFraction := Fraction(1.5)
  1338.  
  1339. Result: vFraction equals 0.5
  1340.  
  1341. vResult := Fraction(1.77 * 2)
  1342.  
  1343. Result: vResult = 0.54
  1344.  
  1345. Parameters
  1346.  
  1347. Value: numeric    A real number.
  1348.  
  1349. string := FractionStr
  1350.  
  1351. Syntax
  1352.  
  1353. (Value: numeric; [Denominator: numeric]; [Option: enumeration])
  1354.  
  1355. Description
  1356.  
  1357. Return a fraction string representing a value.
  1358.  
  1359. Examples
  1360.  
  1361. vStr := FractionStr (4.5; 0; MixedFraction!)
  1362.  
  1363. Result: vStr = "4 1/2"
  1364.  
  1365. vStr := FractionStr (4.5; 8; MixedFraction!)
  1366.  
  1367. Result: vStr = "4 4/8"
  1368.  
  1369. Return Value
  1370.  
  1371. Fraction string.
  1372.  
  1373. Parameters
  1374.  
  1375. Value: numeric    The numerical value to be converted.
  1376.  
  1377. Denominator: numeric (optional)    The denominator (the nearest fraction using this denominator is returned). If missing, or less than or equal to zero, the nearest denominator is used.
  1378.  
  1379. Option: enumeration (optional)    Specify the fraction form used for values greater than 1. Default: ImproperFraction!
  1380.  
  1381. ImproperFraction! Numerator is larger than the denominator.
  1382.  
  1383. MixedFraction! A whole number, followed by a proper fraction (numerator is smaller than the denominator).
  1384.  
  1385. numeric := FractionalPart
  1386.  
  1387. Syntax
  1388.  
  1389. (Value: numeric)
  1390.  
  1391. Description
  1392.  
  1393. Return the fractional portion of a numeric value.
  1394.  
  1395. Example
  1396.  
  1397. vFrac := FractionalPart (3.2)
  1398.  
  1399. Result: vFrac = 0.2
  1400.  
  1401. Return Value
  1402.  
  1403. Fractional portion of a numeric value.
  1404.  
  1405. Parameters
  1406.  
  1407. Value: numeric    A fractional number.
  1408.  
  1409. Function <Name> label
  1410.  
  1411. Syntax
  1412.  
  1413. ({[<Parameter> any]})
  1414.  
  1415. Description
  1416.  
  1417. Identify a macro subroutine that can receive one or more values from a calling statement. Function also returns a value to the calling statement (caller).
  1418.  
  1419. Functions contain one or more statements that execute when the function is called. Unlike Label statements, functions do not execute unless called. A calling statement consists of the function's name, and can have one or more parameters that pass values to the function. Return, EndFunc, or EndFunction direct macro execution to the statement that follows the function's caller. Return also returns the result of a function operation, or 0 if no result is specified. For example,
  1420.  
  1421. y := 5
  1422.  
  1423. x := Add(y) // calling statement
  1424.  
  1425. Function Add(z)
  1426.  
  1427. z := z + 5
  1428.  
  1429. Return(z)
  1430.  
  1431. EndFunc
  1432.  
  1433. assigns the value 10 to variable x. Add is the name of the function, and y contains a value to pass. Variable z has no value until the function is called, when the value of z is 5 (the value of variable y). The first function statement assigns 10 to variable z. The next statement returns the value of z to the calling statement, which is then assigned to variable x. If the function did not contain a Return statement, or if Return did not return a value, x would be equal to 0.
  1434.  
  1435. Address Mode
  1436.  
  1437. In the above example, the value of y does not change. The function returns the value of z in variable x. To change the value of a variable passed to a function, precede the calling statement parameter and its corresponding function parameter with an ampersand (&). For example,
  1438.  
  1439. y := 5
  1440.  
  1441. x := Add(&y)
  1442.  
  1443. Function Add(&z)
  1444.  
  1445. z = z + 5
  1446.  
  1447. Return(z)
  1448.  
  1449. EndFunc
  1450.  
  1451. assigns the value 10 to both x and y. The ampersand before variable x means the variable's address (location in memory) is passed to the function, not the variable's value. Changes made at the address of x are made to the contents of x.
  1452.  
  1453. Arrays
  1454.  
  1455. You pass arrays to functions the same way you pass variables. If you are passing the entire array, every array element must be assigned a value. If not, a run-time error identifies a reference to the undefined element. For example,
  1456.  
  1457. Declare w[10]
  1458.  
  1459. ForNext(x; 1; 9; 1) // assign only 9 elements
  1460.  
  1461. w[x] = x
  1462.  
  1463. EndFor
  1464.  
  1465. Function Test(z[ ])
  1466.  
  1467. ForNext(x; 1; 10; 1)
  1468.  
  1469. x[z] = x * 10
  1470.  
  1471. EndFor
  1472.  
  1473. Return(z[ ]) // the value of 10 elements returned
  1474.  
  1475. EndFunc
  1476.  
  1477. y[ ] = Test(w[ ]) // 10 elements returned in array y[ ]
  1478.  
  1479. Type(y[10]) // y[10] equals 100
  1480.  
  1481. Type(w[10]) // Run-time error: Undefined variable "W[10]"
  1482.  
  1483. In the previous example, if you precede the calling statement parameter and the corresponding function parameter with an ampersand (&), 100 is returned in w[10]. No run-time error occurs. You are passing the address of array w[ ], not its value. The value is assigned inside the function (see Address Mode above). The two statements look like this:
  1484.  
  1485. Function Test(&z[ ])
  1486.  
  1487. and
  1488.  
  1489. y[ ] = Test(&w[ ])
  1490.  
  1491. Pass the value of an array element, the same way you pass a variable. For example,
  1492.  
  1493. Declare w[10]
  1494.  
  1495. ForNext(x; 1; 10; 1)
  1496.  
  1497. w[x] = x
  1498.  
  1499. EndFor
  1500.  
  1501. Function Test(z)
  1502.  
  1503. z := z * 10
  1504.  
  1505. Return(z)
  1506.  
  1507. EndFunc
  1508.  
  1509. y = Test(w[1])
  1510.  
  1511. Type(y + " - ")
  1512.  
  1513. Type(w[1])
  1514.  
  1515. The value of y equals 10. The value of w[1] equals 1. If you precede the calling statement parameter and the corresponding function parameter with an ampersand (&), the value of y equals 10 and the value of w[1] equals 10. Passing the address of w[1] causes its value to change inside the function. The two statements look like this:
  1516.  
  1517. Function Test(&z)
  1518.  
  1519. and
  1520.  
  1521. y = Test(&w[1])
  1522.  
  1523. The general form of a Function statement is:
  1524.  
  1525. Function <Name> (<Parameter>; <Parameter>; ... <Parameter>)
  1526.  
  1527. ...statement block...
  1528.  
  1529. EndFunc
  1530.  
  1531. The Syntax accepts EndFunc or EndFunction.
  1532.  
  1533. Parameters
  1534.  
  1535. <Name> label    The name of a function. It begins with a letter and consists of one or more letters or numbers.
  1536.  
  1537. {<Parameter> } any (optional)    Receives a value from a calling statement. If an ampersand precedes the calling statement variable, an ampersand must precede the corresponding function variable (see Address Mode above). Multiple variables are separated by a semicolon.
  1538.  
  1539. Function Prototype <Name> label
  1540.  
  1541. Example
  1542.  
  1543. Syntax
  1544.  
  1545. ({[<Parameter> any]})
  1546.  
  1547. Description
  1548.  
  1549. Verify the syntax of a Function statement (see Function).
  1550.  
  1551. If the syntax of a function contained in a Use macro file is incorrect and the function is called from the main macro, you get a run-time error but not a compile-time error. Using Function Prototype at the start of a main macro ensures that you get a compile-time error.
  1552.  
  1553. Parameters
  1554.  
  1555. <Name> label    The name of the function. It begins with a letter and consists of one or more letters or numbers.
  1556.  
  1557. {<Parameter> } any (optional)    Receive a value from a calling statement. If an ampersand precedes the calling statement variable, an ampersand must precede the corresponding function variable (see Address Mode under Function). Multiple variables are separated by a semicolon.
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.