Chapter 11

See Graphic

Corel® PerfectScript™ Programming Commands





Corel® PerfectScript™ Programming Commands

Three new macro commands have been added: MacroCompile, MacroIsCompiled, and MacroPlay. See online Help for information about these commands. Also, the following commands have been changed: DialogAddControl, DialogDelete, FileFind, FileNameDialog, GetFileAttributes, MacroInfo, OLEAutomation, and SetFileAttributes. See online Help for information about these commands.


RadiansToDegrees

Purpose Convert an angle in radians to degrees.
 
Return Value Angle in radians converted to degrees.
 
Syntax
numeric := RadiansToDegrees (Radians: numeric)
 
Parameters
Radians numeric The angle in radians

Randomize

Purpose Randomize the random number seed.
 
Return Value Randomized number.
 
Syntax
numeric := Randomize ([Seed: numeric])
 
Parameters
Seed numeric (optional) The seed value that starts the random number generator. If missing, the current system clock is used to pick a starting seed.

RandomNumber

Purpose

Get a random number in a range.

If only a Minimum or Maximum value is given (see Parameters below), a number between 0.0 and that value is returned. The range includes 0.0; it does not include the value. If no values are given, a number between 0.0 and 1.0 is returned. The range includes 0.0; it does not include 1.0.

 
Return Value Random number in a range.
 
Syntax
numeric := RandomNumber ([Minimum: numeric]; [Maximum: numeric])
 
Parameters
Minimum numeric (optional) Minimum number to generate. Default: 0.0
Maximum numeric (optional) Maximum number to generate. Default: 1.0

RandomSeed

Purpose Get the current seed of the random number generator.
 
Return Value Value of the random seed. This seed is used to generate the next random number, after which the random seed is updated to a new value.
 
Syntax numeric := RandomSeed ()

Real

Purpose Pass a value as an 8-byte float (DLL call in0line parameter function). See DLLCall.
 
Return Value numeric
 
Syntax
numeric := Real (<Value> numeric)

RegionAddListItem

Purpose

Add an item to a list box, combination box, popup button, or custom control.

The only way to add a list item to a custom control is with RegionAddListItem, or by sending the custom control a message. DialogAddListItem does not work on custom controls.

Controls added with DialogAddControl are considered custom controls. The user is responsible for the use of these controls.

 
Examples Appendix A: 8065
 
Return Value Index (position) of the added item, or the index of the last item in a repeating group if successful, or -1 if not.
 
Syntax
numeric := RegionAddListItem (NamedRgn: string; {Item: string; ...})
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
Item string (repeating parameter) One or more list items separated by a semicolon.

RegionAddListItemByIndex

Purpose

Add an item to a list box, combination box, popup button, or custom control, at a specified index. Indexes are 1 based.

The only way to add a list item to a custom control is with RegionAddListItem or RegionAddListItemByIndex, or by sending the custom control a message. DialogAddListItem does not work on custom controls.

Controls added with DialogAddControl are considered custom controls. The user is responsible for the use of these controls.

 
Return Value The index (position) of the added item. Indexes are 1 based.
 
Syntax
numeric := RegionAddListItemByIndex (NamedRgn: string; Item: string; Index: numeric)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Item string The item to add.
Index numeric The index (position) where to add an item. Indexes are 1 based.

RegionEnableWindow

Purpose Enable or disable mouse and keyboard input to a dialog box or control.
 
Examples Appendix A: 8066
 
Return Value

If State is left off, return the current state of the named region.

If State is specified, return the previous state of the named region.

Enabled! Named region was enabled.
Disabled! Named region was disabled.
 
Syntax
enumeration := RegionEnableWindow (NamedRgn: string; [State: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period. If a control ID is not specified, State affects the entire dialog box.
State enumeration (optional) Set mouse and keyboard input state. If left off, the current state of the named region is returned.
Disable! Disable named region.
Enable! Enable named region.

RegionGetCheck

Purpose

Report the state of a check box control.

 
Examples Appendix A: 8067
 
Return Value
Up!
Down!
Checked!
Unchecked!
Indeterminate!
Gray! Same as Indeterminate!.
 
Syntax
enumeration := RegionGetCheck (NamedRgn: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionGetClass

Purpose Return the class name (Windows) of a named region.
 
Examples Appendix A: 8105
 
Return Value

Windows class name.

 
Syntax
string := RegionGetClass (NamedRgn: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.

RegionGetHandle

Purpose Return the window handle of a named region.
 
Examples Appendix A: 8095
 
Return Value If the named region does not exist, use OnError to handle error message.
 
Syntax
numeric := RegionGetHandle (NamedRgn: string)
 
Parameters
NamedRgn string

The Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.

If the control ID is not specified, the Window handle of the dialog box is returned.


RegionGetListContents

Purpose Retrieve all the items in a specified list control.
 
Return Value Text of items separated by the item separator.
 
Syntax
string := RegionGetListContents (NamedRgn: string; [ItemSeparator: string])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region (list control). Enclose IDs in double quotation marks, separated by a period.
ItemSeparator string (optional) String used to separate items in the return value. If missing, ";" is used.

RegionGetListCount

Purpose Return the number of items in a list or combo box, or pop-up button.
 
Examples Appendix A: 8100
 
Return Value numeric
 
Syntax
numeric := RegionGetListCount (NamedRgn: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionGetListItem

Purpose Return the index of an item in a list control.
 
Return Value Index (position) of a list item, or -1 on error.
 
Syntax
numeric := RegionGetListItem (NamedRgn: string; Item: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Item string The list item.

RegionGetListItemByIndex

Purpose Return an item from a list control by its index.
 
Return Value List item text.
 
Syntax
string := RegionGetListItemByIndex (NamedRgn: string; Index: numeric)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Index numeric The index (position) of a list item.

RegionGetListSelectedCount

Purpose Return count of the selected items in a list box, combination box, or custom control.
 
Return Value The number of selected items.
 
Syntax
numeric := RegionGetListSelectedCount (NamedRgn: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.

RegionGetModified

Purpose Determine whether an edit control's contents have been modified (DialogAddCounter, DialogAddDate, DialogAddEditBox, DialogAddFilenameBox). See RegionSetModified.
 
Examples Appendix A: 8101
 
Return Value

True if an edit control has been modified, False if not.

 
Syntax
boolean := RegionGetModified (NamedRgn: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionGetPosition

Purpose

Returns size and position information about a named region. Missing optional parameters are not returned.

 
Return Value True if the specified region exists, False if not.
 
Syntax
boolean := RegionGetPosition (NamedRgn: string; [LeftVar: variable]; [TopVar: variable]; [WidthVar: variable]; [HeightVar: variable]; [Units: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
LeftVar variable (optional) Variable to receive the coordinate of the left edge of the region.
TopVar variable (optional) Variable to receive the coordinate of thp edge of the region.
WidthVar variable (optional) Variable to receive the width of the region.
HeightVar variable

(optional) Variable to receive the height of the region. Units: enumeration (optional)

Type of units to return the measurements in. If missing, and the region is a region on a macro dialog, DialogUnits! is used. Otherwise, if missing, ScreenUnits! is used.

ScreenUnits! Values are returned in screen units (pixels) relative to the region's parent.
DialogUnits! Values are returned in dialog units relative to the region's parent.

RegionGetSelectedText

Purpose Returns selected text in a control such as a list box, combination box, or counter. To return a control's full text use RegionGetWindowText.
 
Examples Appendix A: 8068
 
Return Value Selected text. If no text is selected, an empty string ("") is returned.
 
Syntax
string := RegionGetSelectedText (NamedRgn: string; [ItemSeparator: string])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
ItemSeparator string (optional) A string to insert between sub-string items. If missing, a semicolon is used.

RegionGetWindowText

Purpose Get caption bar, static text, or edit box text.
 
Examples Appendix A: 8069
 
Return Value Specified text.
 
Syntax
string := RegionGetWindowText (NamedRgn: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period. To get the caption bar text, leave off the Control ID or named region. For example, vText := RegionGetWindowText ("Dialog1").

RegionIsEnabled

Purpose Indicates whether a specified region is enabled.
 
Return Value True if the named region is enabled, False if not.
 
Syntax
boolean := RegionIsEnabled (NamedRgn: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region (list control). Enclose IDs in double quotation marks, separated by a period.

RegionIsVisible

Purpose Determine the visibility state of a region or window.
 
Examples Appendix A: 8094
 
Return Value True if visible, False if not. Window's WS_VISIBLE flag determines the return value, which can be nonzero even if the window is hidden by other windows. See your Windows 95 documentation for more information.
 
Syntax
boolean := RegionIsVisible (NamedRgn: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionMoveWindow

Purpose Move and/or resize a dialog box or control.
 
Examples Appendix A: 8070
 
Syntax
RegionMoveWindow (NamedRgn: string; [Left: numeric]; [Top: numeric]; [Width: numeric]; [Height: numeric]; [Units: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period. To move or resize the dialog box, leave off the Control ID or named region. For example, RegionMoveWindow ("Dialog1"; ...)
Left numeric (optional) The number of dialog units from the left side of the screen to the left side of the dialog box, or the number of dialog units from the left side of the dialog box to the left side of the control. If missing, no change is made.
Top numeric (optional) The number of dialog units from the top of the screen to the top of the dialog box, or the number of dialog units from the top of the dialog box to the top of the control. If missing, no change is made.
Width numeric (optional) The width of the dialog box or control in dialog units. If missing, no change is made.
Height numeric (optional) The height of the dialog box or control in dialog units. If missing, no change is made.
Units enumeration (optional) Specifies the type of units used by Left, Top, Width, and Height parameters. If missing, AbsolutePosition! is used with units appropriate to the windows type. If the window is a named region on a user-defined dialog, DialogUnits! is used. Otherwise, if missing, ScreenUnits! is used. AppropriateUnits!
ScreenUnits!
DialogUnits! Left, Top, Width, and Height are specified in dialog units (the same units used to create the user dialog).
AbsolutePosition! Left, Top, Width, and Height are absolute positions and sizes. (Window position is always relative to its parent.)
RelativePosition! Left, Top, Width, and Height are relative to the current position and size of the window.

RegionRemoveListItem

Purpose Remove a list item from a list box, combination box, or pop-up button. Exact match items are removed before partial match items.
 
Examples Appendix A: 8071
 
Syntax
RegionRemoveListItem (NamedRgn: string; Item: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
Item string A list item.

RegionRemoveListItemByIndex

Purpose Remove an item from a list control by its index.
 
Syntax
RegionRemoveListItemByIndex (NamedRgn: string; Index: numeric)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Index numeric The index (position) of a list item.

RegionResetList

Purpose Clear the contents of a list box, combination box, or pop-up button.
 
Examples Appendix A: 8072
 
Syntax
RegionResetList (NamedRgn: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionSelectListItem

Purpose Select an item in a list box, combination box, or pop-up button.
 
Examples Appendix A: 8073
 
Return Value Return the index (1-based) of the selected item.
 
Syntax
numeric := RegionSelectListItem (NamedRgn: string; Item: string; [Selection: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
Item string A list item.
Selection enumeration (optional) Selection options. If missing, Extend! is used. For single selection lists, Extend! works the same as Select!.
Select! Unselect all selected items, and select this item.
Unselect! Unselect this item from the current selection.
Extend! Extend the current selection to include this item.

RegionSelectListItemByIndex

Purpose Select an item in a list control by its index.
 
Return Value The selected item.
 
Syntax
string := RegionSelectListItemByIndex (NamedRgn: string; Index: numeric; [Selection: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Index numeric The index (position) of a list item.
Selection enumeration (optional) The type of selection action to perform. Default: Select!
Select! Select this item after deselecting all other items.
UnSelect! Deselect this item from the current selection.
Extend! Extend the current selection to include this item.

RegionSetBitmap

Purpose

Set a bitmap file in a bitmap control.

This token replaces RegionSetBitmapFilename, and adds the ability to use a bitmap in a DLL or EXE.

 
Examples Appendix A: 8104
 
Syntax
RegionSetBitmap (NamedRgn: string; Filename: string; [Name: string])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Filename string The filename of a bitmap, or the filename of a DLL or EXE containing a bitmap.
Name string (optional) The Resource ID, or name of a bitmap in a DLL or EXE (see the Filename parameter). IDs must begin with #.

RegionSetCheck

Purpose Select/deselect a check box.
 
Examples Appendix A: 8074
 
Syntax
RegionSetCheck (NamedRgn: string; State: enumeration)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
State enumeration Sets the state of a check box control.
Checked! (Named Check! in version 7.)
Unchecked! (Named Uncheck in version 7.)
Gray! Check box control must be Three-state or Auto three-state. See DialogAddCheckBox.
Indeterminate! Same as Gray!.
Up! Same as Checked!.
Down! Same as Unchecked!.

RegionSetEditSelection

Purpose Select the text or a portion of text in a text edit control.
 
Syntax
RegionSetEditSelection (NamedRgn: string; [Start: numeric]; [End: numeric])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Start numeric (optional) The start index (position) of the text to select. If missing, all the text is selected.
End numeric (optional) The end index (position) of the text to select. If missing, all the text is selected.

RegionSetFocus

Purpose Give input focus to a specified control.
 
Examples Appendix A: 8075
 
Return Value Window handle of the region that used to have focus, or NULL if not successful.
 
Syntax
numeric := RegionSetFocus (NamedRgn: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.

RegionSetModified

Purpose Set the modified state of an edit control (DialogAddCounter, DialogAddDate, DialogAddEditBox, DialogAddFilenameBox). See RegionGetModified.
 
Examples Appendix A: 8103
 
Syntax
RegionSetModified (NamedRgn: string; [State: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
State enumeration (optional) If missing, Modified! is used.
Modified!
NotModified!

RegionSetProgressPercent

Purpose Set the percentage to display in a progress control. See DialogAddProgress.
 
Examples Appendix A: 8098
 
Syntax
RegionSetProgressPercent (NamedRgn: string; Percent: numeric)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period.
Percent numeric The percentage to set.

RegionSetSelectedText

Purpose Set the selected text of a named region.
 
Syntax
RegionSetSelectedText (NamedRgn: string; Item: string)
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region. Enclose IDs in double quotation marks, separated by a period.
Item string The item to select.

RegionSetWindowText

Purpose Replace caption bar, static text, or edit box text.
 
Examples Appendix A: 8076
 
Syntax
RegionSetWindowText (NamedRgn: string; Item: string)
 
Parameters
NamedRgn string The Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period. To replace the caption bar text, leave off the Control ID or named region. For example, RegionSetWindowText ("Dialog1").
Item string The replacement text.

RegionShowWindow

Purpose Show/hide a dialog box or control.
 
Examples Appendix A: 8077
 
Syntax
RegionShowWindow (NamedRgn: string; [State: enumeration])
 
Parameters
NamedRgn string Dialog ID and control ID, or Dialog ID and name of a named region, or window handle of the named region. Enclose IDs in double quotation marks, separated by a period. If you do not use the control ID, the command works on the dialog box.
State enumeration (optional) The display state. If missing, Show! is used.
Hide!
Show!
ShowMinimized!
ShowMaximized!
Maximize!
ShowNoActivate!
Normal!
ShowNormal!
Minimize!
ShowMinNoActive!
ShowNA!
ShowRestore!
ShowDefault!

RegistryCloseKey

Purpose Close an open key in the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\Applications")
RegistryCloseKey(RegKey)
 
Return Value Return 0 if successful, an error code if not.
 
Syntax
numeric := RegistryCloseKey (Hkey: numeric)
 
Parameters
Hkey numeric Handle of a key to close.

RegistryCreateKey

Purpose Create or open a key in the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8")
CreateKey:= RegistryCreateKey(RegKey; "MyKey")
Prompt("RegistryCreateKey"; CreateKey;)
Pause
 
Return Value Window handle of a created key.
 
Syntax
numeric := RegistryCreateKey (Hkey: enumeration; SubKey: string)
 
Parameters
Hkey Enumeration
ClassesRoot! Access HKEY_CLASSES_ROOT.
CurrentUser! Access HKEY_CURRENT_USER.
LocalMachine! Access HKEY_LOCAL_MACHINE.
Users! Access HKEY_USERS.
PerformanceData! Access HKEY_PERFORMANCE_DATA.
CurrentConfig! Access HKEY_CURRENT_CONFIG.
DynData! Access HKEY_DYN_DATA.
SubKey string Name of a key to create.

RegistryDeleteKey

Purpose

Delete a key from the Windows Registry.

 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8") 
DeleteKey:= RegistryDeleteKey(RegKey; "MyKey")
Prompt("RegistryDeleteKey"; DeleteKey;)
Pause
 
Return Value Return 0 if successful, an error code if not.
 
Syntax
numeric := RegistryDeleteKey (Hkey: numeric; SubKey: string)
 
Parameters
Hkey numeric Handle of an opened key.
SubKey string Key to delete.

RegistryDeleteValue

Purpose

Delete a value from the Windows Registry.

 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\MyKey\My Other SubKey")
DeleteValue:=RegistryDeleteValue(RegKey; ) 
Prompt("RegistryDeleteValue"; DeleteValue;) 
Pause
 
Return Value Return 0 if successful, an error code if not.
 
Syntax
numeric := RegistryDeleteValue (Hkey: numeric; [Value: string])
 
Parameters
Hkey numeric Handle of key to delete.
Value string (optional) Value to delete.

RegistryEnumKey

Purpose Enumerate a key from the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8")
EnumString:=RegistryEnumKey(RegKey; 100)
RegError = RegistryQueryLastError()
Prompt("RegistryEnumKey"; "RegistryEnumKey was "+EnumString+". RegistryQueryLastError was "+RegError+".")
Pause
 
Return Value Subkey number.
 
Syntax
string := RegistryEnumKey (Hkey: numeric; SubKeyNumber: numeric)
 
Parameters
Hkey numeric Handle of an opened key.
SubKeyNumber Numeric

RegistryEnumValue

Purpose

Enumerate a value from the Windows Registry.

 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\Applications")
EnumString:=RegistryEnumValue(RegKey; 1)
Prompt("RegistryEnumValue"; EnumString)
Pause

//Test RegistryEnumValue with errors
RegKey = RegistryOpenKey(CurrentUser!; "Software\Corel\PerfectScript\8\Macro Help Files")
EnumString:=RegistryEnumValue(RegKey; 25)
RegKey:= RegistryQueryLastError()
Prompt("RegistryEnumValue Failure"; EnumString; Pause!)
Prompt("RegistryQueryLastError"; RegKey)
Pause
 
Return Value string
 
Syntax
string := RegistryEnumValue (Hkey: numeric; ValueNumber: numeric)
 
Parameters
Hkey Numeric
ValueNumber Numeric

RegistryOpenKey

Purpose Open a key in the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\Applications")
 
Return Value Handle of the opened key if successful, an error code if not.
 
Syntax
numeric := RegistryOpenKey (Hkey: enumeration; SubKey: string)
 
Parameters
Hkey Enumeration
ClassesRoot! Access HKEY_CLASSES_ROOT.
CurrentUser! Access HKEY_CURRENT_USER.
LocalMachine! Access HKEY_LOCAL_MACHINE.
Users! Access HKEY_USERS.
PerformanceData! Access HKEY_PERFORMANCE_DATA.
CurrentConfig! Access HKEY_CURRENT_CONFIG.
DynData! Access HKEY_DYN_DATA.
SubKey String

RegistryQueryKeyCount

Purpose

Get the count of subkeys under a key in the Windows Registry.

 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8")
KeyCount:=RegistryQueryKeyCount(RegKey)
Prompt("RegistryQueryKeyCount"; KeyCount)
Pause
 

Return Valuecount.

 
Syntax
numeric := RegistryQueryKeyCount (Hkey: numeric)
 
Parameters
Hkey numeric Key for which to return a count of the subkeys.

RegistryQueryLastError

Purpose Return the last error code.
 
Examples
RegKey:= RegistryQueryLastError()
Prompt("RegistryQueryLastError"; RegKey)
Pause
 
Return Value Error code, or 0 if none available.
 
Syntax numeric := RegistryQueryLastError ()

RegistryQueryValue

Purpose Obtain a value from the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8")
QueryString:=RegistryQueryValue(RegKey; "PerfectScript")
Prompt("RegistryQueryValue"; QueryString)
Pause
 
Return Value Windows Registry value.
 
Syntax
any := RegistryQueryValue (Hkey: numeric; Value: string; [Type: variable])
 
Parameters
Hkey Numeric
Value String
Type variable (optional) The type of value is returned to this variable.

RegistryQueryValueCount

Purpose Return the count of values under a key in the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\Location of Help Files")
QueryKey=RegistryQueryValueCount(RegKey)
Prompt("RegistryQueryValueCount"; QueryKey)
Pause
 
Return Value Count of values under a Windows Registry key.
 
Syntax
numeric := RegistryQueryValueCount (Hkey: numeric)
 
Parameters
Hkey Numeric

RegistrySetValue

Purpose Save a value in the Windows Registry.
 
Examples
RegKey = RegistryOpenKey(LocalMachine!; "Software\Corel\PerfectScript\8\MyKey")
//CreateKey:= RegistryCreateKey(RegKey; "My SubKey")
SetKey := RegistrySetValue(RegKey; "My SubKey"; "Working"; PFString!)
Prompt("RegistrySetValue - PFString!"; "If RegistrySetValue was successful this should be a zero: "+SetKey;)
Pause

CreateKey:= RegistryCreateKey(RegKey; "My Other SubKey")
SetKey:=RegistrySetValue(RegKey; "My Other SubKey"; "Really Working"; PFDWord!)
Prompt("RegistrySetValue - PFDWord!"; "If RegistrySetValue was successful this should be a zero: "+SetKey;)
Pause

CreateKey:= RegistryCreateKey(RegKey; "My Other Other SubKey")
SetKey:=RegistrySetValue(RegKey; "My Other Other Key"; "It's Working"; DWord!)
Prompt("RegistrySetValue - DWord!"; "If RegistrySetValue was successful this should be a zero: "+SetKey;)
Pause
 
Return Value numeric
 
Syntax
numeric := RegistrySetValue (Hkey: numeric; Value: string; Data: any; Type: enumeration)
 
Parameters
Hkey Numeric
Value String
Data Any
Type Enumeration
Binary! Free-form binary.
DWord! 32-bit number.
String! Null-terminated string.
ExpandableString! Null-terminated string with environment variable references.
PFBinary! Free-form binary.
PFDWord! 32-bit number.
PFString! Null-terminated string.
PFExpandableString!
PFWPString! Corel WordPerfect word string.
PFByte! 8-bit number.
PFWord! 16-bit number.
PFBool! Boolean.
PFLogical!

RenameDirectory

Purpose Rename a directory.
 
Examples Appendix A: 8081
 
Return Value Return True if successful, False if not.
 
Syntax
boolean := RenameDirectory (OldDirectoryName: string; NewDirectoryName: string; [Prompts: enumeration])
 
Parameters
OldDirectoryName string Include the full path.
NewDirectoryName string Include the full path.
Prompts enumeration (optional) Default: NoPrompts!
NoPrompts!
Prompts! Prompt if the directory does not exist.

RenameFile

Purpose Rename and/or move a fi