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

  1. If
  2.  
  3. Example
  4.  
  5. Syntax
  6.  
  7. (<Test> boolean)
  8.  
  9. Description
  10.  
  11. A conditional statement that determines whether a statement (or statement block) is executed.
  12.  
  13. If <Test> is true, the statements between If and Else are executed. If <Test> is false, the statements between Else and EndIf are executed.
  14.  
  15. Else is optional. If <Test> is false and Else is not used, the macro skips the statements between If and EndIf, and executes the first statement after EndIf.
  16.  
  17. EndIf closes an If statement.
  18.  
  19. The general form of an If statement is:
  20.  
  21. If (<Test> )
  22.  
  23. ...statement block...
  24.  
  25. Else
  26.  
  27. ...statement block...
  28.  
  29. EndIf
  30.  
  31. Parameters
  32.  
  33. <Test> boolean    Evaluate to true or false.
  34.  
  35. IfPlatform
  36.  
  37. Example
  38.  
  39. Syntax
  40.  
  41. ([{<PlatformID> enumeration}])
  42.  
  43. Description
  44.  
  45. A conditional statement that specifies a platform or platforms for which subsequent statements are compiled.
  46.  
  47. If the current platform matches one of the specified platforms, the statements between IfPlatform and EndIfPlatform are compiled and executed.
  48.  
  49. EndIfPlatform closes an IfPlatform statement.
  50.  
  51. The general form of an IfPlatform statement is:
  52.  
  53. IfPlatform (<PlatformID> )
  54.  
  55. ...statement block...
  56.  
  57. ElseIfPlatform
  58.  
  59. ...statement block...
  60.  
  61. EndIfPlatform
  62.  
  63. Parameters
  64.  
  65. <PlatformID> enumeration (optional/repeating)    One or more platform identifiers. Separate multiple platforms with a semicolon.
  66.  
  67. If equal, the body of the statements are compiled. If this parameter is missing, the statement body is ignored as if a recognized ID was not specified.
  68.  
  69. This is a compile-time only statement. Use MacroInfo or VersionInfo to get platform type and version numbers at runtime.
  70.  
  71. WIN!
  72.  
  73. Win32!
  74.  
  75. Win95!
  76.  
  77. Win98! This enumeration is recognized if the macro is compiled on a Win98 system.
  78.  
  79. WinNT!
  80.  
  81. _Version9! This enumeration is recognized if the macro is compiled using the PerfectScript version 9 macro system.
  82.  
  83. _Version9_0_0! This enumeration is recognized if the macro is compiled using the Professional PerfectScript version 9 macro system.
  84.  
  85. _Version9_0_1!
  86.  
  87. _Version9_0_3!
  88.  
  89. _Version9_0_4!
  90.  
  91. Win2000! Windows 2000 platform
  92.  
  93. CorelWine! Synonym for Linux in the Linux version of the Suite.
  94.  
  95. Note
  96.  
  97.   This command is not available for use on a Linux operating system.
  98.   
  99. boolean or numeric := value or array IN array
  100.  
  101. boolean or numeric := string IN string
  102.  
  103. Description
  104.  
  105. Operator. Precedence level 6.
  106.  
  107. Examples
  108.  
  109. z := 3 IN {1; 2; 3}
  110.  
  111. Result: z = 3
  112.  
  113. z := 3 IN (1; 2; 4}
  114.  
  115. Result: z = False
  116.  
  117. z := {1; 2; 3} IN {1; 2; 3}
  118.  
  119. Result: z = True
  120.  
  121. z := {1; 2; 3} IN {1; 2; 3; 4}
  122.  
  123. Result: z = True
  124.  
  125. z := {1; 2; 3} IN {1; 2; 4}
  126.  
  127. Result: z = False
  128.  
  129. Return Value (arrays)
  130.  
  131. True if the left operand is contained in the right operand, or False is not. The left operand may be a value or an array. The right operand must be an array.
  132.  
  133. If the left operand is a value equal to one of the elements in the right operand array, True is returned.
  134.  
  135. If the left operand is an array, and every element in the array is equal to some element in the right operand array, True is returned.
  136.  
  137. If the left operand is a simple value, and the right operand is an array, and the left operand is in an element of the array, the index in the array of the left operand value is returned. If the array is a single dimensional array, this index is a direct index into the array. If the array is multidimensional, this is a composite index that represents the index where this value would be found if all elements in the array were laid out in a long single dimensional array in column major order. For example, 12 IN {{1;3;4;7;8};{5;9;2;12;0}} will return 9. It is really at index [2; 4] in a multidimensional array. This array is 2 rows of 5 elements. If this array were laid out as a single dimensional array in column major order, it would look like the array {1;3;4;7;8;5;9;2;12;0}. 12 is at index 9 in this array.
  138.  
  139. Return Value (strings)
  140.  
  141. If the left hand value is not a substring of the right hand value, False is returned. If the left hand value is a substring, the substring index in string is returned (1 based index). This command is case- sensitive. If a case-insensitive comparison is desired, use Toupper on both the left and right values. If the left operand is an empty string, True is returned.
  142.  
  143. Include
  144.  
  145. Example
  146.  
  147. Syntax
  148.  
  149. (<FileName> string)
  150.  
  151. Description
  152.  
  153. Specify a file with executable statements, functions, and/or procedures to include in a macro. The functions and procedures can be called from the macro.
  154.  
  155. Include is a non-executable statement that can occur anywhere in a macro. Include files are automatically compiled with the macro. Return or Quit statements in an Include file end all macro execution. Makesure that the included file is not compiled.
  156.  
  157. Parameters
  158.  
  159. <FileName> string    The path and name of a macro file. You cannot substitute string with a variable.
  160.  
  161. Example
  162.  
  163. // There are two macros in this example
  164.  
  165. // The INCLUDE macro (INC.WCM) is compiled when
  166.  
  167. // you play the MAIN macro (PARENT.WCM)
  168.  
  169. // Demonstrate INCLUDE command
  170.  
  171.  
  172.  
  173. // INCLUDE macro: INC.WCM
  174.  
  175. // Without compiling, save this macro in the macros directory
  176.  
  177. APPLICATION (A1; "WordPerfect"; Default; "EN")
  178.  
  179. Type("2")
  180.  
  181. PROCEDURE TestProc(x)
  182.  
  183. Type(x)
  184.  
  185. ENDPROC
  186.  
  187.  
  188.  
  189. // MAIN macro: PARENT.WCM
  190.  
  191. APPLICATION (A1; "WordPerfect"; Default; "EN")
  192.  
  193. Type("1")
  194.  
  195. INCLUDE("INC.WCM")
  196.  
  197.  
  198.  
  199. Type("3")
  200.  
  201. CALL TestProc(4)
  202.  
  203. QUIT
  204.  
  205. any := Indirect
  206.  
  207. Example
  208.  
  209. Syntax
  210.  
  211. Direct: (<VariableName> string)
  212.  
  213. Indirect: (<VariableName> string) := any
  214.  
  215. Description
  216.  
  217. Create variable and label names out of a combination of character strings and/or numbers. Indirect can also be used on the left hand side of an assignment statement (Indirect(variable) := any).
  218.  
  219. Use Indirect wherever you would use a variable. On the right side of an assignment statement, variable must be declared and initialized before Indirect. You can use Indirect to call a Label, but not to create one.
  220.  
  221. State1 := "Utah"
  222.  
  223. x := Indirect("State" + 1) // x equals "Utah"
  224.  
  225. Variable Example in shorthand notation
  226.  
  227. State1 := "Utah"
  228.  
  229. State2 := "Idaho"
  230.  
  231. State3 := "Arizona"
  232.  
  233. ForNext(Nmbr; 1; 3; 1)
  234.  
  235. Type("State of " + Indirect("State" + Nmbr))
  236.  
  237. HardReturn
  238.  
  239. EndFor
  240.  
  241. Explanation: Types three lines: State of Utah, State of Idaho, and State of Arizona.
  242.  
  243. Label Example
  244.  
  245. ForNext(x; 1; 3; 1)
  246.  
  247. Call(Indirect("Lab" + x))
  248.  
  249. EndFor
  250.  
  251. Quit
  252.  
  253. Label(Lab1)
  254.  
  255. ...statement block...
  256.  
  257. Return
  258.  
  259. Label(Lab2)
  260.  
  261. ...statement block...
  262.  
  263. Return
  264.  
  265. Label(Lab3)
  266.  
  267. ...statement block...
  268.  
  269. Return
  270.  
  271. Explanation: Call three Labels with a single Call statement in a ForNext loop.
  272.  
  273. Return Value
  274.  
  275. The contents of <VariableName>.
  276.  
  277. Parameters
  278.  
  279. <VariableName> string    Character strings and/or numbers are concatenated to form variable and Label names. You cannot use Indirect to create a subroutine name.
  280.  
  281. numeric := Integer
  282.  
  283. Example
  284.  
  285. Syntax 1
  286.  
  287. (Value: numeric)
  288.  
  289. Description 1
  290.  
  291. Return the integer portion of a real number.
  292.  
  293. If Value does not contain an integer, 0 is returned. A negative real number is rounded up to the next integer value, and a positive real number is rounded down.
  294.  
  295. Return Value 1
  296.  
  297. An integer.
  298.  
  299. vInteger := Integer(1.5)
  300.  
  301. Result: vInteger equals 1
  302.  
  303. vResult := Integer(1.77 * 2)
  304.  
  305. Result: vResult equals 3
  306.  
  307. vZero := Integer(.7)
  308.  
  309. Result: vZero equals 0
  310.  
  311. vNegative := Integer(-1.77)
  312.  
  313. Result: vNegative equals -2
  314.  
  315. Parameter 1
  316.  
  317. Value: numeric    A real number.
  318.  
  319. Syntax 2
  320.  
  321. (<Value>: numeric)
  322.  
  323. Description 2
  324.  
  325. Lets you specificy a parameter's type and format. Intever can be used only to pass parameters in calls to OLE automation methods or properties. Integer generates a compile-time error if used outside an OLE automation call.
  326.  
  327. Return Value 2
  328.  
  329. Integer
  330.  
  331. Parameter 2
  332.  
  333. Value: numeric    The value or variable to be converted and passed as a parameter.
  334.  
  335. signed 2 byte numeric := Integer
  336.  
  337. Syntax 2
  338.  
  339. (<Value>: numeric)
  340.  
  341. Description 2
  342.  
  343. Lets you specificy a parameter's type and format. Intever can be used only to pass parameters in calls to OLE automation methods or properties. Integer generates a compile-time error if used outside an OLE automation call.
  344.  
  345. Return Value 2
  346.  
  347. Integer
  348.  
  349. Parameter 2
  350.  
  351. Value: numeric    The value or variable to be converted and passed as a parameter.
  352.  
  353. numeric := Integer
  354.  
  355. Example
  356.  
  357. Syntax
  358.  
  359. (Value: numeric)
  360.  
  361. Description
  362.  
  363. Return the integer portion of a real number.
  364.  
  365. If Value does not contain an integer, 0 is returned. A negative real number is rounded up to the next integer value, and a positive real number is rounded down.
  366.  
  367. Return Value
  368.  
  369. An integer.
  370.  
  371. vInteger := Integer(1.5)
  372.  
  373. Result: vInteger equals 1
  374.  
  375. vResult := Integer(1.77 * 2)
  376.  
  377. Result: vResult equals 3
  378.  
  379. vZero := Integer(.7)
  380.  
  381. Result: vZero equals 0
  382.  
  383. vNegative := Integer(-1.77)
  384.  
  385. Result: vNegative equals -2
  386.  
  387. Parameters
  388.  
  389. Value: numeric    A real number.
  390.  
  391. numeric := IntegerPart
  392.  
  393. Syntax
  394.  
  395. (Value: numeric)
  396.  
  397. Description
  398.  
  399. Return the integer portion of a numeric value (the integer of 3.2 is 3.0).
  400.  
  401. Example
  402.  
  403. vInt := IntegerPart (3.2)
  404.  
  405. Result: vInt = 3.0
  406.  
  407. Return Value
  408.  
  409. Integer portion of a numeric value.
  410.  
  411. Parameters
  412.  
  413. Value: numeric    A fractional number (return integer part of).
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.