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

  1. PerfectScript Macros Help
  2.  
  3. Click the Help Topics button to return to the list of topics.
  4.  
  5. PerfectScript Macro Commands List
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.     ~
  14.  
  15.     **
  16.  
  17.     *
  18.  
  19.     /
  20.  
  21.     %
  22.  
  23.     +
  24.  
  25.     +
  26.  
  27.     -
  28.  
  29.     -
  30.  
  31.     <<
  32.  
  33.     >>
  34.  
  35.     <<<
  36.  
  37.     >>>
  38.  
  39.     =
  40.  
  41.     <>
  42.  
  43.     !=
  44.  
  45.     <
  46.  
  47.     <=
  48.  
  49.     >
  50.  
  51.     >=
  52.  
  53.     &
  54.  
  55.     &
  56.  
  57.     |
  58.  
  59.     ^
  60.  
  61.     :=
  62.  
  63.     =
  64.  
  65.     ; 
  66.  
  67.     . 
  68.  
  69.     .. 
  70.  
  71.     .. 
  72.  
  73.     [ ]
  74.  
  75.     [0]
  76.  
  77.     { } 
  78.  
  79.     { } 
  80.  
  81.     ( ) 
  82.  
  83.     ( ) 
  84.  
  85.     ' ' 
  86.  
  87.     " "
  88.  
  89.     "
  90.  
  91.     ! 
  92.  
  93.     @ 
  94.  
  95.     : 
  96.  
  97.     : 
  98.  
  99.     b 
  100.  
  101.     o 
  102.  
  103.     x 
  104.  
  105.     h 
  106.  
  107.     w 
  108.  
  109.     c 
  110.  
  111.     m 
  112.  
  113.     i 
  114.  
  115.     p 
  116.  
  117.     //
  118.  
  119.     /* */
  120.  
  121.  
  122.  
  123. A
  124.  
  125.     AbsVal
  126.  
  127.     acos
  128.  
  129.     acosh
  130.  
  131.     Address
  132.  
  133.     Amortize
  134.  
  135.     AND
  136.  
  137.     Animate 
  138.  
  139.     AnsiString
  140.  
  141.     AppActivate
  142.  
  143.     AppClose
  144.  
  145.     AppExecute
  146.  
  147.     Application
  148.  
  149.     AppLocate
  150.  
  151.     AppShow
  152.  
  153.     asin
  154.  
  155.     asinh
  156.  
  157.     Assert
  158.  
  159.     atan
  160.  
  161.     atan2
  162.  
  163.     atanh
  164.  
  165.     Average
  166.  
  167.  
  168.  
  169. B
  170.  
  171.     Beep
  172.  
  173.     BinaryPack
  174.  
  175.     BinaryUnPack
  176.  
  177.     Break
  178.  
  179.  
  180.  
  181. C
  182.  
  183.     Call
  184.  
  185.     Call
  186.  
  187.     Callback Data Description
  188.  
  189.     CallbackResume
  190.  
  191.     CallbackWait
  192.  
  193.     Cancel
  194.  
  195.     Case
  196.  
  197.     Case Call
  198.  
  199.     CaseOf:
  200.  
  201.     Ceiling
  202.  
  203.     Chain
  204.  
  205.     CharLen
  206.  
  207.     CharPos
  208.  
  209.     CheckSum
  210.  
  211.     CloseFile
  212.  
  213.     Condition
  214.  
  215.     Constant
  216.  
  217.     Constants
  218.  
  219.     Continue
  220.  
  221.     ConvertType
  222.  
  223.     CopyFile
  224.  
  225.     cos
  226.  
  227.     cosh
  228.  
  229.     CreateDirectory
  230.  
  231.     CreateObject
  232.  
  233.     CToN
  234.  
  235.     CubeRoot
  236.  
  237.  
  238.  
  239. D
  240.  
  241.     DateAddDays
  242.  
  243.     DateAddMonths
  244.  
  245.     DateAddWeeks
  246.  
  247.     DateAddYears
  248.  
  249.     DateAndTime
  250.  
  251.     DateDay
  252.  
  253.     DateDayOfYear
  254.  
  255.     DateDaysInMonth
  256.  
  257.     DateDaysInYear
  258.  
  259.     DateIsLeapYear
  260.  
  261.     DateMonth
  262.  
  263.     DateMonthName
  264.  
  265.     DateOfMonthEnd
  266.  
  267.     DateOfNthDay
  268.  
  269.     DateOfNthWeek
  270.  
  271.     DateOfNthWeekday
  272.  
  273.     DatePart
  274.  
  275.     DateString
  276.  
  277.     DateWeekday
  278.  
  279.     DateWeekdayName
  280.  
  281.     DateWeekOfYear
  282.  
  283.     DateYear
  284.  
  285.     DDEExecute
  286.  
  287.     DDEInitiate
  288.  
  289.     DDEPoke
  290.  
  291.     DDERequest
  292.  
  293.     DDETerminate
  294.  
  295.     DDETerminateAll
  296.  
  297.     Declare
  298.  
  299.     Default:
  300.  
  301.     DefaultUnits
  302.  
  303.     DegreesToRadians
  304.  
  305.     DeleteDirectory
  306.  
  307.     DeleteFile
  308.  
  309.     DialogAddBitmap
  310.  
  311.     DialogAddCheckBox
  312.  
  313.     DialogAddColorWheel
  314.  
  315.     DialogAddComboBox
  316.  
  317.     DialogAddControl
  318.  
  319.     DialogAddCounter
  320.  
  321.     DialogAddDate
  322.  
  323.     DialogAddEditBox
  324.  
  325.     DialogAddFileNameBox
  326.  
  327.     DialogAddFrame
  328.  
  329.     DialogAddGroupBox
  330.  
  331.     DialogAddHLine
  332.  
  333.     DialogAddHotSpot
  334.  
  335.     DialogAddIcon
  336.  
  337.     DialogAddListBox
  338.  
  339.     DialogAddListItem
  340.  
  341.     DialogAddProgress
  342.  
  343.     DialogAddPushButton
  344.  
  345.     DialogAddRadioButton
  346.  
  347.     DialogAddScrollBar
  348.  
  349.     DialogAddText
  350.  
  351.     DialogAddViewer
  352.  
  353.     DialogAddVLine
  354.  
  355.     DialogControlQuery
  356.  
  357.     DialogControlUpdate
  358.  
  359.     DialogDefine
  360.  
  361.     DialogDelete
  362.  
  363.     DialogDestroy
  364.  
  365.     DialogDismiss
  366.  
  367.     DialogHandle
  368.  
  369.     DialogLoad
  370.  
  371.     DialogSave
  372.  
  373.     DialogSetProperties
  374.  
  375.     DialogShow
  376.  
  377.     Dimensions
  378.  
  379.     Discard
  380.  
  381.     DIV
  382.  
  383.     DLLCall
  384.  
  385.     DLLCall Prototype
  386.  
  387.     DLLFree
  388.  
  389.     DLLLoad
  390.  
  391.     DoesDialogExist
  392.  
  393.     DoesDirectoryExist
  394.  
  395.     DoesFileExist
  396.  
  397.     DoesRegionExist
  398.  
  399.     DWord
  400.  
  401.  
  402.  
  403. E
  404.  
  405.     Else
  406.  
  407.     ElseIfPlatform
  408.  
  409.     EndApp
  410.  
  411.     EndFor
  412.  
  413.     EndFunc
  414.  
  415.     EndFunction
  416.  
  417.     EndIf
  418.  
  419.     EndIfPlatform
  420.  
  421.     EndProc
  422.  
  423.     EndProcedure
  424.  
  425.     EndPrompt
  426.  
  427.     EndSwitch
  428.  
  429.     EndWhile
  430.  
  431.     EndWith
  432.  
  433.     EnvVariableGet
  434.  
  435.     EnvVariableSet
  436.  
  437.     Error
  438.  
  439.     ErrorNumber
  440.  
  441.     Exists
  442.  
  443.     ExitHandlerState
  444.  
  445.     ExponentPart
  446.  
  447.  
  448.  
  449. F
  450.  
  451.     Factorial
  452.  
  453.     False
  454.  
  455.     Fibonacci
  456.  
  457.     FileCheckSum
  458.  
  459.     FileConvert
  460.  
  461.     FileConvertError
  462.  
  463.     FileError
  464.  
  465.     FileFind
  466.  
  467.     FileFlushData
  468.  
  469.     FileGetLongName
  470.  
  471.     FileGetShortName
  472.  
  473.     FileIsEOF
  474.  
  475.     FileNameDialog
  476.  
  477.     FilePosition
  478.  
  479.     FileRead
  480.  
  481.     FileSize
  482.  
  483.     FileTruncate
  484.  
  485.     FileType
  486.  
  487.     FileTypeExtension
  488.  
  489.     FileTypeList
  490.  
  491.     FileTypeName
  492.  
  493.     FileWrite
  494.  
  495.     FileWriteLine
  496.  
  497.     Floor
  498.  
  499.     For
  500.  
  501.     ForEach
  502.  
  503.     ForNext
  504.  
  505.     Fraction
  506.  
  507.     FractionalPart
  508.  
  509.     FractionStr
  510.  
  511.     Function Prototype
  512.  
  513.     Function
  514.  
  515.  
  516.  
  517. G
  518.  
  519.     gcf
  520.  
  521.     GetCurrentDirectory
  522.  
  523.     GetFileAttributes
  524.  
  525.     GetFileDateAndTime
  526.  
  527.     GetNumber
  528.  
  529.     GetObject
  530.  
  531.     GetString
  532.  
  533.     GetUnits
  534.  
  535.     Global
  536.  
  537.     Go
  538.  
  539.     GoOnline
  540.  
  541.  
  542.  
  543. H
  544.  
  545. No commands
  546.  
  547.  
  548.  
  549. I
  550.  
  551.     If
  552.  
  553.     IfPlatform
  554.  
  555.     IN
  556.  
  557.     Include
  558.  
  559.     Indirect
  560.  
  561.     Integer
  562.  
  563.     IntegerPart
  564.  
  565.  
  566.  
  567. J
  568.  
  569. No commands
  570.  
  571.  
  572.  
  573. K
  574.  
  575. No commands
  576.  
  577.  
  578.  
  579. L
  580.  
  581.     Label
  582.  
  583.     lcm
  584.  
  585.     lg
  586.  
  587.     LIKE
  588.  
  589.     ln
  590.  
  591.     Local
  592.  
  593.     log
  594.  
  595.     logn
  596.  
  597.  
  598.  
  599. M
  600.  
  601.     MacroArgs[ ]
  602.  
  603.     MacroCompile
  604.  
  605.     MacroDialogResult
  606.  
  607.     MacroInfo
  608.  
  609.     MacroIsCompiled
  610.  
  611.     MacroPlay
  612.  
  613.     MantissaPart
  614.  
  615.     Max
  616.  
  617.     MaxN
  618.  
  619.     MeanDev
  620.  
  621.     Median
  622.  
  623.     Menu
  624.  
  625.     MessageBox
  626.  
  627.     Min
  628.  
  629.     MinN
  630.  
  631.     MMPlay
  632.  
  633.     MMSpeak
  634.  
  635.     MMSpeakClipboard
  636.  
  637.     MMStopPlay
  638.  
  639.     MMStopSpeech
  640.  
  641.     MOD
  642.  
  643.  
  644.  
  645. N
  646.  
  647.     Nest
  648.  
  649.     NetAddConnection
  650.  
  651.     NetCancelConnection
  652.  
  653.     NetConnectionDlg
  654.  
  655.     NetDisconnectDlg
  656.  
  657.     NetGetConnection
  658.  
  659.     NetGetUniversalName
  660.  
  661.     NetGetUser
  662.  
  663.     NewDefault
  664.  
  665.     Next
  666.  
  667.     NOT
  668.  
  669.     NotFound
  670.  
  671.     NthRoot
  672.  
  673.     NToC
  674.  
  675.     NToC
  676.  
  677.     NumStr
  678.  
  679.  
  680.  
  681. O
  682.  
  683.     Object
  684.  
  685.     ObjectInfo
  686.  
  687.     OemString
  688.  
  689.     OLE Automation
  690.  
  691.     OnCancel
  692.  
  693.     OnCancel Call
  694.  
  695.     OnCondition Call
  696.  
  697.     OnCondition
  698.  
  699.     OnDDEAdvise Call
  700.  
  701.     OnError Call
  702.  
  703.     OnError
  704.  
  705.     OnExit
  706.  
  707.     OnNotFound
  708.  
  709.     OnNotFound Call
  710.  
  711.     OnVarErrChk 
  712.  
  713.     OnVarErrChk Call 
  714.  
  715.     OpenFile
  716.  
  717.     OR
  718.  
  719.  
  720.  
  721. P
  722.  
  723.     Pause
  724.  
  725.     PercentChange
  726.  
  727.     PercentOf
  728.  
  729.     PercentOfTotal
  730.  
  731.     Persist
  732.  
  733.     PersistAll
  734.  
  735.     pi
  736.  
  737.     PrimeFactors
  738.  
  739.     Procedure
  740.  
  741.     Procedure Prototype
  742.  
  743.     Product
  744.  
  745.     Prompt
  746.  
  747.  
  748.  
  749. Q
  750.  
  751.     Quit
  752.  
  753.  
  754.  
  755. R
  756.  
  757.     RadiansToDegrees
  758.  
  759.     Randomize
  760.  
  761.     RandomNumber
  762.  
  763.     RandomSeed
  764.  
  765.     RandomStats
  766.  
  767.     Real
  768.  
  769.     RegionAddListItem
  770.  
  771.     RegionAddListItemByIndex
  772.  
  773.     RegionEnableWindow
  774.  
  775.     RegionGetCheck
  776.  
  777.     RegionGetChildCount
  778.  
  779.     RegionGetClass
  780.  
  781.     RegionGetFocus
  782.  
  783.     RegionGetHandle
  784.  
  785.     RegionGetID
  786.  
  787.     RegionGetListContents
  788.  
  789.     RegionGetListCount
  790.  
  791.     RegionGetListItem
  792.  
  793.     RegionGetListItemByIndex
  794.  
  795.     RegionGetListSelectedCount
  796.  
  797.     RegionGetModified
  798.  
  799.     RegionGetName
  800.  
  801.     RegionGetOrder
  802.  
  803.     RegionGetPosition
  804.  
  805.     RegionGetSelectedText
  806.  
  807.     RegionGetStyle
  808.  
  809.     RegionGetType
  810.  
  811.     RegionGetVariable
  812.  
  813.     RegionGetWindowText
  814.  
  815.     RegionIsEnabled
  816.  
  817.     RegionIsVisible
  818.  
  819.     RegionMoveWindow
  820.  
  821.     RegionRemoveListItem
  822.  
  823.     RegionRemoveListItemByIndex
  824.  
  825.     RegionResetList
  826.  
  827.     RegionSelectListItemByIndex
  828.  
  829.     RegionSelectListItem
  830.  
  831.     RegionSetBitmap
  832.  
  833.     RegionSetCheck
  834.  
  835.     RegionSetEditSelection
  836.  
  837.     RegionSetFocus
  838.  
  839.     RegionSetModified
  840.  
  841.     RegionSetProgressPercent
  842.  
  843.     RegionSetSelectedText
  844.  
  845.     RegionSetTabStops
  846.  
  847.     RegionSetWindowText
  848.  
  849.     RegionShowWindow
  850.  
  851.     RegistryCloseKey
  852.  
  853.     RegistryCreateKey
  854.  
  855.     RegistryDeleteKey
  856.  
  857.     RegistryDeleteValue
  858.  
  859.     RegistryEnumKey
  860.  
  861.     RegistryEnumValue
  862.  
  863.     RegistryOpenKey
  864.  
  865.     RegistryQueryKeyCount
  866.  
  867.     RegistryQueryLastError
  868.  
  869.     RegistryQueryValue
  870.  
  871.     RegistryQueryValueCount
  872.  
  873.     RegistrySetValue
  874.  
  875.     RenameDirectory
  876.  
  877.     RenameFile
  878.  
  879.     Repeat
  880.  
  881.     Return
  882.  
  883.     Return
  884.  
  885.     RoundOff
  886.  
  887.     Run
  888.  
  889.  
  890.  
  891. S
  892.  
  893.     SendKeys
  894.  
  895.     SetCurrentDirectory
  896.  
  897.     SetDefaultParent 
  898.  
  899.     SetFileAttributes
  900.  
  901.     SetFileDateAndTime
  902.  
  903.     Sign
  904.  
  905.     sin
  906.  
  907.     sinh
  908.  
  909.     SizeOf
  910.  
  911.     Speed
  912.  
  913.     SquareRoot
  914.  
  915.     Step
  916.  
  917.     StdDev
  918.  
  919.     StrFill
  920.  
  921.     StrFraction
  922.  
  923.     String
  924.  
  925.     StrInsert
  926.  
  927.     StrIsChar
  928.  
  929.     StrLeft
  930.  
  931.     StrLen
  932.  
  933.     StrMakeList
  934.  
  935.     StrNum
  936.  
  937.     StrPad
  938.  
  939.     StrParseList
  940.  
  941.     StrPos
  942.  
  943.     StrReverse
  944.  
  945.     StrRight
  946.  
  947.     StrScan
  948.  
  949.     StrToChars
  950.  
  951.     StrTransform
  952.  
  953.     StrTrim
  954.  
  955.     Structure
  956.  
  957.     StrUnit
  958.  
  959.     SubChar
  960.  
  961.     SubStr
  962.  
  963.     Sum
  964.  
  965.     Switch
  966.  
  967.  
  968.  
  969. T
  970.  
  971.     tan
  972.  
  973.     tanh
  974.  
  975.     TimeHour
  976.  
  977.     TimeHundredth
  978.  
  979.     TimeMinute
  980.  
  981.     TimePart
  982.  
  983.     TimeSecond
  984.  
  985.     TimeString
  986.  
  987.     TimeZoneInfo
  988.  
  989.     ToInitialCaps
  990.  
  991.     ToLower
  992.  
  993.     ToUpper
  994.  
  995.     True
  996.  
  997.  
  998.  
  999. U
  1000.  
  1001.     UnitStr
  1002.  
  1003.     Until
  1004.  
  1005.     Use
  1006.  
  1007.  
  1008.  
  1009. V
  1010.  
  1011.     Value
  1012.  
  1013.     ValueType
  1014.  
  1015.     VarErrChk
  1016.  
  1017.     Variance
  1018.  
  1019.     VersionInfo
  1020.  
  1021.  
  1022.  
  1023. W
  1024.  
  1025.     Wait
  1026.  
  1027.     While
  1028.  
  1029.     With
  1030.  
  1031.     WordCount
  1032.  
  1033.     WPString
  1034.  
  1035.  
  1036.  
  1037. X
  1038.  
  1039.     XOR
  1040.  
  1041.  
  1042.  
  1043. Y
  1044.  
  1045. No commands
  1046.  
  1047.  
  1048.  
  1049. Z
  1050.  
  1051. No commands
  1052.  
  1053. Dialog Box Controls
  1054.  
  1055. Input or output windows where the user interacts with a dialog box and its parent application. Macros support the following dialog box controls:
  1056.  
  1057. Bitmaps
  1058.  
  1059. Check Boxes
  1060.  
  1061. Color Wheels
  1062.  
  1063. Combination Boxes
  1064.  
  1065. Counter Buttons
  1066.  
  1067. Dates
  1068.  
  1069. Edit Boxes
  1070.  
  1071. Filename Edit Boxes
  1072.  
  1073. Frames
  1074.  
  1075. Group Boxes
  1076.  
  1077. Horizontal Lines
  1078.  
  1079. Hot Spots
  1080.  
  1081. Icons
  1082.  
  1083. List Boxes
  1084.  
  1085. Progress Indicators
  1086.  
  1087. Push Buttons
  1088.  
  1089. Radio Buttons
  1090.  
  1091. Scroll Bars
  1092.  
  1093. Static Text Controls
  1094.  
  1095. Viewers
  1096.  
  1097. Vertical Lines
  1098.  
  1099. Check Boxes
  1100.  
  1101. Display one or more options. Use a callback function to activate user-defined responses. See DialogAddCheckBox.
  1102.  
  1103. Color Wheels
  1104.  
  1105. Display colors to select. See DialogAddColorWheel.
  1106.  
  1107. Combination Boxes
  1108.  
  1109. Display an edit box and a list box. Enter text such as a filename in the edit box, or double-click a list item to insert it. See DialogAddComboBox.
  1110.  
  1111. Counter Buttons
  1112.  
  1113. Display an edit box and a counter button. Enter a number in the edit box, or click the counter button to insert a number. See DialogAddCounter.
  1114.  
  1115. Edit Boxes
  1116.  
  1117. Receive text input. There are different styles of edit controls, including single line and multiple line. See DialogAddEditBox.
  1118.  
  1119. Filename Edit Boxes
  1120.  
  1121. Display an edit control and a button control. Enter a filename in the edit control, or click the button to display the Select File dialog box. See DialogAddFileNameBox.
  1122.  
  1123. Frames
  1124.  
  1125. Group items in a dialog box. Accept no input. See DialogAddFrame.
  1126.  
  1127. Group Boxes
  1128.  
  1129. Group items in a dialog box with a titled frame. Accept no input. See DialogAddGroupBox.
  1130.  
  1131. Horizontal Lines
  1132.  
  1133. Separate items in a dialog box. Accept no input. See DialogAddHLine.
  1134.  
  1135. Hot Spots
  1136.  
  1137. Invisible controls that close a dialog box when the user clicks a defined area. Redefine the response with a callback function. See DialogAddHotSpot.
  1138.  
  1139. Icons
  1140.  
  1141. Display graphics representations. Accept no input, unless used in a callback function with DialogAddHotspot. See DialogAddHotSpot, DialogAddIcon, DialogShow.
  1142.  
  1143. List Boxes
  1144.  
  1145. Display a list of options to choose from. There are different styles of list boxes, including single column and multi column. See DialogAddListBox.
  1146.  
  1147. Pop-Up Buttons
  1148.  
  1149. Display the name of a menu item on a push button. Click the button to display the menu.
  1150.  
  1151. Push Buttons
  1152.  
  1153. Activate user-defined responses when chosen. See DialogAddPushButton.
  1154.  
  1155. Radio Buttons
  1156.  
  1157. Display mutually exclusive options. Use a callback function to activate user-defined responses. See DialogAddRadioButton and DialogShow.
  1158.  
  1159. Scroll Bars
  1160.  
  1161. Scroll through documents, or activate user-defined responses with a callback function. See DialogAddScrollBar and DialogShow.
  1162.  
  1163. Static Text Controls
  1164.  
  1165. Send text to a dialog box. Accept no input. See DialogAddText.
  1166.  
  1167. Viewers
  1168.  
  1169. Display read-only text files. See DialogAddViewer.
  1170.  
  1171. Vertical Lines
  1172.  
  1173. Separate items in a dialog box. Accept no input. See DialogAddVLine.
  1174.  
  1175. Macro: ASSERT.WCM
  1176.  
  1177. ASSERT.WCM uses MENU to display a list of options; ASSERT to create a Cancel, Error, or Not Found condition; and ONCANCEL, ONERROR, or ONNOTFOUND to execute a subroutine. It also uses MESSAGEBOX to display messages and Go to create user-defined loops. Click the comment buttons for detailed explanations.
  1178.  
  1179.  
  1180.  
  1181. // Name: ASSERT.WCM // 1 
  1182.  
  1183. // Directory: C:\MACROS // 2 
  1184.  
  1185. // Description: Demonstrate Assert command // 3
  1186.  
  1187.  
  1188.  
  1189. APPLICATION(WP; "WPPrWin"; Default; "EN") // 4 
  1190.  
  1191.  
  1192.  
  1193. CALL(AssertConditions) // 5 
  1194.  
  1195. CALL(DisplayMenu) // 6 
  1196.  
  1197. CALL(QuitMacro) // 7 
  1198.  
  1199.  
  1200.  
  1201. //********************************************************* // 8
  1202.  
  1203. //MAIN LABEL STATEMENTS // 9 
  1204.  
  1205. //********************************************************* // 10
  1206.  
  1207.  
  1208.  
  1209. LABEL(AssertConditions) // 11 
  1210.  
  1211. ONCANCEL(Conditions) // 12 
  1212.  
  1213. ONERROR(Conditions) // 13 
  1214.  
  1215. ONNOTFOUND(Conditions) // 14 
  1216.  
  1217. vCondition := "Turn conditions Off!" // 15 
  1218.  
  1219. RETURN // 16 
  1220.  
  1221.  
  1222.  
  1223. LABEL(DisplayMenu) // 17 
  1224.  
  1225. MENU(vChoice; Digit!; ; ; {"CancelCondition!"; "ErrorCondition!"; "NotFoundCondition!"; vCondition; "Quit"}) // 18 
  1226.  
  1227. SWITCH(vChoice) // 19 
  1228.  
  1229. CASEOF 1: ASSERT(CancelCondition!) // 20 
  1230.  
  1231. CASEOF 2: ASSERT(ErrorCondition!) // 21 
  1232.  
  1233. CASEOF 3: ASSERT(NotFoundCondition!) // 22 
  1234.  
  1235. CASEOF 4: IF(vCondition = "Turn conditions Off!") // 23 
  1236.  
  1237. GO(TurnConditionsOff) // 24
  1238.  
  1239. Else // 25
  1240.  
  1241. GO(TurnConditionsOn) // 26
  1242.  
  1243. ENDIF // 27
  1244.  
  1245. CASEOF 5: GO(QuitMacro) // 28 
  1246.  
  1247. DEFAULT: Conditions // 29 ENDSWITCH // 30 
  1248.  
  1249. RETURN // 31 
  1250.  
  1251.  
  1252.  
  1253. LABEL(QuitMacro) // 32 
  1254.  
  1255. vMessage := "You selected 5, or you selected 1, 2, or 3 with all conditions Off!" // 33 
  1256.  
  1257. MESSAGEBOX(vStatus; "Condition Status"; vMessage; RetryCancel! | IconInformation! | DefButton2!) // 34 
  1258.  
  1259. IF(vStatus = 4) // 35 
  1260.  
  1261. GO(DisplayMenu) // 36
  1262.  
  1263. Else // 37 
  1264.  
  1265. QUIT // 38
  1266.  
  1267. ENDIF // 39 
  1268.  
  1269.  
  1270.  
  1271. //********************************************************* // 40
  1272.  
  1273. //SECONDARY LABEL STATEMENTS // 41 
  1274.  
  1275. //********************************************************* // 42
  1276.  
  1277.  
  1278.  
  1279. LABEL(Conditions) // 43 
  1280.  
  1281. SWITCH(ErrorNumber) // 44 
  1282.  
  1283. CASEOF 1: vMessage := "^0" // 45 
  1284.  
  1285. CASEOF 2: vMessage := "^1" // 46 
  1286.  
  1287. CASEOF 7: vMessage := "^2" // 47 
  1288.  
  1289. DEFAULT: vMessage := "^3" // 48 
  1290.  
  1291. ENDSWITCH // 49 
  1292.  
  1293. MESSAGEBOX(vStatus; "Condition Status"; vMessage; Ok! | IconInformation! | HasParameters!; {"You selected 1 with CANCEL(On!)"; "You selected 2 with ERROR(On!)"; "You selected 3 with NOTFOUND(On!)"; "Menu item not chosen"}) // 50 
  1294.  
  1295. GO(DisplayMenu) // 51 
  1296.  
  1297.  
  1298.  
  1299. LABEL(TurnConditionsOn) // 52 
  1300.  
  1301. CANCEL(On!) // 53
  1302.  
  1303. ERROR(On!) // 54
  1304.  
  1305. NOTFOUND(On!) // 55
  1306.  
  1307. vCondition := "Turn conditions Off!" // 56 
  1308.  
  1309. GO(DisplayMenu) // 57 
  1310.  
  1311.  
  1312.  
  1313. LABEL(TurnConditionsOff) // 58 
  1314.  
  1315. CANCEL(Off!) // 59
  1316.  
  1317. ERROR(Off!) // 60
  1318.  
  1319. NOTFOUND(Off!) // 61
  1320.  
  1321. vCondition := "Turn conditions On!" // 62 
  1322.  
  1323. GO(DisplayMenu) // 63 
  1324.  
  1325. Lines 1-3
  1326.  
  1327. Comments about the macro.
  1328.  
  1329. Line 2
  1330.  
  1331. Macros are generally saved to the application's macros directory.
  1332.  
  1333. Line 4
  1334.  
  1335. WordPerfect identified as the default application.
  1336.  
  1337. Line 5
  1338.  
  1339. Call LABEL(AssertConditions), which identifies a LABEL subroutine to call when there is a Cancel, Error, or Not Found condition (lines 12-14).
  1340.  
  1341. Line 6
  1342.  
  1343. Call LABEL(DisplayMenu) after LABEL(AssertConditions) returns (line 16). LABEL(DisplayMenu) displays a five-option menu (line 18).
  1344.  
  1345. Line 7
  1346.  
  1347. Call LABEL(QuitMacro) after LABEL(DisplayMenu) returns (line 31). LABEL(QuitMacro) displays a message box where the user can end the macro or redisplay the menu (lines 32-39).
  1348.  
  1349. Lines 8-10
  1350.  
  1351. Comments identify LABELs that correspond to the opening CALL statements (lines 5-7).
  1352.  
  1353. Lines 11-16
  1354.  
  1355. LABEL(AssertConditions) identifies a LABEL to execute when a Cancel, Error, or Not Found condition occurs.
  1356.  
  1357. Line 12
  1358.  
  1359. Execute LABEL(Conditions) when a Cancel condition occurs (line 43).
  1360.  
  1361. Line 13
  1362.  
  1363. Execute LABEL(Conditions) when an Error condition occurs (line 43).
  1364.  
  1365. Line 14
  1366.  
  1367. Execute LABEL(Conditions) when a Not Found condition occurs (line 43).
  1368.  
  1369. Line 15
  1370.  
  1371. Assignment operator assigns a character string to a variable named vCondition, which is menu item 4 the first time the menu is displayed (line 18). The default condition for CANCEL, ERROR, and NOTFOUND is On!.
  1372.  
  1373. Line 16
  1374.  
  1375. RETURN statement directs macro execution to CALL(DisplayMenu) (line 6).
  1376.  
  1377. Lines 17-31
  1378.  
  1379. LABEL displays a five-option menu and asserts a Cancel, Error, or Not Found condition depending on a menu choice.
  1380.  
  1381. Line 18
  1382.  
  1383. MENU displays a numbered (Digit!) list of five items. The number the user chooses is assigned to vChoice. Omitting the third and fourth parameters centers the menu on the screen.
  1384.  
  1385. Line 19
  1386.  
  1387. SWITCH initiates an action, depending on the value of vChoice, which contains the number of the chosen menu item.
  1388.  
  1389. Line 20
  1390.  
  1391. If 1 is selected, assert a Cancel condition. The macro assigns 1 to the variable ErrorNumber (see Assert). LABEL(Condition) is automatically called (lines 12 and 45).
  1392.  
  1393. Line 21
  1394.  
  1395. If 2 is selected, assert an Error condition. The macro assigns 2 to the variable ErrorNumber (see Assert). LABEL(Condition) is automatically called (lines 13 and 46).
  1396.  
  1397. Line 22
  1398.  
  1399. If 3 is selected, assert a Not Found condition. The macro assigns 7 to the variable ErrorNumber (see Assert). LABEL(NotFound) is automatically called (line 14 and line 47).
  1400.  
  1401. Lines 23-27
  1402.  
  1403. If 4 is selected, toggle CANCEL, ERROR, and NOTFOUND conditions by calling LABEL(TurnConditionsOn) (lines 52-57) or LABEL(TurnConditionsOff) (lines 58-63). The label called depends on the contents of variable vCondition (lines 15, 56, and 62). Update the description of menu item 4.
  1404.  
  1405. Line 28
  1406.  
  1407. If 5 is selected, end (quit) macro.
  1408.  
  1409. Line 29
  1410.  
  1411. If another key is pressed, such as Esc, LABEL(Condition) executes. Notice that the subroutine name executes the subroutine. 
  1412.  
  1413. Line 30
  1414.  
  1415. ENDSWITCH closes SWITCH statement (line 19).
  1416.  
  1417. Line 31
  1418.  
  1419. RETURN statement directs macro execution to CALL(QuitMacro).
  1420.  
  1421. Lines 32-39
  1422.  
  1423. LABEL(QuitMacro) displays a message box with an option to end the macro or redisplay the menu.
  1424.  
  1425. Line 33
  1426.  
  1427. Assignment operator assigns character string "You selected 5, or you selected 1, 2, or 3 with all conditions Off!" to variable vMessage (line 34).
  1428.  
  1429. Line 34
  1430.  
  1431. MESSAGEBOX displays a message box with an information icon and Retry and Cancel buttons. If Retry is chosen, 4 is assigned to variable vStatus, or 2 is assigned to vStatus if Cancel is chosen.
  1432.  
  1433. Lines 35-36
  1434.  
  1435. If variable vStatus equals 4 (line 34), GO sends macro execution to LABEL(DisplayMenu), which redisplays the menu.
  1436.  
  1437. Lines 37-38
  1438.  
  1439. If vStatus is any value except 4 (Else), end the macro (QUIT).
  1440.  
  1441. Line 39
  1442.  
  1443. ENDIF closes IF statement (line 35).
  1444.  
  1445. Lines 40-42
  1446.  
  1447. Comments identify secondary LABELs or LABELs called from another LABEL (see lines 12-14, 24, and 26).
  1448.  
  1449. Lines 43-51
  1450.  
  1451. Execute LABEL(Conditions) when the user chooses 1, 2, or 3 (lines 20-22 and 12-14).
  1452.  
  1453. Line 44
  1454.  
  1455. SWITCH initiates an action, depending on the value of the variable ErrorNumber (lines 20, 21, 22) (see Assert).
  1456.  
  1457. Line 45
  1458.  
  1459. If ErrorNumber equals 1 (Cancel condition), assign "^1" to vMessage (see line 50).
  1460.  
  1461. Line 46
  1462.  
  1463. If ErrorNumber equals 2 (Error condition), assign "^2" to vMessage (see line 50).
  1464.  
  1465. Line 47
  1466.  
  1467. If ErrorNumber equals 7 (NotFound condition), assign "^3" to vMessage (line 50).
  1468.  
  1469. Line 48
  1470.  
  1471. If ErrorNumber contains a value other than 1, 2, or 7, assign "^4" to vMessage (line 50).
  1472.  
  1473. Line 49
  1474.  
  1475. ENDSWITCH closes SWITCH statement (line 44).
  1476.  
  1477. Line 50
  1478.  
  1479. MESSAGEBOX displays a message box with an information icon and OK button. It uses the HasParameters! style, followed by four Message parameter options. A caret (^) followed by a number in the Message parameter inserts the corresponding ParameterData message (one of the four message options) in its place (lines 45-48). Numbering begins with 0. See MessageBox.
  1480.  
  1481. Line 51
  1482.  
  1483. GO creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
  1484.  
  1485. Lines 52-55
  1486.  
  1487. LABEL(TurnConditionsOn) turns on CANCEL, ERROR, and NOTFOUND conditions after LABEL(TurnConditionsOff) is executed.
  1488.  
  1489. Line 56
  1490.  
  1491. Assigns character string "Turn conditions Off!" to variable vCondition, which is displayed as menu item 4 (line 18).
  1492.  
  1493. Line 57
  1494.  
  1495. GO creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
  1496.  
  1497. Lines 58-61
  1498.  
  1499. LABEL(TurnConditionsOff) turns off CANCEL, ERROR, and NOTFOUND conditions after the macro first starts or LABEL(TurnConditionsOn) is executed.
  1500.  
  1501. Line 62
  1502.  
  1503. Assigns character string "Turn conditions On!" to variable vCondition, which is displayed as menu item 4 (line 18).
  1504.  
  1505. Line 63
  1506.  
  1507. GO statement creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
  1508.  
  1509. Macro: CALLBACK.WCM
  1510.  
  1511. CALLBACK.WCM creates a callback function that responds to system menu box options, check boxes, radio buttons, QuickSpots, and push buttons. Click the comment buttons for detailed explanations.
  1512.  
  1513.  
  1514.  
  1515. // Name: CALLBACK.WCM // 1 
  1516.  
  1517. // Directory: C:\OFFICE7\MACROS\... // 2 
  1518.  
  1519. // Description: Callback function displays a message when a user chooses a dialog box control // 3
  1520.  
  1521.  
  1522.  
  1523. APPLICATION(WP; "WPPrWin"; Default; "EN") // 4 
  1524.  
  1525.  
  1526.  
  1527. //********************************************************* // 5
  1528.  
  1529. // MAIN CALL STATEMENTS // 6 
  1530.  
  1531. //********************************************************* // 7
  1532.  
  1533.  
  1534.  
  1535. CALL(InitializeVariables) // 8 
  1536.  
  1537. CALL(CreateDialog) // 9 
  1538.  
  1539. CALL(DisplayMainDialog) // 10 
  1540.  
  1541. CALL(StartMessageLoop) // 11 
  1542.  
  1543. CALL(QuitMacro) // 12 
  1544.  
  1545.  
  1546.  
  1547. //********************************************************* // 13
  1548.  
  1549. // MAIN LABEL STATEMENTS // 14 
  1550.  
  1551. //********************************************************* // 15
  1552.  
  1553.  
  1554.  
  1555. LABEL(InitializeVariables) // 16 
  1556.  
  1557. WM_SYSCOMMAND := 274 // 17 
  1558.  
  1559. WM_COMMAND := 273 // 18
  1560.  
  1561. vCheck := 0 // 19 
  1562.  
  1563. vRadio := 0 // 20
  1564.  
  1565. vLoop := "Yes" // 21 
  1566.  
  1567. RETURN // 22 
  1568.  
  1569.  
  1570.  
  1571. LABEL(CreateDialog)// 23 
  1572.  
  1573. DIALOGDEFINE(1000; 50; 50; 210; 175; 1+2+16; "Callback Function") // 24
  1574.  
  1575. DIALOGADDCHECKBOX(1000; 101; 10; 10; 50; 10; "Checkbox"; vCheck) // 25 
  1576.  
  1577. DIALOGADDRADIOBUTTON(1000; 102; 10; 30; 60; 10;"Radio button"; vRadio) // 26
  1578.  
  1579. DIALOGADDHOTSPOT(1000; 103; 90; 10; 50; 50; 1) // 27
  1580.  
  1581. DIALOGADDFRAME(1000; 104; 90; 10; 50; 50; 5) // 28
  1582.  
  1583. DIALOGADDTEXT(1000; 105; 150; 30; 50; 15; 1; "<- QuickSpot") // 29
  1584.  
  1585. vText1 := "Choose Close from the system menu, double-click" // 30
  1586.  
  1587. vText2 := "the system menu box, or press Alt+F4." // 31
  1588.  
  1589. DIALOGADDTEXT(1000; 106; 20; 95; 190; 15; 1; vText1) // 32
  1590.  
  1591. DIALOGADDTEXT(1000; 107; 20; 105; 170; 15; 1; vText2) // 33
  1592.  
  1593. DIALOGADDGROUPBOX(1000; 109; 10; 75; 185; 50; "System commands") // 34
  1594.  
  1595. RETURN // 35 
  1596.  
  1597.  
  1598.  
  1599. LABEL(DisplayMainDialog) // 36 
  1600.  
  1601. DIALOGSHOW (1000; 1; MsgLoop) // 37
  1602.  
  1603. RETURN // 38
  1604.  
  1605.  
  1606.  
  1607. LABEL(StartMessageLoop) // 39 
  1608.  
  1609. WHILE(vLoop = "Yes") // 40
  1610.  
  1611. ENDWHILE // 41
  1612.  
  1613. RETURN // 42
  1614.  
  1615.  
  1616.  
  1617. LABEL(QuitMacro) // 43 
  1618.  
  1619. DIALOGDESTROY(1000) // 44
  1620.  
  1621. QUIT // 45
  1622.  
  1623.  
  1624.  
  1625. //********************************************************* // 46
  1626.  
  1627. // CALLBACK FUNCTION // 47 
  1628.  
  1629. //********************************************************* // 48
  1630.  
  1631.  
  1632.  
  1633. LABEL(MsgLoop) // 49 
  1634.  
  1635. SWITCH(MsgLoop[3]) // 50 
  1636.  
  1637. CASEOF 101: // 51 
  1638.  
  1639. DIALOGDISMISS(1000; "OKBttn") // 52 
  1640.  
  1641. MESSAGEBOX(vStatus; "Check Box"; "Check boxes display options. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 53
  1642.  
  1643. DIALOGSHOW (1000;1; MsgLoop) // 54 
  1644.  
  1645. CASEOF 102: // 55
  1646.  
  1647. MESSAGEBOX(vStatus; "Radio Button"; "Radio buttons display mutually-exclusive options. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 56
  1648.  
  1649. CASEOF 103: // 57
  1650.  
  1651. MESSAGEBOX(vStatus; "QuickSpot"; "A QuickSpot was created over a filled frame. You can also create a QuickSpot over an icon. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 58
  1652.  
  1653. CASEOF "OKBttn": // 59
  1654.  
  1655. MESSAGEBOX(vStatus; "OK Button"; "You clicked the OK button on the main dialog box. Click OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 60
  1656.  
  1657. CASEOF "CancelBttn": // 61
  1658.  
  1659. MESSAGEBOX(vStatus; "Cancel Button"; "Choosing Cancel assigns ""No"" to variable vLoop, which ends the loop and the macro."; OK! | IconExclamation!) // 62
  1660.  
  1661. vLoop := "No" // 63
  1662.  
  1663. ENDSWITCH // 64 
  1664.  
  1665. IF(MsgLoop[5] = WM_SYSCOMMAND) // 65 
  1666.  
  1667. MESSAGEBOX(vStatus; "System Command"; "After you click OK, the main dialog box will disappear and then reappear after one second."; OK! | IconInformation!) // 66
  1668.  
  1669. DIALOGDISMISS(1000; "OKBttn") // 67 
  1670.  
  1671. WAIT(10) // 68
  1672.  
  1673. DIALOGSHOW(1000; 1; MsgLoop) // 69
  1674.  
  1675. ENDIF // 70 
  1676.  
  1677. RETURN // 71 
  1678.  
  1679. Lines 1-3
  1680.  
  1681. Comments about the macro.
  1682.  
  1683. Line 2
  1684.  
  1685. Macros are generally saved to the default macros directory.
  1686.  
  1687. Line 4
  1688.  
  1689. WordPerfect identified as the default application.
  1690.  
  1691. Lines 5-7
  1692.  
  1693. Comments identify the opening CALL statements that outline and define the macro's basic operations.
  1694.  
  1695. Line 8
  1696.  
  1697. Call LABEL(InitializeVariables), which initializes all variables (lines 16-22). A run-time error occurs if you reference a variable that has not been assigned a value. See VarErrChk.
  1698.  
  1699. Line 9
  1700.  
  1701. Call LABEL(CreateDialog) after LABEL(InitializeVariables) returns. LABEL(CreateDialog) creates a dialog box in memory (lines 23-35). It does not display the dialog box.
  1702.  
  1703. Line 10
  1704.  
  1705. Call LABEL(DisplayMainDialog) after LABEL(CreateDialog) returns. LABEL(DisplayMainDialog) displays the dialog box and identifies a callback function. See DialogShow.
  1706.  
  1707. Line 11
  1708.  
  1709. Call LABEL(StartMessageLoop) after LABEL(DisplayDialog) returns. LABEL(StartMessageLoop) starts a message loop that suspends the dialog box for callback functions (lines 49-71).
  1710.  
  1711. Line 12
  1712.  
  1713. CALL LABEL(QuitMacro) after LABEL(StartMessageLoop) returns. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
  1714.  
  1715. Lines 13-15
  1716.  
  1717. Comments identify LABELs that correspond to the opening CALL statements (lines 8-12).
  1718.  
  1719. Lines 16-22
  1720.  
  1721. LABEL(InitializeVariables) initializes all variables.
  1722.  
  1723. Lines 17-18
  1724.  
  1725. Initialize variables to contain Windows message numbers. Using variables makes the macro easier to read. The variable names are user defined, but match the Windows message names. See DialogShow.
  1726.  
  1727. Lines 19-20
  1728.  
  1729. Initialize check box and radio button variables (lines 25, 26).
  1730.  
  1731. Line 21
  1732.  
  1733. Initialize the loop variable. vLoop is later assigned a new value to end the message loop (line 63), which sends macro execution to CALL(QuitMacro).
  1734.  
  1735. Line 22
  1736.  
  1737. RETURN sends macro execution to CALL(CreateDialog).
  1738.  
  1739. Lines 23-35
  1740.  
  1741. LABEL(CreateDialog) creates a dialog box in memory.
  1742.  
  1743. Lines 25-27
  1744.  
  1745. Control parameter values are sent as messages to the callback function (52-63).
  1746.  
  1747. Line 35
  1748.  
  1749. RETURN sends macro execution to CALL(DisplayMainDialog).
  1750.  
  1751. Lines 36-38
  1752.  
  1753. LABEL(DisplayMainDialog) displays the dialog box and identifies the callback function MsgLoop. RETURN sends macro execution to CALL(StartMessageLoop).
  1754.  
  1755. Lines 39-42
  1756.  
  1757. LABEL(StartMessageLoop) starts the message loop that suspends the dialog box for callback functions (lines 49-71). RETURN sends macro execution to CALL(QuitMacro).
  1758.  
  1759. Lines 43-45
  1760.  
  1761. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
  1762.  
  1763. Lines 46-48
  1764.  
  1765. Comments identify the callback function.
  1766.  
  1767. Lines 49-71
  1768.  
  1769. Callback function MsgLoop responds to five Control parameter messages and one system command message. See DialogShow.
  1770.  
  1771. Line 50
  1772.  
  1773. SWITCH tests the third element of the callback function array. See DialogShow.
  1774.  
  1775. Lines 51-63
  1776.  
  1777. Array element MsgLoop[3] contains the Control parameter value of the control that calls the callback function. A message box describes the control. In this macro, Cancel is the only button that can dismiss the dialog box.
  1778.  
  1779. Line 52
  1780.  
  1781. DIALOGDISMISS hides the dialog box while the message box is displayed (line 54).
  1782.  
  1783. Line 54
  1784.  
  1785. DIALOGSHOW redisplays the dialog box after the message box is dismissed (line 52).
  1786.  
  1787. Line 64
  1788.  
  1789. ENDSWITCH closes the SWITCH statement (line 50).
  1790.  
  1791. Lines 65-70
  1792.  
  1793. A WM_SYSCOMMAND message is received when the user clicks Close from the system menu box, double-clicks the system menu box, or presses Alt+F4.
  1794.  
  1795. Lines 67-69
  1796.  
  1797. DIALOGDISMISS hides the dialog box after the message box is dismissed. WAIT(10) pauses the macro for one second. DIALOGSHOW redisplays the dialog box.
  1798.  
  1799. Line 70
  1800.  
  1801. ENDIF closes the IF statement (line 65).
  1802.  
  1803. Line 71
  1804.  
  1805. RETURN sends macro execution to the message loop (lines 39-42).
  1806.  
  1807. CB_SCBAR.WCM
  1808.  
  1809. CB_SCBAR.WCM creates a callback function that responds to Windows WM_VSCROLL, WM_ACTIVATE, and WM_SYSCOMMAND messages. It uses DIALOGADDSCROLLBAR to display a list item. Click the comment buttons for detailed explanations.
  1810.  
  1811.  
  1812.  
  1813. // Name: CB_SCBAR.WCM // 1 
  1814.  
  1815. // Directory: C:\OFFICE7\MACROS\... // 2 
  1816.  
  1817. // Description: Use DIALOGADDSCROLLBAR and a callback function // 3
  1818.  
  1819.  
  1820.  
  1821. APPLICATION(WP; WPPrWin; Default; "EN") // 4 
  1822.  
  1823.  
  1824.  
  1825. //********************************************************* // 5
  1826.  
  1827. // MAIN CALL STATEMENTS // 6 
  1828.  
  1829. //********************************************************* // 7
  1830.  
  1831.  
  1832.  
  1833. CALL(InitializeVariables) // 8 
  1834.  
  1835. CALL(CreateDlg) // 9 
  1836.  
  1837. CALL(DisplayDlg) // 10 
  1838.  
  1839. CALL(StartMessageLoop) // 11 
  1840.  
  1841. CALL(QuitMacro) // 12 
  1842.  
  1843.  
  1844.  
  1845. //********************************************************* // 13
  1846.  
  1847. // MAIN LABEL STATEMENTS // 14 
  1848.  
  1849. //********************************************************* // 15
  1850.  
  1851.  
  1852.  
  1853. LABEL(InitializeVariables) // 16 
  1854.  
  1855. SB_LINEUP := 0 // 17 
  1856.  
  1857. SB_LINEDOWN := 1 // 18
  1858.  
  1859. SB_PAGEUP := 2 // 19
  1860.  
  1861. SB_PAGEDOWN := 3 // 20
  1862.  
  1863. SB_THUMBPOSITION := 4 // 21
  1864.  
  1865. SB_THUMBTRACK := 5 // 22
  1866.  
  1867. SB_TOP := 6 // 23
  1868.  
  1869. SB_BOTTOM := 7 // 24
  1870.  
  1871. SB_ENDSCROLL := 8 // 25
  1872.  
  1873. vOldPos := 10 // 26 
  1874.  
  1875. y := 1 // 27 
  1876.  
  1877. WM_SYSCOMMAND:= 274 // 28 
  1878.  
  1879. WM_VSCROLL := 277 // 29
  1880.  
  1881. WM_ACTIVATE := 6 // 30
  1882.  
  1883. vLoop := 1 // 31 
  1884.  
  1885. DECLARE List[10] // 32 
  1886.  
  1887. vElement := 1 // 33 
  1888.  
  1889. FOREACH(vFruit; {"Apples"; "Oranges"; "Papaya"; "Grapes"; "Bananas"; "Pears"; "Watermelon"; "Apricots"; "Peaches"; "Plums"}) // 34
  1890.  
  1891. List[vElement] := vFruit // 35
  1892.  
  1893. vElement := vElement + 1 // 36
  1894.  
  1895. ENDFOR // 37
  1896.  
  1897. RETURN // 38 
  1898.  
  1899.  
  1900.  
  1901. LABEL(CreateDlg) // 39 
  1902.  
  1903. DIALOGDEFINE(1000; 50; 50; 155; 160; 16; "Scroll Bar Callback Function") // 40
  1904.  
  1905. DIALOGADDSCROLLBAR(1000; "Scroll"; 135; 10; 0; 100; 2 + 8;BarPos; 1; 10) // 41
  1906.  
  1907. FORNEXT(yPos; 10; 100; 10) // 42 
  1908.  
  1909. DIALOGADDTEXT(1000; 0; 10; yPos; 40; 10; 2; List[yPos / 10]) // 43 
  1910.  
  1911. ENDFOR // 44 DIALOGADDTEXT(1000; 0; 60; 10; 40; 10; 1; "Apples") // 45 
  1912.  
  1913. DIALOGADDTEXT(1000; 0; 50; yPos + 15; 70; 10; 1; "Thumb Position 1") // 46 
  1914.  
  1915. RETURN // 47 
  1916.  
  1917.  
  1918.  
  1919. LABEL(DisplayDlg) // 48 
  1920.  
  1921. DIALOGSHOW (1000; 121; MsgLoop) // callback function = MsgLoop // 49
  1922.  
  1923. RETURN // 50
  1924.  
  1925.  
  1926.  
  1927. LABEL (StartMessageLoop) // 51 
  1928.  
  1929. WHILE(vLoop = 1) // message loop // 52
  1930.  
  1931. ENDWHILE // 53
  1932.  
  1933. RETURN // 54
  1934.  
  1935.  
  1936.  
  1937. LABEL(QuitMacro) // 55 
  1938.  
  1939. DIALOGDESTROY(1000) // 56
  1940.  
  1941. QUIT // 57
  1942.  
  1943.  
  1944.  
  1945. //********************************************************* // 58
  1946.  
  1947. // CALLBACK FUNCTION // 59 
  1948.  
  1949. //********************************************************* // 60
  1950.  
  1951.  
  1952.  
  1953. LABEL(MsgLoop) // 61 
  1954.  
  1955. SWITCH(MsgLoop[5]) // 62 
  1956.  
  1957. CASEOF WM_SYSCOMMAND: // 63 
  1958.  
  1959. GO(QuitMacro) // 64
  1960.  
  1961. CASEOF WM_VSCROLL: // 65 
  1962.  
  1963. CALL(ScrollCtrl) // 66
  1964.  
  1965. CASEOF WM_ACTIVATE: // 67 
  1966.  
  1967. CALL(MsgBox) // 68
  1968.  
  1969. ENDSWITCH // 69 
  1970.  
  1971.  
  1972.  
  1973. SWITCH(MsgLoop[3]) // 70 
  1974.  
  1975. CASEOF "CancelBttn": // 71
  1976.  
  1977. GO(QuitMacro) // 72
  1978.  
  1979. ENDSWITCH // 73
  1980.  
  1981. RETURN // 74 
  1982.  
  1983.  
  1984.  
  1985. LABEL(ScrollCtrl) // 75 
  1986.  
  1987. SWITCH(MsgLoop[6]) // 76 
  1988.  
  1989. CASEOF SB_LINEUP: // 77 
  1990.  
  1991. CALL(LineUp) // 78 
  1992.  
  1993. CASEOF SB_LINEDOWN: // 79 
  1994.  
  1995. CALL(LineDown) // 80
  1996.  
  1997. CASEOF SB_PAGEUP: // 81 
  1998.  
  1999. CALL(PageUp) // 82
  2000.  
  2001. CASEOF SB_PAGEDOWN: // 83 
  2002.  
  2003. CALL(PageDown) // 84
  2004.  
  2005. CASEOF SB_THUMBPOSITION: // 85 
  2006.  
  2007. CALL(Thumb) // 86
  2008.  
  2009. //CASEOF SB_THUMBTRACK: // 87 
  2010.  
  2011. //CALL(Thumb) // 88
  2012.  
  2013. CASEOF SB_TOP: // 89 
  2014.  
  2015. CALL(PageUp) // 90
  2016.  
  2017. CASEOF SB_BOTTOM: // 91 
  2018.  
  2019. CALL(PageDown) // 92
  2020.  
  2021. CASEOF SB_ENDSCROLL: // 93 
  2022.  
  2023. DIALOGADDTEXT(1000; 0; 107; 125; 10; 10; 1; y) // 94
  2024.  
  2025. ENDSWITCH // 95 
  2026.  
  2027. RETURN // 96 
  2028.  
  2029.  
  2030.  
  2031. LABEL(Thumb) // 97 
  2032.  
  2033. y := MsgLoop[7] // 98 
  2034.  
  2035. y := y & 65535 // 99 
  2036.  
  2037. CALL(TypeFruit) // 100 
  2038.  
  2039. RETURN // 101 
  2040.  
  2041.  
  2042.  
  2043. LABEL(LineUp) // 102 
  2044.  
  2045. IF(NOT(y = 1)) // 103 
  2046.  
  2047. y := y - 1 // 104
  2048.  
  2049. CALL(TypeFruit) // 105
  2050.  
  2051. Else // 106 
  2052.  
  2053. BEEP // 107
  2054.  
  2055. ENDIF // 108 
  2056.  
  2057. RETURN // 109 
  2058.  
  2059.  
  2060.  
  2061. LABEL(LineDown) // 110 
  2062.  
  2063. IF(NOT(y = 10)) // 111 
  2064.  
  2065. y := y + 1 // 112
  2066.  
  2067. CALL(TypeFruit) // 113
  2068.  
  2069. Else // 114 
  2070.  
  2071. BEEP // 115
  2072.  
  2073. ENDIF // 116 
  2074.  
  2075. RETURN // 117 
  2076.  
  2077.  
  2078.  
  2079. LABEL(PageUp) // 118 
  2080.  
  2081. y := 1 // 119 
  2082.  
  2083. CALL(TypeFruit) // 120 
  2084.  
  2085. RETURN // 121 
  2086.  
  2087.  
  2088.  
  2089. LABEL(PageDown) // 122 
  2090.  
  2091. y := 10 // 123 
  2092.  
  2093. CALL(TypeFruit) // 124 
  2094.  
  2095. RETURN // 125 
  2096.  
  2097.  
  2098.  
  2099. LABEL(TypeFruit) // 126 
  2100.  
  2101. vBlank := " " // 127 
  2102.  
  2103. DIALOGADDTEXT(1000; 0; 60; vOldPos; 40; 10; 1; vBlank) // 128 
  2104.  
  2105. DIALOGADDTEXT(1000; 0; 60; y * 10; 40; 10; 1; List[y]) // 129 
  2106.  
  2107. vOldPos := y * 10 // 130 
  2108.  
  2109. RETURN // 131 
  2110.  
  2111.  
  2112.  
  2113. LABEL(MsgBox) // 132 
  2114.  
  2115. MESSAGEBOX(vStatus; "Message Box"; "Do you want to cancel this message?"; YesNo! | IconQuestion!) // 133 
  2116.  
  2117. IF(vStatus = 6) // 134 
  2118.  
  2119. WM_ACTIVATE := 0 // 135
  2120.  
  2121. ENDIF // 136
  2122.  
  2123. RETURN // 137 
  2124.  
  2125. Lines 1-3
  2126.  
  2127. Comments about the macro.
  2128.  
  2129. Line 2
  2130.  
  2131. Macros are generally saved to the default macros directory.
  2132.  
  2133. Line 4
  2134.  
  2135. WordPerfect identified as the default application.
  2136.  
  2137. Lines 5-7
  2138.  
  2139. Comments identify the opening CALL statements which outline and define the macro's basic operations.
  2140.  
  2141. Line 8
  2142.  
  2143. Call LABEL(InitializeVariables), which initializes all variables (lines 16-38). A run-time error occurs if you reference a variable that has not been assigned a value. See VarErrChk.
  2144.  
  2145. Line 9
  2146.  
  2147. Call LABEL(CreateDlg) after LABEL(InitializeVariables) returns. LABEL(CreateDlg) creates a dialog box in memory (lines 39-47). It does not display the dialog box.
  2148.  
  2149. Line 10
  2150.  
  2151. Call LABEL(DisplayDlg) after LABEL(CreateDlg) returns. LABEL(DisplayDlg) displays the dialog box and identifies a callback function. See DialogShow.
  2152.  
  2153. Line 11
  2154.  
  2155. CALL LABEL(MessageLoop) after LABEL(DisplayDlg) returns. LABEL(MessageLoop) starts a message loop that suspends the dialog box for callback function (lines 61-74).
  2156.  
  2157. Line 12
  2158.  
  2159. CALL LABEL(QuitMacro) after LABEL(MessageLoop) returns. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
  2160.  
  2161. Lines 13-15
  2162.  
  2163. Comments identify LABELs that correspond to the opening CALL statements (lines 8-12).
  2164.  
  2165. Lines 16-38
  2166.  
  2167. LABEL(InitializeVariables) initializes all variables.
  2168.  
  2169. Lines 17-25
  2170.  
  2171. Initialize variables with numbers that correspond to positions on the scroll bar. See DialogAddScrollBar.
  2172.  
  2173. Line 26
  2174.  
  2175. The position of the most recent list item displayed in the dialog box. This position is cleared of text when a new list item is displayed (lines 127-128).
  2176.  
  2177. Line 27
  2178.  
  2179. The current position for displaying a new list item (line 129).
  2180.  
  2181. Lines 28-30
  2182.  
  2183. Initialize variables to contain Windows message numbers. Using variables makes the macro easier to read. The variable names are user defined, but match the Windows message names. See DialogShow.
  2184.  
  2185. Line 31
  2186.  
  2187. Initialize the loop variable. In this example, vLoop does not receive a new value. The loop ends when the macro ends (line 57). It is possible to end the message loop and not the macro by changing the value of vLoop.
  2188.  
  2189. Line 32
  2190.  
  2191. Creates a 10-element array named List.
  2192.  
  2193. Lines 33-37
  2194.  
  2195. Fills array with the names of 10 fruits. Variable vElement identifies the element to fill.
  2196.  
  2197. Line 38
  2198.  
  2199. RETURN sends macro execution to CALL(CreateDlg).
  2200.  
  2201. Lines 39-47
  2202.  
  2203. LABEL(CreateDlg) creates a dialog box in memory.
  2204.  
  2205. Lines 42-44
  2206.  
  2207. A FORNEXT statement creates a list of names. The Control parameter of DIALOGADDTEXT is set to 0 to allow this command to execute in a FORNEXT statement. This is possible for controls that do not accept input.
  2208.  
  2209. Line 43
  2210.  
  2211. List is a 10-element array. The initial value of variable yPos is also 10. Dividing yPos by 10 reduces yPos to a number that corresponds to an element in the array. DIALOGADDTEXT uses the number to display the contents of the corresponding element.
  2212.  
  2213. Line 44
  2214.  
  2215. ENDFOR closes the FORNEXT statement (line 42).
  2216.  
  2217. Line 45
  2218.  
  2219. Displays the first list item in a second column.
  2220.  
  2221. Line 46
  2222.  
  2223. Displays the initial thumb position.
  2224.  
  2225. Line 47
  2226.  
  2227. RETURN sends macro execution to CALL(DisplayDlg).
  2228.  
  2229. Lines 48-50
  2230.  
  2231. LABEL(DisplayDlg) displays the dialog box and identifies the callback function MsgLoop. RETURN sends macro execution to CALL(StartMessageLoop).
  2232.  
  2233. Lines 51-54
  2234.  
  2235. LABEL(StartMessageLoop) starts the message loop that suspends the dialog box for callback functions (lines 61-74). RETURN sends macro execution to CALL(QuitMacro).
  2236.  
  2237. Lines 55-57
  2238.  
  2239. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
  2240.  
  2241. Lines 58-60
  2242.  
  2243. Comments identify the callback function.
  2244.  
  2245. Lines 61-74
  2246.  
  2247. Callback function MsgLoop responds to three Windows messages and one Control parameter message. See DialogShow.
  2248.  
  2249. Line 62
  2250.  
  2251. SWITCH tests the fifth element of the callback function array. See DialogShow.
  2252.  
  2253. Lines 63-64
  2254.  
  2255. A WM_SYSCOMMAND message is received when the user clicks Close from the system menu box, double-clicks the system menu box, or presses Alt+F4. Macro execution jumps to LABEL(QuitMacro).
  2256.  
  2257. Lines 65-66
  2258.  
  2259. A WM_VSCROLL message is received when the user clicks the scroll bar. The macro calls LABEL(ScrollCtrl).
  2260.  
  2261. Lines 67-68
  2262.  
  2263. A WM_ACTIVATE message is received when the dialog box is activated. The macro calls LABEL(MsgBox).
  2264.  
  2265. Line 69
  2266.  
  2267. ENDSWITCH closes the SWITCH statement (line 62).
  2268.  
  2269. Lines 70-73
  2270.  
  2271. SWITCH tests the third element of the callback function array and determines when Cancel is chosen. See DialogShow. An IF statement also works here. There is often more than one choice to test.
  2272.  
  2273. Line 74
  2274.  
  2275. RETURN sends macro execution to the message loop (lines 52-53).
  2276.  
  2277. Lines 75-96
  2278.  
  2279. LABEL(ScrollCtrl) tests the wParam of the MW_VSCROLL message (line 76).
  2280.  
  2281. Line 76
  2282.  
  2283. SWITCH tests the sixth element(wParam value passed with WM_VSCROLL) of the callback function array to determine the mouse's location when clicked.
  2284.  
  2285. Lines 77-94
  2286.  
  2287. See DialogAddScrollBar for details about WM_VSCROLL messages.
  2288.  
  2289. Lines 77-78
  2290.  
  2291. Scroll bar's right arrow clicked. Call LABEL(LineUp).
  2292.  
  2293. Lines 79-80
  2294.  
  2295. Scroll bar's left arrow clicked. Call LABEL(LineDown).
  2296.  
  2297. Lines 81-82
  2298.  
  2299. Area between the right arrow and thumb clicked. Call LABEL(PageUp).
  2300.  
  2301. Lines 83-84
  2302.  
  2303. Area between the left arrow and thumb clicked. Call LABEL(PageDown).
  2304.  
  2305. Lines 85-86
  2306.  
  2307. Position of thumb after it is dragged, passed as the low-order word of lParam in the seventh element of the callback function array. Call LABEL(Thumb).
  2308.  
  2309. Lines 87-88
  2310.  
  2311. Current position of thumb as it is dragged, passed as the low-order word of lParam in the 7th element of the callback function array. Call LABEL(Thumb). Lines 87-88 call the same function as lines 85-86 and have comment marks (//). To test lines 87-88, add comment marks (//) to lines 85-86 and remove them from 87 and 88 (see //).
  2312.  
  2313. Lines 89-90
  2314.  
  2315. Home key pressed while the scroll bar has the input focus. Call LABEL(PageUp).
  2316.  
  2317. Lines 91-92
  2318.  
  2319. End key pressed while the scroll bar has the input focus. Call LABEL(PageDown).
  2320.  
  2321. Lines 93-94
  2322.  
  2323. Scroll bar activity has ended. Display the current thumb position, contained in variable y.
  2324.  
  2325. Line 95
  2326.  
  2327. ENDSWITCH closes the SWITCH statement (line 76).
  2328.  
  2329. Line 96
  2330.  
  2331. RETURN sends macro execution to LABEL(MsgLoop) callback function.
  2332.  
  2333. Lines 97-101
  2334.  
  2335. LABEL(Thumb) retrieves the thumb position after it is dragged (MsgLoop[6] = SB_THUMBPOSITION), or as it is dragged (MsgLoop[6] = SB_THUMBTRACK).
  2336.  
  2337. Line 98
  2338.  
  2339. Assign the value of MsgLoop[7] (element 7 of the callback function array) to variable y.
  2340.  
  2341. Line 99
  2342.  
  2343. Calculate the low-order word of variable y using the bitwise AND operator. The value assigned to y is the current thumb position.
  2344.  
  2345. Line 100
  2346.  
  2347. Call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
  2348.  
  2349. Line 101
  2350.  
  2351. RETURN sends macro execution to LABEL(ScrollCtrl).
  2352.  
  2353. Lines 102-109
  2354.  
  2355. LABEL(LineUp) is called when the right arrow is clicked to make the current line (value of y) equal to the current thumb position.
  2356.  
  2357. Lines 103-105
  2358.  
  2359. If the current line is not 1, assign the value of y - 1 to y, and call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
  2360.  
  2361. Lines 106-107
  2362.  
  2363. Beep if the value of y equals 1 (if the first item is displayed). (Try changing this so the last item is displayed.)
  2364.  
  2365. Line 108
  2366.  
  2367. ENDIF closes the IF statement (line 103).
  2368.  
  2369. Line 109
  2370.  
  2371. RETURN sends macro execution to LABEL(ScrollCtrl).
  2372.  
  2373. Lines 110-117
  2374.  
  2375. LABEL(LineDown) is called when the left arrow is clicked to make the current line (value of y) equal to the current thumb position.
  2376.  
  2377. Lines 111-113
  2378.  
  2379. If the current line is not 10, assign the value of y + 1 to y, and call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
  2380.  
  2381. Lines 114-115
  2382.  
  2383. Beep if the value of y equals 10 (if the last item is displayed). (Try changing this so the first item is displayed.)
  2384.  
  2385. Line 116
  2386.  
  2387. ENDIF closes the IF statement (line 111).
  2388.  
  2389. Line 117
  2390.  
  2391. RETURN sends macro execution to LABEL(ScrollCtrl).
  2392.  
  2393. Lines 118-121
  2394.  
  2395. LABEL(PageUp) is called when the area between the right arrow and thumb is clicked.
  2396.  
  2397. Line 119
  2398.  
  2399. Assign 1 to variable y to make 1 the current line and thumb position.
  2400.  
  2401. Line 120
  2402.  
  2403. Call LABEL(TypeFruit) to display the first list item on the first line.
  2404.  
  2405. Line 121
  2406.  
  2407. RETURN sends macro execution to LABEL(ScrollCtrl).
  2408.  
  2409. Lines 122-125
  2410.  
  2411. LABEL(PageDown) is called when the area between the left arrow and thumb is clicked.
  2412.  
  2413. Line 123
  2414.  
  2415. Assign 10 to variable y to make 10 the current line and thumb position.
  2416.  
  2417. Line 124
  2418.  
  2419. Call LABEL(TypeFruit) to display the last list item on the last line.
  2420.  
  2421. Line 125
  2422.  
  2423. RETURN sends macro execution to LABEL(ScrollCtrl).
  2424.  
  2425. Lines 126-131
  2426.  
  2427. LABEL(TypeFruit) displays a list item on the line that corresponds to the current thumb position.
  2428.  
  2429. Line 127
  2430.  
  2431. Assign blank spaces to variable vBlank to erase the previous list item when a new one is displayed.
  2432.  
  2433. Line 128
  2434.  
  2435. Erase the previous list item. The vertical position is contained in variable vOldPos that has an initial value of 10 (line 26). This value is updated (line 130) every time LABEL(TypeFruit) is called.
  2436.  
  2437. Line 129
  2438.  
  2439. Type a new list item at the current thumb position times 10 (the current line position). The current thumb position (value of y) identifies the current list item (List[y]).
  2440.  
  2441. Line 130
  2442.  
  2443. Assign the current line position to variable vOldPos to be used (line 128) when this subroutine is called again.
  2444.  
  2445. Line 131
  2446.  
  2447. RETURN sends macro execution to the subroutine's caller.
  2448.  
  2449. Lines 132-137
  2450.  
  2451. LABEL(MsgBox) is called when the dialog box is activated (lines 67-68). If you click No, the dialog box is activated when the message box is dismissed and LABEL(MsgBox) is called again. The message box is called until the user clicks Yes (lines 134-136).
  2452.  
  2453. Line 133
  2454.  
  2455. See MessageBox.
  2456.  
  2457. Lines 134-136
  2458.  
  2459. If variable vStatus equals 6 (Yes chosen), assign 0 to WM_ACTIVATE. Changing the value of WM_ACTIVATE invalidates it as a Windows activate message (lines 30 and 67-68).
  2460.  
  2461. Line 137
  2462.  
  2463. RETURN sends macro execution to LABEL(MsgLoop) callback function.
  2464.  
  2465. Commands that support named parameters
  2466.  
  2467. Note
  2468.  
  2469. Various commands have been changed to enable the passing of parameter names.
  2470.  
  2471.  
  2472.  
  2473. A
  2474.  
  2475.     AppActivate
  2476.  
  2477.     AppExecute
  2478.  
  2479.     AppLocate
  2480.  
  2481.     Assert
  2482.  
  2483. B
  2484.  
  2485.     Beep
  2486.  
  2487. C
  2488.  
  2489.     Cancel
  2490.  
  2491.     Chain
  2492.  
  2493.     CharLen
  2494.  
  2495.     CharPos
  2496.  
  2497.     CToN
  2498.  
  2499. D
  2500.  
  2501.     DDEExecute
  2502.  
  2503.     DDEInitiate
  2504.  
  2505.     DDEPoke
  2506.  
  2507.     DDERequest
  2508.  
  2509.     DDETerminate
  2510.  
  2511.     DDETerminateAll
  2512.  
  2513.     DefaultUnits
  2514.  
  2515.     DllFree
  2516.  
  2517.     DLLLoad
  2518.  
  2519. E
  2520.  
  2521.     EndPrompt
  2522.  
  2523.     Error
  2524.  
  2525. F
  2526.  
  2527.     Fraction
  2528.  
  2529. G
  2530.  
  2531.     GetNumber
  2532.  
  2533.     GetString
  2534.  
  2535.     GetUnits
  2536.  
  2537. N
  2538.  
  2539.     Nest
  2540.  
  2541.     NotFound
  2542.  
  2543.     NToC
  2544.  
  2545.     NumStr
  2546.  
  2547. O
  2548.  
  2549.     OnCancel
  2550.  
  2551.     OnCancel Call
  2552.  
  2553.     OnDDEAdvise Call
  2554.  
  2555.     OnError
  2556.  
  2557.     OnError Call
  2558.  
  2559.     OnNotFound
  2560.  
  2561.     OnNotFound Call
  2562.  
  2563. P
  2564.  
  2565.     Pause
  2566.  
  2567.     PersistAll
  2568.  
  2569.     Prompt
  2570.  
  2571. Q
  2572.  
  2573.     Quit
  2574.  
  2575. R
  2576.  
  2577.     Run
  2578.  
  2579. S
  2580.  
  2581.     SendKeys
  2582.  
  2583.     Speed
  2584.  
  2585.     StrLen
  2586.  
  2587.     StrNum
  2588.  
  2589.     StrPos
  2590.  
  2591.     StrUnit
  2592.  
  2593.     SubChar
  2594.  
  2595.     SubStr
  2596.  
  2597. T
  2598.  
  2599.     ToLower
  2600.  
  2601.     ToUpper
  2602.  
  2603. U
  2604.  
  2605.     UnitStr
  2606.  
  2607. V
  2608.  
  2609.     VarErrChk
  2610.  
  2611. W
  2612.  
  2613.     Wait
  2614.  
  2615. Application
  2616.  
  2617. The product prefix in Application, EndApp, and NewDefault is no longer limited to two characters (it can be the name of the product itself). It is now easier to read a macro when more than one product is involved.
  2618.  
  2619. AppActivate
  2620.  
  2621. Now accepts a window handle or a string as its first parameter.
  2622.  
  2623. AppActivate6023>commands
  2624.  
  2625. AppExecute
  2626.  
  2627. Now supports starting non-program files using Windows' associations.
  2628.  
  2629. AppExecute6025>commands
  2630.  
  2631. Assert
  2632.  
  2633. Now accepts user-defined conditions. See Assert and OnCondition for a description of how to specify a user-defined condition.
  2634.  
  2635. BIF Functions
  2636.  
  2637. BIFFilePath, BIFInfo, BIFRead, and BIFWrite are provided for backward compatibility only. Settings are now located in the Windows Registry, and are accessed with the new Registry commands. If you use the BIF commands, you should specify a BIF filename in the BIFFile parameter.
  2638.  
  2639. Cancel/Error/NotFound/VarErrChk
  2640.  
  2641. Modified to return the previous state (On! or Off!) of a specified condition. Setting a new state is now optional, which means you can get the state (On! or Off!) without changing it.
  2642.  
  2643. Cancel
  2644.  
  2645. Error
  2646.  
  2647. NotFound
  2648.  
  2649. VarErrChk
  2650.  
  2651. DefaultUnits
  2652.  
  2653. Modified to return the previous default units value. You can save the current value, set a new value, then restore the old value. Setting a new value is now optional, which means you can get the default units value without changing it.
  2654.  
  2655. None! has been added to the enumeration list of units values. With None! set, no conversion is performed when a non-units value is added to a units value. The non-units value is assumed to be of the same unit type as the units value.
  2656.  
  2657. DefaultUnits
  2658.  
  2659. Dialog and Region Commands
  2660.  
  2661. Previously, DialogDefine created a dialog immediately. Now dialogs are assembled in memory and not actually created until a DialogLoad or DialogShow command. Region commands that reference a dialog or a dialog control will not work until after DialogLoad or DialogShow. Similarly, DialogHandle will not work until after DialogLoad or DialogShow.
  2662.  
  2663. Old macros may have to be edited to reflect this change.
  2664.  
  2665. Dialog names are now limited to 25 characters in text-based dialog statements (old-style dialogs) and in dialogs created with the Dialog Editor (new-style dialogs).
  2666.  
  2667. For all places where a region name is accepted, two special values may be passed:
  2668.  
  2669. 1. "" If a "" is passed, this is the same as leaving off the region name (where possible) and the current default parent window is used, which is set to the main window of the application that started the macro, but can be changed in the macro at any time using the SetDefaultParent command.
  2670. 2. 
  2671. 3. "*" If a "8" is passed, the Windows desktop window is used (the same as a NULL window handle).
  2672. 4. 
  2673. Dialog Sizing
  2674.  
  2675. Specified a dialog size, including the caption and borders. In Windows 95, captions and borders can be sized by the user. To ensure that dialogs display correctly in any environment, dialog sizes no longer include the space occupied by captions and borders.
  2676.  
  2677. DialogAdd Commands
  2678.  
  2679. You can now add controls to dialogs created with Dialog Editor using DialogAddText, DialogAddListBox, DialogAddPushButton, DialogAddFrame, and so on.
  2680.  
  2681. DialogAddCounter
  2682.  
  2683. Now accepts counters of various unit formats. When a value is entered with no unit of measure (24 instead of 24i), the value is assumed to be the counter type and not the default units type.
  2684.  
  2685. DialogAddCounter
  2686.  
  2687. DialogAddFilenameBox
  2688.  
  2689. The NoValidate! style is no longer supported because of changes to the Open dialog.
  2690.  
  2691. DialogAddFilenameBox
  2692.  
  2693. DialogAddScrollBar
  2694.  
  2695. Left!, Right!, Top!, and Bottom! styles apply to placing a scroll control within a control window. They no longer apply to placing the thumb within the scroll bar. By default, the thumb is positioned at the minimum position of the scroll bar.
  2696.  
  2697. DialogAddScrollBar
  2698.  
  2699. DialogDefine
  2700.  
  2701. NoFrame! style no longer works. In Windows 95, removing a frame also removes the captions bar. For backward compatibility, the NoFrame! style compiles but is non-functional.
  2702.  
  2703. DialogDefine
  2704.  
  2705. DialogDismiss and DialogDestroy
  2706.  
  2707. Dialogs created with Dialog Editor that have no callback are destroyed when a button is pushed. Subsequent calls to DialogDismiss or DialogDestroy result in run-time error messages (the macro system no longer knows anything about the dialog).
  2708.  
  2709. When a callback is declared (see DialogShow), the macro continues to receive and execute instructions (it is not destroyed when a button is pushed). DialogDismiss hides the dialog; DialogDestroy destroys it.
  2710.  
  2711. DialogShow
  2712.  
  2713. Accepts an optional fourth parameter that specifies a control to receive the initial focus.
  2714.  
  2715. The Parent parameter can now be used with text-based (old-style) dialogs.
  2716.  
  2717. In callback dialogs, a WM_INITDIALOG (value 272) is now sent in callback array [5] when the dialog is created.
  2718.  
  2719. DialogShow
  2720.  
  2721. All dialog callbacks should be reviewed and possibly changed to accommodate a 32-bit environment. In particular, entries in the callback array that refer to the wParam (entry [6]), the lParam ([7]), the hiword ([8]), the lParam, and the loword ([9]), should be carefully reviewed. The wParam has been made into a DWord, and many values have been moved between the wParam and the lParam.
  2722.  
  2723. DLLCall and DLLCall Prototype
  2724.  
  2725. Old macros that use DLLCall must be rewritten to work in Windows 95. DLLs and the APIs provided by the DLLs do not exist or have been modified to work in Windows 95.
  2726.  
  2727. DLLCall
  2728.  
  2729. ErrorNumber
  2730.  
  2731. Is now a programming command that returns the last error number. It appears in the documentation with all other commands. For now, the command does not return any new information.
  2732.  
  2733. GetFileDateAndTime
  2734.  
  2735. Returns a numeric value representing the date and time the file was written to. This value is comparable to the value returned by DateAndTime, and can be converted to a string with the DateString and TimeString functions.
  2736.  
  2737. This command used to return the number of seconds since January 1, 1980 in an undocumented format.
  2738.  
  2739. GetFileDateAndTime
  2740.  
  2741. IfPlatform
  2742.  
  2743. The PlatformID for Windows 95 is Win95! (Win32! is also accepted). The old value of Win! is reserved for 16-bit Windows 3.x.
  2744.  
  2745. You can use IfPlatform to start comments, similar to the // command. When the compiler does not recognize a PlatformID value, it ignores all comments between IfPlatform and EndPlatform.
  2746.  
  2747. Example
  2748.  
  2749. IfPlatform (SomeNotes)
  2750.  
  2751. ...comment...
  2752.  
  2753. ...comment...
  2754.  
  2755. ...comment...
  2756.  
  2757. EndPlatform
  2758.  
  2759. Result: Comments between IfPlatform and EndPlatform are ignored by the compiler.
  2760.  
  2761. NumStr
  2762.  
  2763. No longer compatible with WordPerfect's WordPerfect 5.2 for Windows format. You must use the current format and parameter order.
  2764.  
  2765. NumStr
  2766.  
  2767. OnCancel/OnError/OnNotFound
  2768.  
  2769. These commands have been modified to return the label associated with a specified condition (Cancel, Error, or NotFound), as well as to set a new label. If no label was found, "" is returned.
  2770.  
  2771. Leaving off the Label parameter resets condition handling to its initial state.
  2772.  
  2773. OnCancel
  2774.  
  2775. OnError
  2776.  
  2777. OnNotFound
  2778.  
  2779. Prompt
  2780.  
  2781. Accepts a new style named NoButtons! The prompt displays without OK or Cancel buttons, which is useful for displaying "Please Wait" messages.
  2782.  
  2783. Prompt accepts another new style named Pause!, which does the same thing as the Pause command.
  2784.  
  2785. Pause
  2786.  
  2787. Prompt
  2788.  
  2789. Region Commands
  2790.  
  2791. Cannot be used on a dialog until after DialogLoad or DialogShow. DialogLoad creates the dialog in memory; DialogShow creates the dialog and shows it. Before this happens, regions are not associated with a window and have no meaning.
  2792.  
  2793. Storing dialog information and creating the dialog all at once increases performances.
  2794.  
  2795. Creating dialogs this way also makes text-based dialogs and dialogs created with Dialog Editor compatible.
  2796.  
  2797. Dialog names are now limited to 25 characters in text-based dialog statements (old-style dialogs) and in dialogs created with the Dialog Editor (new-style dialogs).
  2798.  
  2799. For all places where a region name is accepted, two special values may be passed:
  2800.  
  2801. 1. "" If a "" is passed, this is the same as leaving off the region name (where possible) and the current default parent window is used, which is set to the main window of the application that started the macro, but can be changed in the macro at any time using the SetDefaultParent command.
  2802. 2. 
  2803. 3. "*" If a "8" is passed, the Windows desktop window is used (the same as a NULL window handle).
  2804. 4. 
  2805. RegionRemoveListItem
  2806.  
  2807. Removes an item with an exact match before it removes an item with a partial match.
  2808.  
  2809. RegionRemoveListItem
  2810.  
  2811. SetFileDateAndTime
  2812.  
  2813. Sets the date and time a file was last written to, using a value returned from the DateAndTime command.
  2814.  
  2815. SetFileDateAndTime used to set the date and time as the number of seconds since January 1, 1980.
  2816.  
  2817. DateAndTime
  2818.  
  2819. SetFileDateAndTime
  2820.  
  2821. StrPos
  2822.  
  2823. No longer compatible with WordPerfect's WordPerfect 5.2 for Windows. You must use the current format and parameter order.
  2824.  
  2825. StrPos
  2826.  
  2827. SubStr
  2828.  
  2829. No longer compatible with WordPerfect Corporation's WordPerfect 5.2 for Windows. You must use the current format and parameter order.
  2830.  
  2831. SubStr
  2832.  
  2833. Changing your existing macros to work with PerfectScript
  2834.  
  2835. This information is a quick overview of things you may need to do to your existing macros to make them work in PerfectScript.
  2836.  
  2837. Keywords
  2838.  
  2839. Review variable, label, procedure, and function names, and change them if the name has become a reserved word. New keywords have been added. These keywords are reserved words and may not be used as variable or label names in macros. In addition, the name of any new commands are considered reserved words, since they also cannot be used as variable or label names. Reserved words for lists of reserved keywords.
  2840.  
  2841. Arrays
  2842.  
  2843. You can pass array slices to repeating parameter groups of commands. In previous versions of PerfectScript, you could pass only entire arrays. Empty slices can now be specified, if the end index is less than the first index.
  2844.  
  2845. Negative array indexes can be used in array slices. If negative, the index is considered to be end relative, not start relative. An index of [-1] means the last element, [-2] is the second to last element, etc.
  2846.  
  2847. You can assign non-arrays to arrays, and arrays to non-arrays. If an array is assigned to a non-array variable, the assignment is actually made to the array variable with the same name as the non-array variable, and the non-array variable is left untouched. If a non-array is assigned to an array variable, the non-array value is converted into a single element array with that value, and assigned to the array variable.
  2848.  
  2849. Non-array values and arrays may be combined with the **(^^) and \ operators.
  2850.  
  2851. When a non-array and an array are combined with the following operators, undefined array elements are ignored and skipped over:
  2852.  
  2853. &
  2854.  
  2855. |
  2856.  
  2857. ^
  2858.  
  2859. <<<
  2860.  
  2861. >>>
  2862.  
  2863. <<
  2864.  
  2865. >>
  2866.  
  2867. ~
  2868.  
  2869. AND
  2870.  
  2871. OR
  2872.  
  2873. XOR
  2874.  
  2875. NOT
  2876.  
  2877. **(^^)
  2878.  
  2879. +
  2880.  
  2881. -
  2882.  
  2883. *
  2884.  
  2885. /
  2886.  
  2887. DIV
  2888.  
  2889. MOD
  2890.  
  2891. %
  2892.  
  2893. \
  2894.  
  2895. unary -
  2896.  
  2897. comparisons
  2898.  
  2899. IN
  2900.  
  2901. JavaScript
  2902.  
  2903. PerfectScript supports JavaScript. PerfectScript can record macros using the JavaScript programming language. To record JavaScript macros, select Tools, Settings, then click the Record tab. Select JavaScript as the script language.
  2904.  
  2905.  
  2906.  
  2907. ** Examples
  2908.  
  2909. vResult = 2**3
  2910.  
  2911. Result: vResult = 8 (2 to the 3rd power)
  2912.  
  2913. vResult = 4**2
  2914.  
  2915. Result: vResult = 16 (4 to the 2nd power)
  2916.  
  2917. + (string) Example
  2918.  
  2919. vStr := "abcdefg" + "xyz"
  2920.  
  2921. Result: vStr = "abcdefgxyz"
  2922.  
  2923. - (string) Example
  2924.  
  2925. vStr := "abcdefg xyz" - " xyz"
  2926.  
  2927. Result: vStr = "abcdefg"
  2928.  
  2929. IN Example
  2930.  
  2931. z := 3 IN {1; 2; 3}
  2932.  
  2933. Result: z = True
  2934.  
  2935. z := 3 IN (1; 2; 4}
  2936.  
  2937. Result: z = False
  2938.  
  2939. z := {1; 2; 3} IN {1; 2; 3}
  2940.  
  2941. Result: z = True
  2942.  
  2943. z := {1; 2; 3} IN {1; 2; 3; 4}
  2944.  
  2945. Result: z = True
  2946.  
  2947. z := {1; 2; 3} IN {1; 2; 4}
  2948.  
  2949. Result: z = False
  2950.  
  2951. Rotate left (<<<) Example
  2952.  
  2953. -2 <<< 2 is 5
  2954.  
  2955. Rotate right (>>>) Example
  2956.  
  2957. 5 >>> 1 is -2147483646
  2958.  
  2959. Bitmaps
  2960.  
  2961. Display bitmap graphics. Accept no input, unless used in a callback function with DialogAddHotspot. See DialogAddHotSpot, DialogAddBitmap, and DialogShow.
  2962.  
  2963. Date Controls
  2964.  
  2965. Display a date. Accept no input. See DialogAddDate.
  2966.  
  2967. Progress Indicators
  2968.  
  2969. Display a progress indicator. See DialogAddProgress.
  2970.  
  2971. Bitwis1e rotate left (<<<) example
  2972.  
  2973. x := -2147450881 <<< 1
  2974.  
  2975. Result: x equals 65535
  2976.  
  2977. Previous Example in binary notation
  2978.  
  2979. <<<10000000000000000111111111111111
  2980.  
  2981. Result: 1111111111111111 (binary 65535)
  2982.  
  2983. Bitwise rotate right (>>>) Example
  2984.  
  2985. x := 65535 >>> 1
  2986.  
  2987. Result: x equals -2147450881
  2988.  
  2989. Previous Example in binary notation
  2990.  
  2991. >>>1111111111111111 (binary 65535)
  2992.  
  2993. Result: 10000000000000000111111111111111
  2994.  
  2995. OLE Object Commands
  2996.  
  2997. OLE object commands are called methods, and they perform tasks on an OLE object in a specific OLE automation server.
  2998.  
  2999. OLE object methods are specific for each object, such as Excel.Application or Excel.Workbooks. They perform various functions on that object.
  3000.  
  3001. OLE object methods that return information about an object are called properties. Many properties have parameters as well as return values. In addition, many properties may be assigned a value by placing them on the left-hand side of the assignment symbol (:=) like the name of a variable.
  3002.  
  3003. See OLE Automation for more information about OLE objects.
  3004.  
  3005. Glossary of Terms
  3006.  
  3007. A
  3008.  
  3009.     ANSI Character Set
  3010.  
  3011.     Any (data type)
  3012.  
  3013.     Argument
  3014.  
  3015. B
  3016.  
  3017.     Boolean (data type)
  3018.  
  3019. C
  3020.  
  3021.     Callback Function
  3022.  
  3023.     Character Expression (string)
  3024.  
  3025.     Check Boxes
  3026.  
  3027.     Command Browser
  3028.  
  3029.     Command Name
  3030.  
  3031.     Control Statement
  3032.  
  3033. D
  3034.  
  3035.     Data Type
  3036.  
  3037.     DLL (Dynamic Link Library)
  3038.  
  3039.     Drop-down List
  3040.  
  3041. E
  3042.  
  3043.     Edit Boxes
  3044.  
  3045.     Enumeration
  3046.  
  3047.     Expression
  3048.  
  3049. L
  3050.  
  3051.     Label
  3052.  
  3053.     List Box
  3054.  
  3055. M
  3056.  
  3057.     Macro Feature Bar
  3058.  
  3059.     Measurement
  3060.  
  3061.     Measurement Expression
  3062.  
  3063. N
  3064.  
  3065.     Numeric Expression (numeric)
  3066.  
  3067.     Numeric Measurement
  3068.  
  3069. O
  3070.  
  3071.     OLE (Object Linking and Embedding)
  3072.  
  3073.     Operator
  3074.  
  3075. P
  3076.  
  3077.     PerfectScript
  3078.  
  3079.     Product Prefix
  3080.  
  3081.     Prompt
  3082.  
  3083. R
  3084.  
  3085.     Radio Button
  3086.  
  3087.     Relational Expression
  3088.  
  3089.     Run-time
  3090.  
  3091. S
  3092.  
  3093.     Scroll Bars
  3094.  
  3095.     String
  3096.  
  3097. T
  3098.  
  3099.     Toggle
  3100.  
  3101. U
  3102.  
  3103.     User-defined Dialog Box
  3104.  
  3105. V
  3106.  
  3107.     Value Set Member
  3108.  
  3109. W
  3110.  
  3111.     Window
  3112.  
  3113.     Window Handle
  3114.  
  3115. Reserved Words
  3116.  
  3117. You should not use reserved words as names for variables, arrays, labels, functions, or procedures. Reserved words include any programming or product macro command.
  3118.  
  3119. A
  3120.  
  3121. ADDRESS
  3122.  
  3123. AND
  3124.  
  3125. ANSISTRING
  3126.  
  3127. APPACTIVATE
  3128.  
  3129. APPEXECUTE
  3130.  
  3131. APPLOCATE
  3132.  
  3133. APPLICATION
  3134.  
  3135. ASSERT
  3136.  
  3137. ASSERTCANCEL
  3138.  
  3139. ASSERTERROR
  3140.  
  3141. ASSERTNOTFOUND
  3142.  
  3143. ASSIGN
  3144.  
  3145. B
  3146.  
  3147. BEEP
  3148.  
  3149. BOOL
  3150.  
  3151. BREAK
  3152.  
  3153. C
  3154.  
  3155. CALL
  3156.  
  3157. CANCEL
  3158.  
  3159. CANCELCONDITION
  3160.  
  3161. CANCELOFF
  3162.  
  3163. CANCELON
  3164.  
  3165. CASE
  3166.  
  3167. CASEOF
  3168.  
  3169. CENTIMETERS
  3170.  
  3171. CHAIN
  3172.  
  3173. CHARLEN
  3174.  
  3175. CHARPOS
  3176.  
  3177. CONTINUE
  3178.  
  3179. CTON
  3180.  
  3181. D
  3182.  
  3183. DDEEXECUTE
  3184.  
  3185. DDEEXECUTEEXT
  3186.  
  3187. DDEINITIATE
  3188.  
  3189. DDEPOKE
  3190.  
  3191. DDEREQUEST
  3192.  
  3193. DDETERMINATE
  3194.  
  3195. DDETERMINATEALLDECLARE
  3196.  
  3197. DEFAULT
  3198.  
  3199. DEFAULTUNITS
  3200.  
  3201. DIGIT
  3202.  
  3203. DISCARD
  3204.  
  3205. DIV
  3206.  
  3207. DLLCALL
  3208.  
  3209. DLLFREE
  3210.  
  3211. DLLLOAD
  3212.  
  3213. DWORD
  3214.  
  3215. E
  3216.  
  3217. ELSE
  3218.  
  3219. ENDAPP
  3220.  
  3221. ENDFOR
  3222.  
  3223. ENDFUNC
  3224.  
  3225. ENDIF
  3226.  
  3227. ENDIFPLATFORM
  3228.  
  3229. ENDPROC
  3230.  
  3231. ENDPROMPT
  3232.  
  3233. ENDSWITCH
  3234.  
  3235. ENDWHILE
  3236.  
  3237. ERROR
  3238.  
  3239. ERRORCONDITION
  3240.  
  3241. ERROROFF
  3242.  
  3243. ERRORON
  3244.  
  3245. ERRORNUMBER
  3246.  
  3247. EXISTS
  3248.  
  3249. F
  3250.  
  3251. FALSE
  3252.  
  3253. FILE
  3254.  
  3255. FOR
  3256.  
  3257. FOREACH
  3258.  
  3259. FORNEXT
  3260.  
  3261. FRACTION
  3262.  
  3263. FUNCTION
  3264.  
  3265. G
  3266.  
  3267. GETNUMBER
  3268.  
  3269. GETUNITS
  3270.  
  3271. GETSTRING
  3272.  
  3273. GLOBAL
  3274.  
  3275. GO
  3276.  
  3277. H
  3278.  
  3279. HIWORD
  3280.  
  3281. I
  3282.  
  3283. IF
  3284.  
  3285. IFPLATFORM
  3286.  
  3287. INCHES
  3288.  
  3289. INDIRECT
  3290.  
  3291. INPUTINTEGER
  3292.  
  3293. L
  3294.  
  3295. LABEL
  3296.  
  3297. LENGTH
  3298.  
  3299. LETTER
  3300.  
  3301. LOCAL
  3302.  
  3303. LOWORD
  3304.  
  3305. M
  3306.  
  3307. MENU
  3308.  
  3309. MENULIST
  3310.  
  3311. MILLIMETERS
  3312.  
  3313. MOD
  3314.  
  3315. N
  3316.  
  3317. NEST
  3318.  
  3319. NEXT
  3320.  
  3321. NEWDEFAULT
  3322.  
  3323. NOT
  3324.  
  3325. NOTFOUND
  3326.  
  3327. NOTFOUNDCONDITION
  3328.  
  3329. NOTFOUNDOFF
  3330.  
  3331. NOTFOUNDON
  3332.  
  3333. NTOC
  3334.  
  3335. NUMSTR
  3336.  
  3337. O
  3338.  
  3339. OEMSTRING
  3340.  
  3341. OFF
  3342.  
  3343. ON
  3344.  
  3345. ONCANCEL
  3346.  
  3347. ONDDEADVISE
  3348.  
  3349. ONERROR
  3350.  
  3351. ONNOTFOUND
  3352.  
  3353. OR
  3354.  
  3355. P
  3356.  
  3357. PAUSE
  3358.  
  3359. PERSIST
  3360.  
  3361. PERSISTALL
  3362.  
  3363. POINTS
  3364.  
  3365. POSITION
  3366.  
  3367. PROCEDURE
  3368.  
  3369. PROMPT
  3370.  
  3371. PROTOTYPE
  3372.  
  3373. Q
  3374.  
  3375. QUIT
  3376.  
  3377. R
  3378.  
  3379. REALREPEAT
  3380.  
  3381. RETURN
  3382.  
  3383. RETURNCANCEL
  3384.  
  3385. RETURNERROR
  3386.  
  3387. RETURNNOTFOUND
  3388.  
  3389. RUN
  3390.  
  3391. S
  3392.  
  3393. SENDKEYS
  3394.  
  3395. SPEED
  3396.  
  3397. STRING
  3398.  
  3399. STRLEN
  3400.  
  3401. STRNUM
  3402.  
  3403. STRPOS
  3404.  
  3405. STRUNIT
  3406.  
  3407. SUBCHAR
  3408.  
  3409. SUBSTR
  3410.  
  3411. SWITCH
  3412.  
  3413. T
  3414.  
  3415. TOLOWER
  3416.  
  3417. TOUPPER
  3418.  
  3419. TRUE
  3420.  
  3421. U
  3422.  
  3423. UNITSTR
  3424.  
  3425. UNTIL
  3426.  
  3427. USE
  3428.  
  3429. V
  3430.  
  3431. VALUE
  3432.  
  3433. VARERRCHK
  3434.  
  3435. VARERRCHKOFF
  3436.  
  3437. VARERRCHKON
  3438.  
  3439. VOID
  3440.  
  3441. W
  3442.  
  3443. WAIT
  3444.  
  3445. WHILE
  3446.  
  3447. WORD
  3448.  
  3449. WPSTRING
  3450.  
  3451. WPUNITS
  3452.  
  3453. WP1200THS
  3454.  
  3455. XYZ
  3456.  
  3457. XOR
  3458.  
  3459. ANSI Character Set
  3460.  
  3461. The 256 characters of the American National Standards Institute.
  3462.  
  3463. Any (data type)
  3464.  
  3465. Accepts more than one data type as input. For example, the command AppActivate (Windows: Any). The Windows parameter accepts a window title (string data type) or a window handle (numeric data type).
  3466.  
  3467. Argument
  3468.  
  3469. A variable, constant, or expression required by a command or function.
  3470.  
  3471. Boolean (data type)
  3472.  
  3473. Accepts or returns a value of True or False.
  3474.  
  3475. Callback Function
  3476.  
  3477. A special function that enables a macro to respond immediately and in specific ways to events such as selecting a radio button or check box, without waiting until a dialog box is dismissed. See DialogShow.
  3478.  
  3479. Character Expression (string)
  3480.  
  3481. One or more characters enclosed in quotation marks, which identifies the characters as text, not a variable.
  3482.  
  3483. Command Browser
  3484.  
  3485. The command browser inserts product and/or programming commands into a macro document. Click the Commands button on the macro toolbar, or use MacroCommandInserter in a macro.
  3486.  
  3487. Control Statement
  3488.  
  3489. Alters the sequential execution of macro commands.
  3490.  
  3491. DLL (Dynamic Link Library)
  3492.  
  3493. A library of functions and procedures that can be called from a macro.
  3494.  
  3495. Drop-down List
  3496.  
  3497. A type of list available to a Combo Box control. See DialogAddComboBox.
  3498.  
  3499. Expression
  3500.  
  3501. Represents values, and can be arithmetic, numeric, measurement, relational, logical, bitwise, or a character string.
  3502.  
  3503. Macro Feature Bar
  3504.  
  3505. A toolbar that contains tools for writing and editing macros. It contains buttons for saving, compiling, inserting macro commands, and so on. Click Tools  Macros  Macro Toolbar to display it.
  3506.  
  3507. Measurement Expression
  3508.  
  3509. A number followed by a unit of measure (", i, c, m, p, w).
  3510.  
  3511. Numeric Expression (numeric)
  3512.  
  3513. A number on which mathematical operations may be performed. Numeric expressions are not enclosed in quotation marks.
  3514.  
  3515. OLE (Object Linking and Embedding)
  3516.  
  3517. A feature that copies information from one document to another (embedding), through a "live" link. When the original document changes, the embedded copy reflects the changes.
  3518.  
  3519. Operator
  3520.  
  3521. A symbol or word that performs a function on one or more expressions. Operators compare expressions, link words together, and perform mathematical functions.
  3522.  
  3523. PerfectScript
  3524.  
  3525. An application used to record, play, compile, convert, and edit macros. PerfectScript is used to build or edit dialog boxes for macros.
  3526.  
  3527. Product Prefix
  3528.  
  3529. A two-character expression that specifies a product for a macro command.
  3530.  
  3531. Prompt
  3532.  
  3533. A message box that displays information for the user.
  3534.  
  3535. Relational Expression
  3536.  
  3537. An expression that evaluates parameters with only two possible states: TRUE and FALSE.
  3538.  
  3539. Run-time
  3540.  
  3541. Execution time. Run-time errors occur during macro execution. Run-time options are application start-up settings, such as the macros default directory.
  3542.  
  3543. String
  3544.  
  3545. A data type that accepts characters enclosed in double quotation marks.
  3546.  
  3547. User-defined Dialog Box
  3548.  
  3549. A custom dialog box created with Dialog programming commands that display options for user input.
  3550.  
  3551. Window
  3552.  
  3553. Each window has a title bar, a menu bar, and an Application Bar, and may contain a Property Bar, scroll bar, toolbar, and Ruler. The Equation Editor window has separate editing and display areas called panes.
  3554.  
  3555. Window Handle
  3556.  
  3557. A unique identifier for a window or control.
  3558.  
  3559. Data Type
  3560.  
  3561. Defines the set of values that a variable can store. The data types are numeric, string, measurement, boolean, any, enumeration, and label.
  3562.  
  3563. Enumerated Type
  3564.  
  3565. The parameters for some product commands accept only certain predefined words known as "enumerated types." Enumerated types end with exclamation points. For example, the DisplayMode parameter accepts only Text!, Graphics!, or FullPage!.
  3566.  
  3567. Value Set Member
  3568.  
  3569. A value in an enumeration list. An enumeration is a data type.
  3570.  
  3571. Toggle
  3572.  
  3573. A toggle command switches between states. For example, the WordPerfect Bold command can be On! or Off!. If On! or Off! is not specified, Bold "toggles" between the two states each time it is called. If Bold is Off!, it is turned On!. If Bold is On!, it is turned Off!.
  3574.  
  3575. Numeric
  3576.  
  3577. Pop-up text can be inserted in the ROUTE field of the database or here in the topic file. If you insert it in the database, leave the <ROUTE> style to signal the precompiler to bring in the text. If you wish to enter text in the file, remove the <ROUTE> style.
  3578.  
  3579. Label
  3580.  
  3581. A subroutine similar to a procedure or function. A Label generally contains one or more statements followed by Return or Quit.
  3582.  
  3583. Measurement (data type)
  3584.  
  3585. All Measurement return values are returned in WordPerfect units. Necessary unit conversions are done internally when comparing two measurement values. Recorded macros use the units specified in the application preferences. When specifying a measurement value in a product command parameter, WordPerfect units (w) are assumed unless other units are specified in the parameter or with the DefaultUnits command.
  3586.  
  3587. Measurement
  3588.  
  3589. A data type that accepts a measurement value in inches, millimeters, WP units, and so on. For example, 72P (points) is equal to 1I (inch) and to 2.54C (centimeters).
  3590.  
  3591. Command Name
  3592.  
  3593. Command names often describe the action, such as Font, MarginLeft, Advance, and FootnoteOptions. Command names execute product features (product commands) or direct the execution of the macro (programming commands, for example, If, Else, End If). 
  3594.  
  3595. Syntax
  3596.  
  3597. The command grammar or sequence: command names, parameter names, and parameter types.
  3598.  
  3599. Command Names
  3600.  
  3601. There are two general types of macro commands: product commands and programming commands.
  3602.  
  3603. Product Commands
  3604.  
  3605. Product commands are specific for each application, such as WordPerfect or Corel Presentations. They perform various functions in that application, such as:
  3606.  
  3607. * display a dialog box (InitialCodesStyleDlg)
  3608. * specify settings such as styles (BorderBottomLine), user preferences (PrefZoom), or attributes (Font)
  3609. * turn features on and off (InhibitInput or TableCellIgnoreCalculation)
  3610. * perform actions such as inserting a file (FileInsert) or code (PrinterCommand), renaming a bookmark (BookmarkRename), converting comments to text (CommentConvert), or moving the insertion point (PosColBottom)
  3611. * play macros that are included with the application (FontDnShippingMacro)
  3612. * Product commands that report information (return value) about the state of an application or feature are sometimes called system variables. In WordPerfect, system variables begin with a leading question mark (?ColumnWidth). In Corel Presentations, they begin with a leading Env (EnvPaths). Some system variables in Corel Presentations have parameters as well as return values.
  3613. Programming Commands
  3614.  
  3615. Programming commands work across applications. Product commands control or return information about applications and feature functions. Programming commands generally control macro functions, such as:
  3616.  
  3617. ¿    specify conditions under which other macro commands or statements will operate (CASE, IF ELSE ENDIF, SWITCH ENDSWITCH)
  3618.  
  3619. ¿    repeat macro commands or statements a specified number of times or until certain conditions are met (FOR ENFOR, REPEAT UNTIL, WHILE ENDWHILE)
  3620.  
  3621. ¿    invoke or jump to a specified subroutine (statement block) with CALL or GO
  3622.  
  3623. The Command Inserter keeps programming commands and product commands in separate lists. Click the button under Type to display and select the list you want.
  3624.  
  3625. Parameter Names
  3626.  
  3627. Using parameter names is optional. InhibitInput (State: Off!) works just like InhibitInput (Off!). Some product commands have no parameters. Their syntax is usually written with empty parameters, such as PosScreenUp(). Some programming commands and WordPerfect system variables have no parameters. Their syntax is the command name alone, such as PAUSE and ?FeatureBar.
  3628.  
  3629. Italics
  3630.  
  3631. Italics in Macros Help Syntax indicate parameter names or types to be replaced with data. For example, the syntax of GraphicsLineLength is:
  3632.  
  3633. GraphicsLineLength (Length: measurement)
  3634.  
  3635. After you replace measurement with a number, the command might be:
  3636.  
  3637. GraphicsLineLength (Length: 2I)
  3638.  
  3639. or
  3640.  
  3641. GraphicsLineLength (2I)
  3642.  
  3643. Punctuation
  3644.  
  3645. Enclose parameters in parentheses. A missing parenthesis, either opening or closing, is a common error that prevents macros from compiling.
  3646.  
  3647. Spaces between command names and the opening parenthesis of the parameter section and after semicolons in parameters are optional.
  3648.  
  3649. Separate multiple parameters with semicolons(;). If you omit an optional parameter, include the semicolon in the Syntax to keep following parameters in their correct positions. For example,
  3650.  
  3651. AbbreviationExpand (AbbreviationName:; Template: PersonalLibrary!)
  3652.  
  3653. or
  3654.  
  3655. AbbreviationExpand (; PersonalLibrary!)
  3656.  
  3657. Enclose repeating parameters in braces. For example, CASE (<Test>: Any; {<Case>: Any; <Label>: label; Case: Any; <Label>: <Label>...}. When data is supplied, the command could be CASE (vChoice; {1; Exclaim; 2; Info; 3; Question; 4; Stop; 5; QuitMacro}; QuitMacro).
  3658.  
  3659. Enumerations are identified by a trailing exclamation point (Printer!).
  3660.  
  3661. Data Types and Return Values
  3662.  
  3663. A data type represents information that is needed by a parameter or returned by a command (return value).
  3664.  
  3665. A list of return values shows the possible values that can be returned for that command.
  3666.  
  3667. In the command syntax, data types are displayed in italics. For example, the enumerations for the Rotation parameter of BoxCaptionRotation are Degrees90!, Degrees 180!, Degrees 270!, and None!. Only these enumerations can replace the data type in the command syntax. Note that enumerations are identified by a trailing exclamation point.
  3668.  
  3669. The most common data types in product commands are string, enum, numeric. Programming commands also frequently use variable.
  3670.  
  3671. ¿    string Represents text you provide, such as a filename, a dialog box control name, message box text, or a character sequence to insert into a document. Strings may include numbers. Enclose strings in quotation marks. For example, Type ("1") and MESSAGEBOX (vStatus; "VAR" + x; "Continue to next variable?" ; IconQuestion! |YesNo!!)
  3672.  
  3673. ¿    enumeration Represents options provided by the program, such as styles, types, methods, state, and so on. For example, in WordPerfect, On!, Heading8Style!, and DefFlushRight! are enumerations used by different commands. Enumerations always end with an exclamation point.
  3674.  
  3675. ¿    numeric Represents a number, such as the number of seconds, a line number, or an outline level.
  3676.  
  3677. ¿    measurement Represents a unit of measure, such as inches, picas, or WordPerfect units.
  3678.  
  3679. ¿    token id Represents the name of a macro command (InvokeDialog).
  3680.  
  3681. ¿    variable A variable name must begin with a letter and is not case sensitive. (Variables in Macro Help examples all begin with a leading v.) Variables can include any combination of letters or numbers up to 50 characters. For example, you could "assign" the value "C:\COREL\OFFICE7\WPWIN7\" to variable "vPath," then substitute the variable for the path in the rest of the macro.
  3682.  
  3683. You can change the value of a variable. If variable vNmbr equals 5, then the expression vNmbr := vNmbr + 1 results in vNmbr equaling 6.
  3684.  
  3685. Buttons
  3686.  
  3687. To see how to record a command, click To Record.
  3688.  
  3689. For sample macros and command clusters that use this command, click Example.
  3690.  
  3691. Enumerations
  3692.  
  3693. Options provided by the program, such as styles, types, and methods, are called enumerations. For example, in WordPerfect, On!, Heading8Style!, and DefFlushRight! are enumerations used by different commands. Enumerations always end with an exclamation point.
  3694.  
  3695. Click the red word to read information about that item.
  3696.  
  3697.  
  3698.