Copyright: ® Polaris Software, Inc.


Help Contents
Table of Contents

Introducing PackRatBASIC

What is a Macro?

What is PackRatBASIC?

Programming Your First PackRatBASIC Macro

Sample Macros

Macros Dialog Box - Accessing the Macro Editor

Categories Dialog Box

PackRatBASIC Editor Screen

PackRatBASIC Editor Menu Bar

Macro Menu

Edit Menu

Search Menu

Run Menu

View Menu

Help Menu

PackRatBASIC Commands

Programming Pointers and Hints

Displaying Messages and Gathering Input

Calling a Macro from Within a Macro

Calling Forms in a Macro

Common Search and Update Procedures

Searching Forms

Variable and Operator Types

Data Types

PackRat Field Names

String Types

System Variables

Naming Variables

Numeric Operators

Logical Operators

String Variables

String Operators


What is a Macro?

By definition, a Macro is a program that runs inside of another application.  They simplify many common computer tasks, and in fact, are so common that you may not even realize when you are using them.  In certain word processing applications, every time you use a spellchecker, change fonts, or print a document, you are running a macro that tells your application what to do.  Similarly, in PackRat many of the Action Buttons™ are connected to PackRatBASIC macros.  Macros make it easy to tell your computer what you want to do.


What is PackRatBASIC?

PackRatBASIC is a macro language similar in purpose to Microsoft's WordBASIC.  It is much like the standard BASIC programming language in terms of vocabulary and syntax.  PackRatBASIC includes its own commands to make it interactive with your PackRat software.  This means that you don't have to be a professional software developer to make PackRat perform specialized tasks for you.


Your First PackRatBASIC Macro

Follow these steps to enter and run your first PackRatBASIC macro:

Entering a new Macro

1.	Open PackRat so the main Menu Bar is in view.

2.	Click on the Tools menu and select the Macros command.

The Macros dialog box displays.

3.	Click on the New button.

The PackRatBASIC editor screen displays.

4.	Enter the following four-line macro into the PackRatBASIC editor:

BeginSub MyFirstMacro()

REM This macro displays a text string in a dialog box.

PackRatMessage("This is my first PackRatBASIC macro")

EndSub

5.	Save the macro by selecting Save from the Macro menu.

PackRat prompts you to give the macro a name with the Save dialog box.

For now, select any option from the Category box and type:  MyFirstMacro   in the Macro Name box and click OK.

Running "MyFirstMacro"

To run the macro, open the Run menu and select Start.

If no errors were made entering the macro, the macro instantly runs and displays a dialog box stating:  This is my first PackRatBASIC macro.

Problems?

If you made a mistake entering the macro, you will receive a PackRat error message.  Double-check to make sure you entered the macro exactly as stated here.  Also, make sure you didn't forget a quotation mark, or use an apostrophe by mistake.

When you exit the PackRatBASIC editor screen (Macro menu - Exit), you are returned to your PackRat desktop.  If you select Tools menu - Macros and select the category that you saved your macro under, you will see that MyFirstMacro appears in the Macros dialog box.  If desired, you could assign this macro to an Action Button and place it on a PackRat Folder.


Sample Macros

Try experimenting with these four sample macros.  Besides demonstrating common commands and procedures, they will also help you develop a feel for PackRatBASIC so you can begin writing your own macros.

If you feel totally lost and helpless as you work with these macros, you're probably not ready to dive headlong into PackRatBASIC yet.  If you're not completely disheartened yet, you should refer to an introductory BASIC programming book to learn some fundamentals about computer programming.

Sample Macro #1

Sample Macro #2

Sample Macro #3

Sample Macro #4


Sample Macro #1

This simple macro prompts you for your name and uses it to create a text string which is then displayed in a dialog box.

BeginSub MyName( )

REM  This macro prompts for your name

REM  and displays it in a dialog box.

Prompt$ = "What is your first name ? "

Caption$ = "Name Dialog Box"

Prompt( Prompt$, Caption$, return$ )

Greeting$ = "Welcome to PackRatBASIC, " + return$

PackRatMessage( Greeting$ )

EndSub


Sample Macro #2

This macro demonstrates how numeric variables are converted to string variables so that they can be displayed with the PackRatMessage statement.

BeginSub DisplayNumberResult( )

REM  This macro performs a numeric operation and

REM   converts the result to a string variable.

Answer# = 10 * ( 2 + 3 )

Answer$ = Str$(Answer#)

PackRatMessage(Answer$)

EndSub


Sample Macro #3

This macro prompts you to enter a character and then converts it to the ASCII code equivalent.

BeginSub ASCIIConversion( )

REM  This macro returns the ASCII equivalent of a character.

prompt$ = "Enter a character: "

caption$ = "ASCII Conversion Dialog Box"

Prompt(prompt$, caption$, return$)

X = Asc(return$)

X$ = Str$(X)

result$ = "The ASCII equivalent of "+return$+" is "+X$

PackRatMessage(result$)

EndSub


Sample Macro #4

This macro will prompt you for two numbers and return the sum of those numbers.  This macro could have been written several ways, but this method demonstrates several important PackRatBASIC structures.

BeginSub AddNumbers( )

caption$ = "Add Numbers Dialog Box"

REM   Gather the input.

For i = 1 to 2       ' repeat the procedure for each number

If i = 1 Then  ' prompt for the first number

prompt$ = "Enter the first number: "

Prompt(prompt$, caption$, return$)

num1$ = return$ 'define the input as num1$

Else          'prompt for the second number

prompt$ = "Enter the second number: "

Prompt(prompt$, caption$, return$)

num2$ = return$ ' define the input as num2$

EndIf

Next i

num1# = Val(num1$)  'convert num1$ to numeric data type

num2# = Val(num2$) 'convert num2$ to numeric data type

sum# = num1# + num2# 'find the sum of the two numbers

sum$ = Str$(sum#) 'convert sum# to string data type

Result$ = "The sum of "+num1$+" and "+num2$+" is "+sum$

PackRatMessage(Result$) 'display the Result$ message

EndSub


Accessing the Macro Editor

From the main PackRat Menu Bar, you enter the realm of PackRatBASIC by selecting the Tools menu - Macros command.  The Macros dialog box displays.  You can choose to run, edit, delete, or create a macro from the Macros dialog box.  You can also create a new Category if you desire.  Categories are like subdirectories for your macros.  They help you organize your macros, forms, scripts, and such by letting you classify them under appropriate topics.

Creating a New Macro

From the Macros dialog box:

To create a new macro, click on the New button.  (You do not have to select a category for the macro until you save it.)

This brings you to the PackRatBASIC Editor Screen, where you can enter the new macro.

Editing, Running, and Deleting Macros

From the Macros dialog box:

In the Category drop box, select the desired macro category.  In the Macro combo box, select the desired macro and click either the Run, Edit, or Delete button:

Run:  Executes the selected macro.

Edit:  Opens the selected macro in the PackRatBASIC Editor.

Delete:  Removes the selected macro from the list.


Categories Dialog Box

From the Macros dialog box, click on the Categories button to access the Categories dialog box

The Categories dialog box enables you to create new categories or delete existing ones.

Categories are like subdirectories for your macros.  They help you organize your macros, forms, scripts, and such by letting you classify them under appropriate topics.

Creating a New Category

From the Categories dialog box:

1.	Click the New button.

The Category dialog box displays.

2.	In the Category box, enter the name of the new category.

3.	Click OK.

The new Category displays in the Categories dialog box.

Deleting a Category

These categories are NOT limited to the PackRatBASIC editor; they are the same ones used throughout PackRat, so make sure there are no macros, forms, scripts, and such in the Category to be deleted.  You cannot delete a Category that isn't empty.   To move a macro to a different category, use the Macro menu - Save As command.

From the Categories dialog box:

1.	Highlight the Category to be deleted.

2.	Click the Delete button.

If the Category is empty, it is removed from the Categories combo box.


PackRatBASIC Editor Screen

When you create or edit a macro from the Macros dialog box, you access the PackRatBASIC editor screen.

The PackRatBASIC editor helps you perform many common operations, including transferring macros, editing text, searching for text, and debugging macros.  You perform most of these actions from the Menu Bar.


PackRatBASIC Editor Menu Bar

The PackRatBASIC Edito Menu bar has six menus on it.

Click on a menu heading to view that menu and get descriptions of its entries.


Macro Menu

Click on any menu entry for a description.


New

The New command opens a blank PackRatBASIC screen so a new macro can be entered.  If the macro currently displayed has any unsaved changes, you will be prompted to save the changes before the new screen displays.


Import/Export

When you select either of these commands, the Import/Export dialog box displays.

Import

Follow these steps to import a macro (*.mac file) from another location into the PackRatBASIC editor.  PackRatBASIC macros are stored in the config.pdb file in the packrat directory.  If the file is on a floppy disk, insert that disk in the appropriate drive first.

From the Import/Export dialog box:

1.	In the Drives box, select the drive where the file is currently located.

2.	If the file's extension is something other than *.mac, select the appropriate file extension in the FileName box.

3.	In the Directories box, locate the directory containing the file.  The file's name should be displayed in the File Name combo box.

4.	Select the file to be imported and click OK.

The macro displays in the PackRatBASIC editor.

To save the file, select Save As from the Macro menu.

Export

Follow these steps to export a macro from the PackRatBASIC editor to a new location.  PackRatBASIC macros are stored in the config.pdb file in the packrat directory.  If the file is going to be exported to a floppy disk, insert that disk in the appropriate drive first.  Begin with the macro open in the PackRatBASIC editor.

From the Import/Export dialog box:

1.	In the Drives box, select the drive where the file will be exported to.

2.	In the Directories box, locate the directory where you want the file to be placed. Any other macro files in that directory display in the File Name combo box.

3.	In the File Name box, enter a name and extension for the file to be exported.

4.	Click OK.

The file is exported to the destination directory under the specified name.


Open

When you select the Open command, the Open dialog box displays.

The Open dialog box displays the names of all the categories and macros saved to your database.  Select the macro you would like to open and click OK.  The PackRatBASIC editor screen appears with that macro displayed.


Save/Save As

When you select either the Save or Save As commands, the Save dialog box displays.

Saving a macro

1.	From the Category list box, select which category to save the macro under.

2.	In the Macro Name box, enter the desired name for the macro. Note:  No spaces are allowed in the name.  No file extension is necessary for macros saved to the config.pdb (database) file.

3.	Click the OK button.

When you make changes to a macro and try to run it, the Save dialog box appears to verify that you want the changes to be saved under the existing name.  To save a macro to a separate disk file, use the Macro menu - Export command.


Print

Select this command to print the currently open macro.


Exit

The Exit command closes the PackRatBASIC editor and returns you to the PackRat desktop.  If there are any unsaved changes in the open macro, you will be prompted to save them before exiting.


Edit Menu

Click on any menu entry for a description.


Undo

The Undo command is used to correct mistakes made while using the Cut, Copy, or Paste commands.  For example, if you unintentionally Paste text on the editor screen, you can select the Undo command to restore the screen to it's status just before the paste.

The Undo command only restores the immediately previous Edit action or keyboard entry.


Cut

Use the Cut command to remove highlighted text from the editor screen and move it into the Windows Clipboard.


Copy

Use the Copy command to move a copy of highlighted text to the Windows Clipboard.


Paste

Use the Paste command to move text from the Windows Clipboard to the PackRatBASIC editor screen.  Place the cursor in the location where you want the text pasted and select the Paste command.


Search Menu

Click on any menu entry for a description.


Find

When the Find command is selected, the Find dialog box displays.

Use the Find command to locate every occurrence of a target word or phrase throughout your macro.

From the Find dialog box:

1.	Type the target text directly in the Find What box.  You can also highlight the desired target text before selecting the Find command, if applicable.

2.	Use the Direction box to instruct PackRat whether it should look above (Up) or below (Down) the current cursor location for the target text.  To search the entire macro, position the cursor before the first line and select the Down button.

3.	Click the Find Next button.  The PackRatBASIC Editor scans through your document and highlights the next occurrence of the target text.  You can keep selecting the Find command to locate all occurrences of the target text.


Next

Using this command, you can go to the next occurrence of the last thing you searched for without displaying the Find dialog box.


Replace

When this command is selected, the Replace dialog box displays:.

Use the Replace command to locate every occurrence of some target text and replace it with some other text.  This is ideal when renaming variables in long macros.

From the Replace dialog box:

1.	Type the target text directly in the Find What box. You can also highlight the desired target text before selecting the Replace command, if applicable.

2.	In the Replace With box, type the text that you want to replace the target text with.

3.	Click either the FindNext or ReplaceAll button, as desired.

If you want to replace every occurrence of the target text, click the Replace All button.  Note: The Replace All procedure is not undoable.

If you want to selectively replace the target text, click the Find Next button to locate the next occurrence of the target text.  When found, click the Replace button to just replace that occurrence, or the Find Next button to move to the next occurrence.


Run Menu

Click on any menu entry for a description.


Start

Select the Start command to begin execution of the open macro. Note:  If the macro has already been run, you may need to select this command twice to reinitialize the macro.


Step

The Step command enables you to move through the execution of your macro one line at a time.  The active line is highlighted.  When used with the View menu - Variables command, you can verify that your variables are being set properly at each stage of the program.  When Step is being used,Start is no longer an available option; You must use the Continue command.  Note:  If the macro has already been run, you may need to select this command twice to reinitialize the macro.


Continue

The Continue command disables the Step command's line-by-line execution and continues normal execution of the macro.  This command is only available when Step is being used or when a Stop command is encountered in a macro.


Trace

When Trace is active, the Step process will visibly trace into any macros called from within the macro being executed.   When inactive, the trace will only display the results of the macro being called.


View Menu

Click on any menu entry for a description.


Variables

The Variables command displays the values of all the defined variables in your macro.  Use this feature as a debugging tool to verify that your macro is working correctly.


Locals Only

The Locals Only command displays the value of every locally defined variable in your macro.  Use this feature as a debugging tool to verify that your macro is working correctly.


Globals Only

The Globals Only command displays the values of every globally defined variable in your macro.  Use this feature as a debugging tool to verify that your macro is working correctly.


Commands

This command accesses the Commands dialog box.

The Commands dialog box contains every PackRatBASIC command, so you can quickly add a command to your macro.  It includes the correct syntax for each command so you can verify that you're using the command correctly.

To insert a command:

1.	From the PackRatBASIC editor screen, place the cursor at the location where you want the command inserted.

2.	Select View menu - Commands to access the Commands dialog box.

3.	Highlight the desired command and click the Insert button.

The command is inserted in your macro.


Types

The Types command accesses the Data Types dialog box

The Data Types dialog box contains all PackRat Data Types including user-defined data types.

To insert a data type:

1.	From the PackRatBASIC editor screen, place the cursor at the location where you want the data type option inserted.

2.	Select View menu - Types to access the Data Types dialog box.

3.	Highlight the desired option and click the Insert button.

The data type is inserted in your macro.


Help Menu

Click on any menu entry for a description.


Contents

This command opens the Help file and displays a list of Help topics grouped by functionality.


Search

This command opens a Search dialog box so you can locate the desired topics in the Help file.


Index

This command opens the Help file and presents an alphabetized list of Help topics.  Click on the topic to view the associated help screens.


Using Help

This command will open a standard Windows Help file which explains how to use On-line Help.  If you have never used PackRat's or any other application's On-line Help before, this is a good place to learn.


Displaying Messages and Gathering Input
Displaying Messages & Gathering Input

There are three different macro commands which can be used for displaying messages and interacting with the user:

PackRatMessage

Message

Prompt

 Each command applies to specific circumstances.


PackRatMessage Command

PackRatMessage is used for simple message display, where no user feedback is required.  It displays the message in a dialog box and prompts the user to click OK .

You would use PackRatMessage for items such as reminders.  For example, the following macro might be used at the end of the day, when exiting PackRat.

Example:

BeginSub Goodbye( )

PackRatMessage("Don't forget to turn out the lights!")

EndSub

The Goodbye() macro generates a dialog box stating:  Dont forget to turn out the lights!


Message Command

The Message command is used in situations where a simple  YES, NO, OK, or CANCEL  response is needed from the user.   There are four options when selecting which buttons you want on the Message function's dialog box.

You may display buttons in the following styles:

The following example of the Message command shows a dialog box with three buttons.  It also shows how you must code your macro to interpret the responses.

Example

BeginSub DeleteRec( )

REM  The 3 in the next command sets the dialog buttons to Yes, REM  No, Cancel

Answer = Message( "Confirm Deletion", "Are you sure you want to delete this record?", 3 )

REM Possible values are  2 = Cancel,  6 = Yes,  7 = No

REM  (If applicable, 1 = OK)

If Answer = 6 Then

RecordDelete( recId )

EndIf

EndSub

This macro will generate dialog box asking "Are you sure you want to delete this record?"


Prompt Command

For instances when you need the user to actually type in a response, you should use the Prompt command. This command will take the user's entry and store it as a string variable. You can then evaluate and manipulate this string.

This is most useful when you are writing a macro to automate data entry.  Using the Prompt command, you can walk the user through every step of the data entry process.   As an example, we have provided a very basic password macro.

Example

BeginSub Password( )

REM Set the password, then initialize the entry string

Password$="swordfish"

Answer$ = " "

REM Have the loop repeat until the correct password is entered.

While Answer$ <> Password$

Prompt( "Enter the password: ", "Password Entry", Answer$)

Wend

EndSub


Calling a Macro from Within a Macro

All PackRatBASIC macros are separated into categories.  Because of this, the syntax for calling a macro from within another macro depends on which category each macro belongs to.

If the macro you are calling belongs to the same category as the macro that you are trying to run it from, then you need not be concerned with Categories;  just type the macro name and any applicable parameters.  If however, the macro being called is associated with a different category, you must declare it as such using the Associate statement.  ( Think of this as a Declare statement for macros.)

The syntax is:

Associate [MacroName] With [Category]

Example

BeginSub  Macro1( )

Associate Macro2 With Category2

x = 1

y = Macro2(x)

EndSub


Calling Forms in a Macro

Any Macro command that involves specifying a Form must also include the Category that the Form belongs to.  Categories are organizational tools that help you better maintain the large list of available PackRat Forms and other tools.

The syntax is:

Form$ = "[Category]:[FormName]"

Example

Form$ = "Contacts:Phone Book"

Important:  The "Search" functions treat the Category and Form as separate arguments.  This is so one or the other can be set as empty to broaden the scope of the search.  In these instances, if the form is specified as "[Category]: [FormName]", the search will fail.  In short, if the Category is specified as a separate argument, do not include it in the Form definition.

For instance, if you are creating a Phone Book form under a Business category and another under a Personal category, you can distinguish between them in the following fashion:

REM   Display a Business Phone Book Form.

A = FormCreate("Business: Phone Book")

B = FormCreate("Personal:  Phone Book")

FormShow(A)

FormShow(B)

FormDestroy(A)

FormDestroy(B)


Common Search and Updating Procedures

The following will show some macro examples involoving search and updating procedures.  These will give you a feel for finding information in the PackRat database.

Searching a Form

Updating Search Results


Searching a Form

This example outlines a form-based search macro and demonstrates the way in which the various PackRatBASIC Form and Search functions are used together. This example should be used as a basis when you create your own custom search macros.

A form-search includes the following steps:

•  Select the Form to be searched.

•  Display the form so search criteria can be entered.

•  Set up the search criteria and search operators.

•  Run the search.

•  Display results in a list viewer.

BeginSub SearchForm()

Category$="Contacts"

Form$ = "Contacts:Phone Book"

'Allocate memory for the form and assign a numeric variable

A = FormCreate(Form$)

'Display the selected Form on the folder.  Enter the search criteria in 'the appropriate fields on the Form.  The macro waits until the user hits 'Cancel or OK on the form.

Phone$ = A.Phone$

' Every Search must start with this statement

RecordStartSearch(Category$, Form$)

'Set up the search criteria for each field.  The RecordSearchAnd 'function will only return records satisfying All of the criteria.  To return 'records satisfying any of the criteria, use RecordSearchOr().

RecordSearchValue("NAME", "=", A.Name$)

RecordSearchAnd()

RecordSearchValue("COMPANY", "=", A.Company$)

RecordSearchAnd()

RecordSearchValue("PHONENUMBER",  "=", A.Phone$)

' Run the search, and have the results be pointed to by RCList1

Results = RecordRunSearch()

' Find out how many items were found

Rc = ResultsGetTotal(Results)

' Verify that you did find something, and display the results in the List  'Viewer object.

If Rc > 0 Then

REM Assuming this is run from a List Viewer Toolbar.

Object_SetResults(RcList1) '

Else

PackRatMessage("No record(s) found meeting search criteria")

EndIf

EndSub


Updating Search Results

If you wish to update fields in your search results, you may use the following macro to do so.  Call this macro right after generating a list of search results.

This Form-update includes the following steps:

•  Set the pointer at the top of the results list.

•  Define the start of the update process.

•  Set the new values for the fields to be updated.

•  Define the end of the update process.

•  Repeat the process for each record to be updated.

•  Delete the list index from memory.

BeginSub UpdateFields( RcList1 )

' RcList1 is the results list from a previous search

'Set the pointer to the first record in the search results list.

ResultsSetFirst(RcList1)

For I = 1 to Rc

'Every update must begin with this statement

RecordStartUpdate( RcList1 )

'Define the new phone number and company name and set all 'PHONEBOOK fields to the new number and all COMPANY fields 'to the new name.

newPhone$ = (619) 555 - 2112

newCo$ = "L.O.R. Industries"

RecordSetField( "PHONENUMBER", newphone$ )

RecordSetField( "COMPANY", newCo$ )

'Initialize update procedure and define end of the update process 'for this record.

RecordEndUpdate( )

'Set the pointer to the next record so it can be updated

ResultsSetNext( RcList1 )

Next

'Delete the list index from memory.

ResultsFree( RcList1 )

EndSub


Searching Forms
Searching the Database via Forms

Searching a specific form:

RecordSearchAll( "CategoryName", "FormName" )

- or -

You can select the Form to be searched from a pop-up dialog box using:

RecordSearchDlg("CategoryName", "FormName")

Searching forms within a specific category:

RecordSearchAll( "CategoryName", " " )

Searching all forms in all categories:

RecordSearchAll( " ", " " )


Abs Function

Action

Returns the absolute value of a numeric expression.  The absolute value is the magnitude of the numeric expression, and is therefore always a positive number.

Syntax

Abs(Numeric Expression)

Arguments

The Numeric Expression can be any expression which evaluates to a numeric data type.

Examples

Abs(-1) = 1

Abs(1) = 1

Abs(-1024) = 1024

Abs (1024) = 1024

Abs(0) = 0

Abs(-1.234) = 1.234


ActivateApp Function

Action

This function causes the specified application to become the active application in Windows.

Syntax

ActivateApp( App$ )

Argument

App$	Application name that you wish to pass control to.
Example

ActivateApp( "Microsoft Mail" )

ActivateApp( "Microsoft Word" )


AddToContactList Function

Action

Adds the highlighted record(s) to the Contact List.

Syntax

AddToContactList(  )

Remarks

AddToContactList( ) will display the Contact dialog box for you to enter pertinent information.  When adding a highlighted entry, the dialog box appears with the name filled in.

Example

BeginSub  Contact()

' Assume there is a row highlighted in the List Viewer

AddToContactList()

EndSub


Asc Function

See Also

Chr$( )

Action

Returns a numeric value that is the ASCII or ANSI code for the first character in a string expression.

Syntax

Asc(StringExpression$)

Argument

StringExpression$	A valid ASCII or ANSI character
Remarks

Although Asc is short for the ASCII character set, the actual codes that are returned are ANSI codes, which are used by PackRatBASIC.

ANSI character codes in the range 0 to 31, inclusive, are the same as the standard, non-printable ASCII codes.

Examples

Asc(A) = 65	Asc(a) = 97
Asc(B) = 66	Asc(b) = 98
Asc(Bubba) = 66	Asc(bernard) = 98
Asc(Z) = 90	Asc(z) = 122


Associate Statement

Action

Declares a macro as being associated with a particular category.  Must be used before a macro from another category can be called.

Syntax

Associate [MacroName] With [Category]

Arguments

MacroName	The name of the macro being called.
Category	The category that the macro being called belongs to.
Remarks

All PackRatBASIC macros are separated into categories.  Because of this, the syntax for calling a macro from within another macro depends on which category each macro belongs to.

If the macro you are calling belongs to the same category as the macro that you are trying to run it from, then you need not be concerned with Categories;  just type the macro name and any applicable parameters.  If however, the macro being called is associated with a different category, you must declare it as such using the Associate statement.  ( Think of this as a Declare statement for macros.)

Example

BeginSub  Macro1( )

Associate Macro2 With Category2

x = 1

y = Macro2(x)

EndSub


AttachItems Function

Action

Attaches all selected records to each other.

Syntax

AttachItems( )

Remarks

AttachItems() will only work from an Action Bar.  It attaches the highlighted records.


AttachRecs Function

See Also

RecordGetField

FormAddRec

ResultsGetRec

Action

This command attaches two records together.  This function takes the indexes of the two records and is therefore more flexible than the AttachItems() function.

Syntax

AttachRecs( recId1, recId2 )

Arguments

recId1	The Id of the first record to be attached.
recId2	The Id of the second record to be attached.
Example

BeginSub PhoneLog( )

PBRec = ResultsGetRec(1)

RecordGetField(PBRec, "NAME", Name$)

Form = FormCreate("Contacts:Conversation")

Form.Summary$ = Name$

CvRec = FormAddRec(Form, "Summary", Len(Name$) )

AttachRecs(PBRec, CvRec)

EndSub


Chr$ Function

See Also

Str$

Asc()

Action

Returns the ANSI code for the argument.  ANSI is the character set used by PackRatBASIC.  It is useful for adding commas, returns, and such to strings.

Syntax

Chr$(code%)

Argument

Code%	An integer between 0 and 255, inclusive.
Remarks

The ANSI character codes in the range 0 to 31, inclusive, are the same as the standard, non-printable ASCII codes.

Examples

Chr$(9) = Tab character

Chr$(34) = Quotation mark

Chr$(10) = Line feed

Chr$(13) = Carriage return

Chr$(90) = "Z"

Use this function to put a carriage return between strings:

Message$ = A$ + Chr$(13) + B$


Close Statement

See Also

Open

Input

Print

Read

Write

Action

Closes the specified file.

Syntax

Close [#]filenumber%

Argument

filenumber%	The same number used in the Open Statement.
Remarks

The association of a file with filenumber% ends when a Close statement is executed. You then can reopen the file using the same or different file number.

There must be a space between the Close command and the # sign.

Examples

Close  #1	Closes the file attached to file number 1.
Close  #filenumber%	Closes the file associated with the integer variable filenumber.


CompleteItem Function

See Also

LowerPriority( )

RaisePriority( )

Action

Marks selected records as "complete".

Syntax

CompleteItem( recId )

Argument

recId	The record Id of the record being marked. If (recId <> 0) then it acts on the specified record.  Otherwise, it acts on the selected records.
Example

BeginSub Complete()

'Assume a record is highlighed.

CompleteItem()

EndSub


CopyRecToClipBoard Function

Action

Copies the specified or selected record(s) to the clipboard using the specified template format.

Syntax

CopyRecToClipBoard( recId, Template$ )

Argument

recId	The record Id.  If (recId <> 0) then use the specified records.  Otherwise, use selected record(s).
Template$	A valid template created using the Data Template Editor.  Must be in the form Category:Template
Example

Assume there are two records highlighted in the List Viewer and you run this macro:

BeginSub CopyClip()

recId = ResultsGetRec(results%)

CopyRecToClipBoard( recId, "Contacts:Business Address" )

EndSub

If the "Business Address"  template looks like this:

<< Name >>

<< Address >>

Then the Clipboard will have entries that look like this:

Jake Planet

1111 First Ave.

{ blank space }

Dave Langwich

2222 Second Ave.


CopyRecToFile Function

Action

Copies the currently selected record(s) to a file using the specified template format.

Syntax

CopyRecToFile( recId, Template$,  File$ )

Arguments

recId	The record Id.  If (recId <> 0) then use the specified records.  Otherwise, use selected record(s).
Template$	A valid template created using the Data Template Editor.  Must be in the form Category:Template (located under the Main Tools menu - Data Templates.)
File$	The complete path to the file where the record is to be copied.   (  "c:\docs\recfile\records.txt " )
Example

Assume there are two records highlighted in the List Viewer and you run this macro:

BeginSub CopyClip()

recId = ResultsGetRec(results%)

CopyRecToFile( recId, "Contacts:Business Address", "c:\docs\recfile.txt" )

EndSub

If the "Business Address"  template looks like this:

<< Name >>

<< Address >>

Then recfile.txt will have entries that look like this:

Jake Planet

1111 First Ave.

{ blank space }

Dave Langwich

2222 Second Ave.


Declare Statement

Action

Declares references to external procedures in dynamic-linked libraries (DLLs) so that the function or subroutine can be used like any other command.

Syntax

Declare Function FunctionName  "LibName.dll " (ArgumentList)

As Type

Note:  The Function parameter can be replaced with Subroutine if it doesn't return a value.

Arguments

Function	Indicates that the procedure returns a value and can be used in an expression.  See Note above.
FunctionName	The name of the function within an external DLL.
libName.dll	The name of the DLL where the declared procedure is to be found.  The DLL must be in the DOS, Windows dir., or System dir. path.
ArgumentList	The list of variables, representing arguments that will be passed to the function when it is called.  ArgumentList  has the following syntax:   Variable1  As  type1, [Variable2  As  type2], ...  where Variable is a PackRatBasic variable name and type is the type of variable: Integer, Long, Float, Double, String, or a user-defined type. Note: For array variables, use the array name with no braces.  Only the variable's data type is significant.
Type	Return Type of the function.  Cannot be an array type.


Dim Statement

Action

Used to declare variables and strings, and allocate storage space for arrays.

Syntax

Dim ArrayName[ArraySize] As Type

Arguments

VariableName	Name of the variable where the array will be stored.
VariableSize	Dimensions of an array variable.  Multiple dimensions can be declared.   For one dimensional arrays: ArraySize = NumItems For example, the following values for NumItems each declares a 10 element array:   NumItems = 1 to 10 NumItems = 9 NumItems = 17 to 26 For two and three dimensional arrays (respectively): ArraySize = NumItems1, NumItems2 ArraySize = NumItems1, NumItems2, NumItems3
Type	The type may be Integer, Long, Single, Double, String, or a user-defined type.
Remarks

The size of numeric arrays is limited to 32,768 bytes.  The amount of memory used by a numeric array is calculated by multiplying the number of elements in the array times the number of bytes required by the data type of the array.  For example:

An integer array, requiring 2 bytes per element, can contain twice as many elements as a long integer array requiring 4 bytes per element.

An integer array can contain four times as many elements as a double-precision array requiring 8 bytes per element.

String arrays are limited to almost 32K bytes because some small storage overhead is required for each array.

If you use a subscript that is greater than the specified maximum or smaller than the specified minimum, PackRatBASIC generates an error message.  An error message is also generated if the size of the array exceeds (bytes of memory used) the allowable limits described above.

The Dim statement initializes all elements of numeric arrays to zero and all elements of string arrays to null strings.  The fields of user-defined type variables are initialized to zero, including fixed-length string elements.

Example

One Dimensional Array:

Dim Month$[1 to 12] As String

Month$[1] = "January"

Month$[2] = "February"

•

Month$[12] = "December"

Multiple Dimension Arrays:

' Two dimensional array with 120 elements

Dim Coords1#[ 1 to 10, 1 to 12 ]

' Three dimensional array with 600 elements

Dim Coords2# [ 1 to 10, 1 to 12, 4 ]


DocumentFax Function

Action

Faxes the specified document.  Requires separate Fax software -- not provided.

Syntax

DocumentFax(lpDoc$, lpFax$ )

Arguments

lpDoc$	A string containing the name of the document to be faxed.  If empty, the selected record(s) will be checked for a "DOCUMENT" field.
lpFax$	A string containing the fax #.
Example

DocumentFax("c:\winword\sales.doc", "619-555-2524")

DocumentFax("c:\winword\sales.doc", "413-555-1718")


DocumentMail Function

Action

Mails the specified document through your eMail system as an eMail message.  Requires separate eMail software -- not provided.

Syntax

DocumentMail(lpDoc$, lpSubj$, lpMsg$, lpRecips$)

Arguments

lpDoc$	The string containing the name of the document to be eMailed.  If empty, the value of the currently selected records will be used.  The List Viewer must have a field called "DOCUMENT".
lpSubj$	This string describes the subject of the message.  If empty, a dialog box will pop up.
lpMsg$	This string contains the actual message.  If left empty, a dialog box will pop up.
lpRecips$	If there is only one recipient, this string will pass the eMail address.  If there is more than one recipient, this will pass a comma delimited list.  If lpRecips$ is empty, this string will pass the current selection from the List Viewer field (EMAILADDRESS) as the recipient of the message.
Example

lpSubj$ = ""

lpMsg$ = ""

DocumentMail("c:\winword\sales.doc", lpSubj$, lpMsg$, "JohnA")


DocumentNew Function

See Also

DocumentOpen( )

DocumentPrint ( )

Action

Creates a new document and prompts the user for the type.

Syntax

DocumentNew(lpType$, lpDoc$, lpStyle$)

Arguments

lpType$	Contains the file type for the new document.   Application = OLE type Amipro = "AmiPro Document" Excel = "Microsoft Excel Worksheet" Graph = "Microsoft Graph" Project = "Microsoft Project" Word = "Word Document"
lpDoc$	This string contains the name of the document to be created.  If empty, a unique name will be assigned.
lpStyle$	Pass the name of a Template File or Style Sheet or leave blank to use defaults.
Example

DocumentNew( "Word Document", "c:\winword\sales.doc", " " )

DocumentNew( "Word Document", " ", "Normal.dot" )


DocumentOpen Function

See Also

DocumentNew ( )

DocumentPrint ( )

Action

Opens the specified document.

Syntax

DocumentOpen(lpDoc$, nMode%)

Arguments

lpDoc$	This string contains the name of the document.  The document must have an extension (.txt, .doc, .wp) so it can be identified.  If empty, the selected record's DOCUMENT field is used.
nMode%	This integer variable will indicate the file attributes: 1 = read only 0 = read, write
Example

DocumentOpen ( "c:\winword\sales.doc", 0 )


DocumentPrint Function

See Also

DocumentNew( )

DocumentPrint( )

Action

Prints the specified document.

Syntax

DocumentPrint(DocName$)

Argument

DocName$	This string contains the name of the document to be printed.  The document name must have an extension (.txt, .doc, .wp, etc.) so it can be identified.  If empty, the DOCUMENT field of the selected records is used.
 Remarks

The document does not have to be open in order to be printed.

Example

DocumentPrint( "c:\winword\sales.doc" )


EditCopy Function

See Also

EditCut

EditPaste

Action

Copies the selected text from an Edit Window to the Windows Clipboard.

Example

Highlight some text in the Edit Window.

BeginSub Copy( )

EditCopy( )

EndSub

This macro copies the highlighted text to the Windows Clipboard.


EditCut Function

See Also

EditCopy

EditPaste

Action

Cuts the selected text from an Edit Window to the Windows Clipboard.

Example

Highlight some text in the Edit Window.

BeginSub Cut( )

EditCut( )

EndSub

The text is cut from the Edit Window and placed in the Clipboard.


EditPaste Function

See Also

EditCopy

EditCut

Action

Pastes the contents of the Windows Clipboard at the location of the cursor in an Edit Window.

Example

With text in the Clipboard:

BeginSub Paste( )

EditPaste( )

EndSub

The Clipboard text is pasted into the Edit Window.


EOF Function

See Also

Open

Action

Returns a value during file input that indicates whether or not the end of a file has been reached.

Syntax

EOF(filenumber%)

Returns

0	If the end of the file has not been reached.
1	If the end of the file has been reached.
Remarks

The argument filenumber% is the number used in the Open statement to open the file.  The EOF function returns true (non-zero) if the end of a file has been reached.  Use the EOF function to test for the end of a file.  This helps you avoid the error that occurs when you attempt to get input past the end of a file.

Example

Open "temp.txt" for Input as #1

If EOF(1) = 0 Then

Input$(255, 1)

Else

PackRatMessage( "End of File" )

End If.


Execute Function

See Also

Request

Poke

Initiate

Terminate

Action

Sends a command string to be executed to the other application in a DDE conversation.

Syntax

Execute(hCh&, Command$)

Arguments

hCh&	The channel #.  The return value of the Initiate function.  Must be a long integer type.
Command$	The string expression to be executed by the other application.  This string cannot be more than 255 characters, however, multiple executes can be used.
Returns

Non-zero if some error occurred

Zero if successful.

Example

Dim hChannel As Long

hChannel = Initiate("Excel", "System")

Execute (HChannel, "[Open("Sales.xls")]")

Terminate(hChannel)


File_Close Function

Action

Closes the specified PackRat file.

Syntax

File_Close( FileName$)

Arguments

FileName$	The full pathname of a PackRat file.  If empty, a dialog box displays.
Example

File_Close( "c:\PackRat\sales" )


File_Copy Statement

See Also

Files_Enum

File_Delete

Action

Copies a file to the specified destination.

Syntax

File_Copy( FileSrc$, FileDest$ )

Arguments

FileSrc$	The name of the source file to be copied, with the path.
FileDest$	The  destination file name.
Example

File_Copy( "c:\winword\report.doc", "c:\backup\report.doc" )

File_Copy( "c:\autoexec.bat", "c:\backup\autoexec.bat" )


File_Delete Function

See Also

File_Copy

Action

Deletes the specified file; this can be any file.  Wildcards are permitted ( *, ? )  Use this function with caution.

Syntax

File_Delete( File$ )

Arguments

File$	The full pathname of the file(s) to be deleted.
Example

File_Delete("x.tmp")

File_Delete( "c:\windows\temp\test.ini )

File_Delete("c:\windows\temp\*.bak")


File_New  Function

See Also

Files_Enum

File_Delete

File_Copy

File_Close

Action

Creates and opens a new PackRat file.

Syntax

File_New( FileName$, Password$ )

Arguments

FileName$	The name of the new PackRat file.
Password$	The password to access the file.
Example

File_New( "Sales" )


File_Open Statement

Action

Opens the specified PackRat file.

Syntax

File_Open( FileName$ )

Arguments

FileName$	The full pathname of the file to be opened or the current directory.
Example

File_Open( "Sales" )


Files_Enum Function

Action

Returns a comma-delimited list of all open PackRat files.

Syntax

Files_Enum( FilesBuff$ )

Arguments

FilesBuff$	Buffer to hold the list of files.
Example

Let's assume you have the following three files in your PackRat directory:  Sales, Customer, History

BeginSub Enum( )

lpBuff$ = " "

Files_Enum( lpBuff$ )

PackRatMessage(lpBuff$)

EndSub

Running the Enum() macro would display a dialog box listing the three above files.


Finance_ClearTransaction Function

See Also

Finance_Reconcile

Finance_UnclearTransaction

Action

Marks the selected financial record(s) as "cleared".

Syntax

Finance_ClearTransaction( )

Example

This function can be run from an Action Bar or an Action Button.


Finance_Reconcile Function

Action

Displays the Reconcile dialog box for the specified account.  Prompts for the account to be reconciled and verifies with a dialog box.

Syntax

Finance_Reconcile(lpAccount$ )

Arguments

lpAccount$	The selected account to be reconciled.  If empty, will prompt with a dialog box.
Example

Finance_Reconcile("Personal Savings")


Finance_Summary Function

Action

Displays summary totals on the specified account.

Syntax

Finance_Summary( lpAcct$ )

Argument

lpAcct$	The name of a financial account.
Example

Finance_Summary( "Personal Savings" )


Finance_UnclearTransaction Function

Action

Returns the selected record(s) to "uncleared" status.

Syntax

 Finance_UnclearTransaction( )

Example

Finance_UnclearTransaction( )


FindString Function

Action

Loads the Find Dialog Box, enabling you to search for a string of text.  This is valid for the current edit control, such as a Notes field or the Memo Pad.

Syntax

FindString( )

Remarks

This function loads the Find dialog box.  If the target text string is found, it positions the cursor on the first letter.  The user can then click on the Find Next or Cancel buttons.


FindSynonym Function

Action

Returns the Thesaurus dialog box with the argument displayed.

Syntax

A$ = FindSynonym( word$ )

Argument

word$	The word whose synonym is to be found.  The word must be spelled correctly.
Example:

BeginSub Synonym( )

Word$ = "sharp"

A$ = FindSynonym(Word$)

EndSub

This macro first assigns the word to be referenced and passes it to the FindSynonym function.  The FindSynonym function generates the Thesaurus dialog box with the word already entered in the Find Synonyms for box.  (The word "sharp" is used here.)


For...Next Statement

Action

Repeats a group of instructions a specified number of times.

Syntax

For counter = start To end [ Step increment ]

[statementblock]

Next [counter]

Arguments

counter	Numeric variable used as the loop counter.  This variable cannot be an array element or a record element.
start	The initial value of the counter.  This variable can be any expression which evaluates to a numeric type.
end	The final value of the counter.  This variable can be any expression which evaluates to a numeric type.
increment	The amount the counter is changed each time through the loop.  If you do not specify Step, increment defaults to + or -1 depending on the start and end values.  This variable can be any expression which evaluates to a numeric type.
statementblock	This variable can be any number of PackRat BASIC functions or statements to be executed the specified number of times.
Remarks

 With a For...Next loop, the program lines following the For statement are executed until the corresponding Next statement is encountered.  Then, the amount specified by Step is added to counter and compared with the final value, end.

If start and end have the same value or the step value is greater than the difference between the start and end values, the loop does not execute.

Avoid changing the value of the counter within the loop.  Changing the loop counter is poor programming practice; it can make the program more difficult to read and debug.  You can nest For...Next loops; that is, you can place a For...Next loop within another For...Next loop.  To ensure that nested loops work properly, give each loop a unique variable name as its counter.  The Next statement for the inside loop must appear before the Next statement for the outside loop.  The following construction is correct:

For J = 1 To 10

For K = 1 To 10

For L = 1 To 10

•

•

•

Next L

Next K

Next J

If you omit the variable in a Next statement, the Next statement matches the most recent non-nested For statement.  If a Next statement is encountered before its corresponding For statement, or a For is encountered without its corresponding next statement, PackRat BASIC generates an error message.

Do not branch into the body of a For...Next loop without executing a For statement.

Example

This macro segment determines the number of records found from a search and uses the For...Next statement to view the contents of a specific field on each record.

'Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' View the contents of the NAME field for the entireresult1% list.

' Find the total number of records found in the search

total% = ResultsGetTotal(result1%) .

' Repeat the following commands for each record on the search list

For J = 1 to total%

'  Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

'  Displays the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)

'  Move the pointer to the next record and returns the pointer 'index.

ResultsSetNext(result1%)

Next J


FormAddRec Function

See Also

FormEditRec

Action

Takes the contents of a Form and saves it to the database.  Returns a Record Id.

Syntax

FormAddRec( Form, Field$, Offset )

Arguments

Form	Form is the Id of the form.
Field$	The name of the field that has the focus.
Offset	The position of the cursor within Field$.
Example

BeginSub AddRec( )

nForm = FormCreate( "Contacts: Phone Book" )

nForm.Name$ = "Dave"

nForm.PhoneNumber$ = "555-7445"

RecId = FormAddRec( nForm, "Name", Len(Name$) )

EndSub


FormCreate Function

Action

Loads the specified form into memory and returns a FormId.  This function does not display the form; it merely allocates space for it in memory.   (Use the FormShow( ) function to display the form.)

Syntax

A = FormCreate( Form$ )

Arguments

Form$	The name of the form to be created in the following format:   "CategoryName:FormName"
Example

BeginSub AddForm( )

Rem Allocate memory space for a Phone Book Form

Form$ = "Contacts:Phone Book"

A = FormCreate(Form$)

Rem Display the Form

FormShow(A)

Rem Remove the Form from memory

FormDestroy(A)

EndSub

Running this macro generates the Phone Book Form.


FormDestroy Function

Action

Removes the specified Form from memory.  This is a very important clean-up function.  This will ensure that all resources used by the Form are free again.

Syntax

FormDestroy( Form )

Arguments

Form	Numeric integer representing the form.
Example

BeginSub AddForm( )

Rem Allocate memory space for a Phone Book Form

Form$ = "Contacts: Phone Book"

A = FormCreate(Form$)

Rem Display the Form

FormShow(A)

Rem Remove the Form from memory

FormDestroy(A)

EndSub


FormEditRec Function

See Also

FormCreate

FormAddRec

Action

Edits a record in the database.  The Form displays with the information in it so you can make changes to the contents.

Syntax

FormEditRec( Form As Any, Field$, Offset )

Arguments

Form	Form is the FormId.
Field$	The name of the field that will have the focus.
Offset	The position of the cursor within Field$.
Example

BeginSub EditRec( )

nForm = FormCreate( "Contacts:Phone Book" )

Rc = ResultsGetRec( 1 )

RecordFillForm( Rc, nForm )

FormEditRec( nForm, "Name", Len(name$) )

EndSub


FormEnumFields Function

Action

Returns a comma-delimited list of all the available fields in a form.

Syntax

FormEnumFields( Form$, FieldsBuff$ )

Arguments

Form$	The name of the Form.  ("Contacts:Phone Book")
FieldsBuff$	Buffer to hold the comma-delimited list that is returned by the function.
Example

BeginSub AddRec( )

•

Form$ = "Contacts: Phone Book"

FormEnumFields( Form$, FieldBuff$)

•

{parse the FieldBuff$}

•

EndSub


FormGetFieldFromDlg Function

Action

Retrieves the contents or value of a Field from an active Form.  This can ONLY be used within a Form.

Syntax

FormGetFieldFromDlg(Form$, lpFieldName$, lpFieldBuff$)

Arguments

Form$	This string contains the name of the active form.
lpFieldName$	This string contains the name of a form's field, such as NAME, ADDRESS, COMPANY, etc.  (always use uppercase letters when addressing field names)
lpFieldBuff$	This string holds the information stored in the  chosen field.  Initialize this variable to the proper size.
Remarks

This function works in conjunction with the FormSetFieldFromDlg statement.  FormGetFieldFromDlg reads the value of a field (say, Name), and can use that Name to search for information elsewhere.  FormSetFieldFromDlg can use the results of the search to update other information in the form.  Use this, for example, when you enter a name in a form and want the phone number filled in automatically.

Example

Form$ = "Contacts: Phone Book"

FormGetFieldFromDlg Form$, "NAME", lpBuff$)

RecordStartSearch( Form$)

RecordSearchValue("NAME", " = ", lpBuff$)

x% = RecordRunSearch( )


FormGetFieldName Function

Action

Retrieves the name of the actual database field based on the field label being used in the Form.

Syntax

FormGetFieldName( Form$, FieldLabel$, NameBuff$ )

Arguments

Form$	The name of the form containing the field. (i.e.  "Contacts: Phone Book")
FieldLabel$	The name of the field as it appears in the List Viewer.
NameBuff$	The variable equivalent to the field label.
Example

' Assume the "Name" label had been renamed "First Name" using the Form 'editor.

Form$ = "Contacts: Phone Book"

Name$ = " "

FormGetFieldName( Form$, "First Name", Name$ )

PackRatMessage( Name$ )

' The dialog box displays:  NAME


FormGetNotes Function

Action

Returns the contents of the Notes field in a form.

Syntax

A$ = FormGetNotes$( A, "NOTES" )

Arguments

A	The Form index.  Returned from the FormCreate function.
NOTES	The name of the Notes field in the form.
Example

BeginSub

A = FormCreate(Contacts: Phone Book")

LN = FormGetNotes(A, "NOTES")

PackRatMessage("The length of the Notes field is "+STR$(LN))

Date$ = GetDate$()

N$ = Date$ + " " + FormGetNotes$(A, "NOTES")

x = FormEditRec( A, "NOTES", -1)

'Display the first 255 characters of the Notes field

N$ = FormGetNotes(A, "NOTES" )

N$ = Mid(N$, 1, 255)

PackRatMessage(N$)

FormDestroy(A)

EndSub


FormGetNotesLen Function

Action

Returns the length of the Notes field in a form.

Syntax

LN = FormGetNotes$( A, "NOTES" )

Arguments

A	The Form index.  Returned from the FormCreate function.
NOTES	The name of the Notes field in the form.
Example

BeginSub

A = FormCreate(Contacts: Phone Book")

LN = FormGetNotes(A, "NOTES")

PackRatMessage("The length of the Notes field is "+STR$(LN))

Date$ = GetDate$()

N$ = Date$ + " " + FormGetNotes$(A, "NOTES")

x = FormEditRec( A, "NOTES", -1)

'Display the first 255 characters of the Notes field

N$ = FormGetNotes(A, "NOTES" )

N$ = Mid(N$, 1, 255)

PackRatMessage(N$)

FormDestroy(A)

EndSub


FormSelect Function

Action

Displays the Forms dialog box and assigns the selected Form to a string.

Syntax

Form$ = FormSelect()

Example

BeginSub SelectForm()

Form$ = FormSelect( )

PackRatMessage( Form$)

EndSub


FormsEnum Function

Action

Returns a comma-delimited list of all the available forms in the specified Category.

Syntax

FormsEnum( Cat$, FormBuff$ )

Arguments

Cat$	Category from which to return the Forms that belong to it.  If left empty, all forms in every category will be returned
FormBuff$	Buffer to hold the comma-delimited list.
Example

Assume you have the following three forms available:

Phone Book, Agenda, Document

PackRatMessage( lpBuff$ ) will display the following:

Case 1

FormsEnum( "Contacts", FormBuff$ )

FormBuff$ = "Phone Book, Conversation"

Case 2

FormsEnum( " ", FormBuff$ )

FormBuff$ = "Contacts: Phone Book, Contacts: Conversation, Schedule: Agenda, Documents: Document"


FormSetFieldFromDlg Function

Action

Updates the specified field on a form.  This can only be used from a Form.

Syntax

FormSetFieldFromDlg(Form$, lpFieldName$, lpField$)

Arguments

Form$	This string contains the name of the active form.
pFieldName$	This string contains the name of a form's field, such as NAME, ADDRESS, COMPANY, etc.
lpField$	This string holds the information stored in the  selected field.
Example

BeginSub

Rem  This macro changes a phone number in the Phone Book Form.

Form$ = "Contacts: Phone Book"

lpPhone$ = "555-8024"

FormSetFieldFromDlg(Form$, "PHONENUMBER", lpPhone$)

EndSub


FormSetNotes Function

Action

Sets the contents of the NOTES field in the specified form.

Syntax

FormSetNotes( A, "NOTES", String$ )

Arguments

A	The index of the Form, as returned by the FormCreate function.
NOTES	The name of the NOTES field in the form.
String$	The string to be entered into the NOTES field.
Example

BeginSub

A = FormCreate("Contacts:  Phone Book" )

TextString$ = "Review the Johnson Account"

FormSetNotes(A, "NOTES", TextString$)

FormDestroy(A)

EndSub


FormShow Statement

Action

Displays a form.

Syntax

FormShow( Form )

Arguments

Form	The FormId.  This is the value returned by the Form_Create function.
Example

Form$ = "Contacts:Phone Book"

A = FormCreate( Forms$ )

x = FormShow (A)


GetDate$ Function

Action

Returns the current date from your system.

Syntax

GetDate$( )

Remarks

Enables you to perform comparisons involving the Date.

Example

A$ = GetDate$( )

' Results in A$ = mm/dd/yy, such as 01/28/95


GetSelectedResults Function

Action

Returns a set consisting of all selected records.  Once you generate this set, you may use any of the Results functions.

Syntax

Results% = GetSelectedResults( )

Example

' Suppose you have three records selected (highlighted).

Results% = GetSelectedResults()

n = ResultsGetTotal(Results%)

' Results:  n = 3


GetTime$ Function

Action

Returns the current time from your system.

Syntax

GetTime$( )

Remarks

Enables you to perform comparisons involving the time.  This format is constant, even if System Clock is set to 24 hour format.

Example

A$ = GetTime$( )

' Results in A$ = hh:mm  AM/PM, as in 01:15 PM


GoTo Statement

See Also

For...Next

If...Then...Else

Select Case

While...Wend

Action

Branches unconditionally to the specified line within a procedure.

Syntax

Goto  LineLabel

-or-

Goto  LineNumber

Arguments

LineLabel	LineLabel must begin with an alphabetic character and must end with a colon.  It can consist of all letters or an initial letter followed by letters and numbers up to forty characters.  Line labels are not case sensitive.  They may begin in any column as long as they are the first non-blank characters on the line.
LineNumber	The argument LineNumber is an integer corresponding to a line number in the source file being executed.  Do NOT end  LineNumber with a colon.
Remarks

The arguments linelabel or linenumber indicate the line to execute next.  It is generally considered good programming practice to use structured control statements (For...Next, While...Wend, If...Then...Else, Select Case) instead of Goto statements.  Programs with many Goto statements can be difficult to read and debug.

Example of Goto Statement

ConditionTest:

•

(instructions)

•

If ConditionTrue Then Goto NextCondition:

Else Goto ConditionTest:

End If

NextCondition:

•

(instructions)

•


HotLink_Connect Function

See Also

HotLink_Disconnect

Action

Connects a previously created Hot Link.

Syntax

HotLink_Connect( Name$ )

Argument

Name$	Name of a previously created Hot Link.  (Use Tools menu - Hot Links to create one.)
Example

BeginSub Connect( )

HotLink_Connect( "Excel Link" )

EndSub


HotLink_Disconnect Function

See Also

HotLink_Connect

Action

Disconnects a Hot Link.

Syntax

HotLink_Disconnect( Name$ )

Argument

Name$	Name of an existing Hot Link. (Use Tools menu - Hot Links to create one.)
Example

BeginSub Disconnect( )

HotLink Disconnect ( "Excel Link" )

EndSub


If...Then...Else Statement

See Also

Select Case

Action

Allows conditional execution, based on the evaluation of an expression.

Syntax 1

If condition Then thenpart  [Else elsepart] EndIf

Syntax 2

If condition1  Then

[statementblock1]

[ElseIf condition2 Then

[statementblock 2]

[Else

[statementblock n]

EndIf

Remarks

Syntax 1

The single-line form of the statement is best used for short, straightforward tests where one of two possible actions is taken based on the evaluation of an expression.  The single-line form is never required.  Any program using single-line If...Then...Else statements can be written using block form.  The single-line form has these parts:

condition	A Boolean expression; any expression that PackRatBASIC evaluates as true (non zero) or false (zero).
thenpart, elsepart	Both parts have the same syntax.  The thenpart is executed if condition is true; if condition is false, then elsepart is executed.  If the Else clause is not present, then control passes to the next statement in the program.
Syntax 2

The block form provides several advantages:

The block form provides more structure and flexibility than the single-line form by allowing conditional branches across several lines.  With the block form, more complex conditions can be tested.

The block form lets you use longer statements and structures within the Then...Else portion of the statement.

Programs that use block If...Then...Else are usually easier to read, maintain, and debug.

The block If...Then...Else has these parts:

condition1, condition2	Any expression that PackRatBASIC evaluates as true (non-zero) or false (zero).

In executing a block If, PackRatBASIC tests condition1, the first Boolean expression.  If the Boolean expression is true (non zero),the statements following Then are executed.  If the first expression is false (zero), PackRatBASIC begins evaluating each ElseIf condition in turn.  When PackRatBASIC finds a true condition, the statements following the associated Then are executed.  If none of the ElseIf conditions are true, the statements following the Else are executed.  After the statements following a Then or Else are executed, the program continues with the statement following the EndIf.

The Else and ElseIf blocks are both optional.  You can have as many ElseIf clauses as you would like in a block If.  Any of the statement blocks can contain nested block If statements.

PackRatBASIC looks for an EndIf anywhere after the Then to determine whether or not an If statement is a block If.  If anything other than a comment appears after Then, the statement is treated as a single-line If statement.  The block must end with an EndIf statement.

When a single Boolean expression is being evaluated, a Select Case decision structure may also be used.

Example

This macro segment first tests to see if any items were found during a search and then updates the PhoneNumber field of each item found.

' Initialize the search

Results% =  RecordRunSearch( )

' Calculate total # of records found in the search

Rc = ResultsGetTotal( Results% )

If  Rc > 0  Then

FormSetField(  Form$, "PHONENUMBER", "555-8024" )  ' Updates the field

Else

PackRatMessage ("No items found")

EndIf


Initiate Function

See Also

Execute

Request

Poke

Terminate

Action

Initiates a DDE conversation with another application, and returns a channel number to be used in subsequent conversations.  This function MUST be used first before any of the other DDE functions.

Syntax

hCh& = Initiate(AppName$, Topic$)

Arguments

AppName$	String Name for the other application.
Topic$	Topic$ is defined by the other application.  When not sure, use "System".
Returns

hCh&	Zero if some error occurred -or- Non zero value identifying other application.  A non-zero return is the channel #.
Example

Dim EChannel, WChannel, As Long

EChannel = Initiate ("Excel", "sheet1.xls")

WChannel = Initiate ("Winword", "Sales.doc")


Input Statement

See Also

Write

Action

Reads data from a file and assigns the data to variables.

Syntax

Input #filenumber%, variablelist

Arguments

filenumber%	The argument filenumber% is the number used in the Open statement to open the file.
variablelist	The argument variablelist is a comma-delimited list of the variables that are assigned values read from the file.  They can be arrays and user-defined variables.
Remarks

Data items in a file must appear in the same order as the variables in variablelist.  Data in the file are separated by comma's or carriage returns, or EOF.  Unlike the Read Statement, String Data in the file must have quotes.

Be sure you match data in the file with the proper variable types; that is, string data into string variables and numeric data into numeric variables.

Array elements and user-defined elements are delimited by commas.

If the end-of-file is reached when a numeric or string item is being input, the input is terminated.

Example

Open "Test.txt" For Input As #1

If EOF(1) < > 0

Input #1, x, y, name$, z#

EndIf


Input$ Function

See Also

Input

Action

Returns a string of characters read from a file.

Syntax

Input$(n%, [#]filenumber%)

Arguments

n%	The number of characters (bytes) to be read from the file.  n% cannot exceed 32, 765.
filenumber%	The number that was used in the Open statement to open the file.
Examples

Open "c:\docs.txt" For Input As #5

If EOF( #5 ) <> 1

Input( 32000, #5 )

EndIf


InStr Function

Action

Searches and returns the character position of the first occurrence of a string within another string.

Syntax

Instr([startExpr,] strexpr1$, strexpr2$)

Arguments

startExpr	Any numeric expression which will represent the position for starting each search; startExpr must be between 1 and approximately 32,767, inclusive.
strexpr1$	The  text string being searched.
strexpr2$	The text string to look for.
Returns

The arguments strexpr1$ and strexpr2$ can be string variables, string expressions, or string literals.  The value returned by Instr depends on these conditions:

Condition	Value returned
strexpr1$ found in strexpr2$	The position at which the match was found.
startExpr& greater than length of strexpr2$	0
strexpr1$  is a null string	0
strexpr2$ cannot be found	0
strexpr2$ is a null string	startexpr&
Remarks

Use the Len function to find the length of strexpr1$.

Examples of Instr()

Var = Instr( 1, "elephant", "phant")	sets Var = 4
Var = Instr(1, "Elephant", "ant")	sets Var = 6
Var = Instr(2, "Elephant", "e")	sets Var =3


Int Function

Action

Returns the integer part of the argument.  Converts a numeric expression to the largest integer less than or equal to the expression.

Syntax

Int(NumericExpression)

Argument

NumericExpression	Any numeric expression.  The Int function returns the integer ceiling of its argument.
Example

N = Int(3.14159)	sets N = 3
N = Int(-9.8)	set N = -9


LCase$ Function

See Also

UCase$

Action

Returns a string where all letters have been converted to lowercase.

Syntax

A$ = LCase$(StringExpression$)

Argument

StringExpression$	The text string to be converted to lower case.
Remarks

The LCase$ function takes a string variable, string constant, or string expression as its single argument.  Only uppercase letters are converted to lowercase; all lowercase letters and non-letter characters remain unchanged.  LCase$ and UCase$ are helpful in making string comparisons that are not case sensitive.

Example

 Text$ = "Like It OR Lump It"

 NewText$ = LCase$(Text$)

 ' Results: NewText$ = "like it or lump it"


Left$ Function

See Also

Mid$

Right$

Action

Returns a string consisting of the leftmost n% characters of the specified string.

Syntax

A$ = Left$(StringExpression$, n%)

Arguments

StringExpression$	StringExpression$ can be any string variable, string constant, or string expression.
n%	n% is an integer expression indicating how many characters to return.  It must be between 0 and 32,767, inclusive.
Remarks

If n% is 0, the null string (zero-length) is returned.  If n% is greater than or equal to the number of characters in StringExpression$, the entire string is returned padded with blanks on the left.  To find the number of characters in StringExpression$, use Len(StringExpression$).

Example

s$ = "Massachusetts"

A$ = Left$(s$, 5)

' Returns A$ = "Massa"


Len Function

Action

Returns the number of characters in a string.

Syntax

n = Len(StringExpression$)

Example

Len returns the number of characters in the argument, including spaces and punctuation.

StringExpression$ = "Is this fun?"

X = Len(StringExpression$)

Returns:  X = 12


LowerPriority Function

See Also

RaisePriority( )

CompleteItem( )

Action

Lowers the priority of the selected records by one step.

Syntax

LowerPriority( recId )

Argument

recId	The record Id of the record being marked.  If (recId <> 0) then it acts on the specified record.  Otherwise, it acts on the selected records.
Argument

BeginSub LowerPriority( )

' Assume an item is selected in the Things To Do List, and 'recId=0

LowerPriority( recId )

EndSub


LTrim$ Function

See Also

RTrim$

Action

Returns a copy of a string with leftmost spaces removed.

Syntax

A$ = LTrim$(StringExpression$)

Remarks

The argument StringExpression$ can be any string expression.

Example

A$ = "        ABC"

B$ = LTrim$(A$)

'Results:  B$ = "ABC"


MailSend Function

Action

Sends a message to the designated recipients based on MAPI or VIM.

Syntax

MailSend(lpRecips$, lpSubj$, lpMsg$ )

Arguments

lpRecips$	If there is only one recipient, this string should be that recipient.  If there is more than one recipient, this should be a comma delimited list of recipients.  If lpRecips$ is empty, this function will check selected record(s) for EMAILADDRESS field.
lpSubj$	This string describes the subject of the message.  If left empty, a dialog box will pop up.
lpMsg$	This string contains the actual message.  If left empty, a dialog box will pop up.
Remarks

To mail documents, use the DocumentMail function.

Example

This macro will send an eMail message.

BeginSub MailSend( )

lpMsg$ = " Leave Thursday evening after work, I'll drive!"

MailSend( "JohnA ", "Utah Camping", lpMsg$)

EndSub


Message Function

Action

Displays a message in a dialog box, waits for the user to choose a button, and returns a value indicating which button the user chose.

Syntax

n = Message(title$, msg$, style%)

Arguments

title$	String expression to display in the title bar of the dialog box.
msg$	String expression to display as the message in the dialog box.
style%	Numeric expression that controls the buttons and icons to display in the dialog box.
Style%	Meaning
0	Display OK button only.
1	Display OK, Cancel button.
2	Display Yes, No buttons.
3	Display Yes, No, Cancel  Buttons
Returns

Value	Meaning
1	OK pressed
2	Cancel pressed
6	Yes pressed
7	No pressed
Example

Title$ = "My Application"

Msg$ = "Do you want to save this file?"

Style% = 3

n = Message(Title$, Msg$, Style%)

If x = 6 Then 'OK was selected


Mid$ Function

See Also

Left$

Len

Right$

Action

Returns a string (substring) that is part of another string.

Syntax

Mid$(StringExpression$,  Start% [, Length%] )

The Mid$ function returns Length%  characters from StringExpression$, beginning at character Start%.

Arguments

StringExpression$	The string expression from which the substring is taken.  This can be any string expression.
Start%	An integer that indicates the character position in StringExpression$ where the part to be taken begins.
Length%	An integer indicating the number of characters to return.
Remarks

The arguments Start% and Length% must be between 1 and approximately 32,767 inclusive.  If there are fewer than Length% characters in the string (including the Start% character), the Mid$ function returns all characters from the position Start% to the end of the string.

If Start% is greater than the number of characters in StringExpression$, Mid$ returns an empty string.

Use the Len function to find the number of characters in StringExpression$.

Example of Mid$ function

A$ = "Massachusetts"

B$ = Mid$(A$, 6, 3)

' Returns B$ = "chu"


Object_Create Function

See Also

Object_Show

Action

Creates an object from the Object list.

Syntax

Obj = Object_Create(Object$ ) As Object

Argument

Object$	Name of the object being created.
Remarks

The call name for Objects is displayed in the Data Types dialog box.  Select Types from the editor's View menu to access this dialog box.

Example

BeginSub CreateClock( )

A = Object_Create( "Clock" )

Object_Show( A )

EndSub

Note: The return value for Object_Create is the object Id and is used in other Object_ * functions such as Object_Show.


Object_GetData Function

Action

Retrieves the properties of the object.  Only works from the Action Bar button on that object.

Syntax

Object_GetData( ObjectId )

Argument

ObjectId	Object variable as returned by Object_Create.
Example

BeginSub ListView( )

' Initialize Variables

Dim LV As ListView

Dim RcList As Integer

' select first highlighted entry in LV

PBIndex = ResultsGetRec( 1 )

' get value of "Name" field

n = RecordGetField( PBIndex, "NAME", Name$ )

' search attachments for Name

RcList = RecSearchAttachResults( PBIndex )

'find number of attachments

n = ResultsGetCount( RcList )

' retrieve properties for the List Viewer

Object_GetData( LV )

LV.Form$ = "Conversation"

LV.Cat$ = "Contacts"

LV.c1.width = 200

LV.c1.Fields$ = "Summary"

LV.c1.Heading$ = "Summary"

LV.c1.bTotal = 0

' save these new values for the List Viewer

Object_SetData(LV)

' Update List Viewer with new search results

Object_SetResults(RcList)

EndSub


Object_SetData Function

Action

Sets the properties of an Object.  Can only run from an Action Bar on that type of object.

Syntax

Object_SetData( ObjectId )

Argument

ObjectId	The Object variable, as returned by Object_Create()
Example

See Example from Object_GetData function.


Object_SetResults Function

Action

Refreshes the object with the results from a new search.  Can only be run from an Action Bar on the object.

Syntax

Object_SetResults( Results& )

Argument

Results&	Search Id returned by a Search function, such as RecordRunSearch.
Example

See Example from Object_GetData function.

Note:  Refer to Object_Create to see which Object properties you may set.


Object_SetSearch Function

Action

Assigns a new search to an object.  Must be run from an Action Bar on the object.

Syntax

Object_SetSearch( Search& )

Argument

Search&	Search Id from a previously run RecordSearchValue() or RecordSearchDlg() function.
Example

BeginSub SetSearch( )

Dim LV As ListView

RecordStartSearch( "Contacts", "Phone Book" )

Search = RecordSearchValue( "Name", " = " , "Joanne" )

Object_GetData( LV )

Object_SetSearch( Search )

EndSub


Object_Show Function

Action

This command displays an object created with Object_Create().

Syntax

Object_Show( ObjectId )

Argument

ObjectId	Object Id returned by Object_Create.
Example

BeginSub CreateClock( )

A = Object_Create( "Clock" )

Object_Show( A )

EndSub


Open Statement

See Also

Close

Action

Enables input/output (I/O) to a file.

Syntax

Open File$ For [Mode] As [#]FileNumber%

Remarks

You must open a file before any I/O operation can be performed on it.   If File$ does not exist, it is created when opening a file for Output.

Arguments

File$	Name of the filename or path to open.
Mode	One of the following keywords that specify the file mode:  Append, Input, Output.
FileNumber%	Integer expression with a value between 1 and 255, inclusive.  When an Open statement is executed, the file number is associated with the file as long as it is open.  Other I/O statements may use the number to refer to the file.
Example

Open "Test.txt" For Input As #1

While Eof(1) <> 1 Then

Line Input #1, String$

Wend


PackRatMessage Statement

Action

Displays a text string in a dialog box.  The text string is limited to 255 characters.

Syntax

PackRatMessage(Msg$)

Argument

Msg$ can be any character string.

Remarks

Strings larger than 255 characters may be supported.

Example

BeginSub ShowPRMessage( )

Message$ = "This message will appear in a dialog box"

PackRatMessage(Message$)

EndSub

Running the ShowPRMessage() macro generates a dialog box stating "This message will appear in a dialog box".


PasteRecFromClipBoard Function

Action

Takes the selection(s) from the Clipboard and creates record(s) using the specified template format and the specified form.

Syntax

PasteRecFromClipBoard( Form$, Template$ )

Argument

Form$	The form to which the record will be added.
Template$	Template Name previously designed with the Template Editor.
Example

PasteRecFromClipBoard( "Contacts:Phone Book", "Standard Address" )

Adds the contents of the Clipboard to the "Contacts:Phone Book"  form using the standard address template to guide the information into the proper fields.


PhoneCall Statement

Action

Dials the specified phone number.

Syntax

PhoneCall(lpRecip$)

Remarks

lpRecip$ is a string containing the recipient's phone number.  If this string is left empty, the PHONENUMBER field in the currently highlighted record will be used.

Example

PhoneCall ("619-555-1212")


PlayWaveFile  Function

Action

Plays any wave (*.wav) file.

Syntax

PlayWaveFile( Wave$, PlayCmd )

Arguments

Wave$	Any valid *.wav filename
PlayCmd	Can be 0, 1, or 9.   • If 0 is selected, the sound is played synchronously and the function does not return until the sound ends.  • If 1 is selected, the function returns immediately after beginning the sound. • If 9 is selected, the sound continues to play repeatedly until PlayWaveFile is called again with Wave$ = empty.
Example

BeginSub PlayWave( )

PlayWaveFile( "TaDa.wav", 0 )

EndSub


Poke Function

See Also

Execute

Request

Initiate

Terminate

Action

Transfers the given strings to the server application in a DDE conversation.

Syntax

Poke(hCh&, Topic$, Item$)

Arguments

hCh&	The return value of the Initiate function.
Topic$	Topic to be sent to the other application.
Item$	Item to be sent to the other application.
Returns

Zero - if Messages sent

Non zero - if some error occurred

Example

Dim hChannel As Long

hChannel = Initiate("vision", "address.ovd")

Name$ = "John"

Company$ = "Polaris"

Poke (hChannel, "NAME", Name$)

Poke(hChannel, "COMPANY", Company$)

Terminate (hChannel)


Print Statement

See Also

Open

Input

Read

Write

Action

Writes data to a sequential file.

Syntax

Print filenumber%, ExpressionList

Arguments

filenumber%	Number of an open sequential file.
ExpressionList	Comma delimited list of expressions which evaluate to Integer, Long, Float, Double, String, User-defined types, or arrays.
Remarks

Print writes ExpressionList% to the file indicated by filenumber%.

Data in the file will be separated by commas.  Unlike the Write statement, strings will be output as quoted text.  Array elements are separated by commas, as are user-fields.

Successive Print Statements generate successive lines in the data file.


PrintReport Function

Action

Prints the specified report.

Syntax

PrintReport( Report$, Results% )

Argument

Report$	The name of the report, in the format:   Category: ReportTitle
Results%	The data for the report, if provided.  This parameter can be null.
Example

BeginSub

PrintReport( "Contacts:  Mailing List", Results% )

EndSub


Prompt Function

Action

Displays a dialog box, and prompts the user for an input message.

Syntax

N = Prompt(prompt$, caption$, return$)

Arguments

prompt$	String expression to display above the edit control in the dialog box.
caption$	String expression to display as the title in the dialog box.
return$	NULL string if Cancel Button pressed, otherwise the string that the user entered in the dialog box edit control.
Returns

Value	Meaning
1	OK pressed
0	Cancel pressed
Example

BeginSub Getname()

Prompt("Enter your name:", "User Information", name$)

greeting$ ="Hi "+ name$

PackRatMessage(greeting$)

EndSub

When the function Getname( ) is run, the User Information dialog box displays, as specified in the Prompt command.

After entering a name, such as "Dave", the user clicks the OK button and the message "Hi Dave" displays.


RaisePriority Function

See Also

LowerPriority( )

CompleteItem( )

Action

Raises the priority of the selected record(s) by one state. (If it has a Priority.)

Syntax

RaisePriority( )

Argument

recId	The record Id of the record being marked.  If (recId <> 0) then it acts on the specified record.  Otherwise, it acts on the selected records.
Example

BeginSub RaisePriority( )

' Assume an item is selected in the Things To Do List, and 'recId=0

RaisePriority( recId )

EndSub


Read Statement

See Also

Write

Input

Action

Reads data from a file and assigns the data to variables.  Used in conjunction with the Write statement.

Syntax

Read #filenumber%, variablelist

Remarks

filenumber%	filenumber% is the number used in the Open statement to open the file.
variablelist	variablelist is a comma-delimited list of the variables that are assigned values read from the file.  They can be array and user-defined variables.
Remarks

Data items in a file must appear in the same order as the variables in  variablelist.  Data in the file is separated by commas or carriage returns, or EOF.

Unlike the Input Statement, String Data in the file should not be quoted.

Be sure you match data in the file with the proper variable types; that is, string data into string variables and numeric data into numeric variables.

Array elements and user-defined elements are delimited by commas.

If the end-of-file is reached when a numeric or string item is being input, the input is terminated.

Example

Open "Test.txt" For Input For Input As #1

If not EOF(1)

Read #1, x, y, name$, z#

EndIf


RecDelete Function

Action

Deletes the record specified by RecId.

Syntax

RecDelete( RecId )

Argument

RecId	The record Id of the record to be deleted.
Example

BeginSub Del( )

RecId = ResultsGetRec(0)

RecDelete(RecId)

EndSub


RecGetField Function

Action

Fills the buffer with the field value for the specified field in the given record.

Syntax

RecordGetField( recId, Field$, FieldBuff$ )

recId	The record Id
Field$	The name of the field being accessed
FieldBuff$	Buffer to hold the contents of the field.
Remarks

You could alternatively use ResultsGetField(Results%, Field$, FieldBuff$) if you're working from selected results without ResultsGetRec( ) getting the record first.

Example

BeginSub GetRec( )

RecId = ResultsGetRec( 1 )

RecordGetField( RecId, "Name", Name$ )

RecordGetField( RecId, "PhoneNumber", Phone$ )

PackRatMessage( "Name is " + Name$ + " - " + Phone$ )

EndSub


RecordAddDlg Function

Action

Loads a pop-up dialog box so a new record can be added to the Form.  Enables you to add information to a Form.

Syntax

RecordAddDlg(Form$)

Argument

Form$	This string contains the name of the active form.
Example

Form$ = "Contacts: Phone Book"

RecordAddDlg( Form$ )


RecordDelete Function

Action

Deletes all selected record(s) from any object containing records.

Syntax

RecordDelete( recId )

Argument

recId	If (recIc <> 0) then delete the specified record.  Otherwise, use the selected record(s).
Example

recId = ResultsGetRec( Results% )

' If (recId = 0) then delete the selected records

RecordDelete( recId )


RecordEditDlg Function

Action

Enables you to edit the selected record in any object.

Syntax

RecordEditDlg( recId )

Argument

recId	If (recId <> 0) then the specified record is used instead.
Example

This macro is called from the Edit icon on all Action Bars.

recId = ResultsGetRec( Results% )

' If ( recId = 0 ) Then look for selected record(s)

RecordEditDlg( recId )


RecordEndAdd Function

Action

Defines the end of a record's definition.  It completes the Add sequence and implements the changes.

Syntax

RecordEndAdd(  )

Remarks

Every adding sequence must begin with a RecordStartAdd() and end with a RecordEndAdd().  The fields are set between these two functions.

Example

This is an example of a record adding sequence.

RecordStartAdd("Contacts:Phone Book")

RecordSetField("NAME", "Dave Jag")

RecordSetField("PHONENUMBER", "555-8817")

•

•

RecordEndAdd()


RecordEndUpdate Function

Action

Defines the end of an update sequence.  Makes the changes to the record that were specified in the update sequence.

Syntax

RecordEndUpdate( )

Remarks

Used in conjunction with the RecordStartUpdate Statement.

Example

RecordStartUpdate("Phone Book")

RecordSetField("NAME", "Dave")

RecordSetField("PHONENUMBER", "555-4111")

•

•

RecordEndUpdate( )


RecordFillForm Function

Action

Fills a form with the data from a record.

Syntax

RecordFillForm( recId, A )

Arguments

recId	The record Id (index number).
A	Form Id returned by Form_Create.
Example

BeginSub FillForm( )

•	{perform a search}

ResultsSetFirst(RcList)

' create a form

nForm = FormCreate( "Contacts:Phone Book" )

' get the current record

Rc = ResultsGetRec( RcList )

' find the value of the Name field

ResultsGetField( Rc, "NAME", Name$ )

' fill the form with the record's values

RecordFillForm( Rc, nForm )

' show form in edit mode

CvIndex = FormEditRec( nForm, "NAME", Len(Name$))

EndSub


RecordGetField Function

Action

Gets the value of a field for a specific record.

Syntax

RecordGetField( recId, Field$, Buff$ )

Arguments

recId	The record Id of the record being accessed.
Field$	The field name being accessed in that record.
Buff$	Buffer variable to contain the value of the field.
Example

RecId = ResultsGetRec( Results% )

RecordGetField( recId, "NAME", Name$ )

' Results:  Sets Name$ = "John"


RecordGetForm Function

Action

Returns the Form from which the specified record belongs.

(See Remarks)

Syntax

RecordGetForm(RecId)

Argument

RecId	The record Id (index number).
Remarks

A = RecordGetForm( recId )

Makes A a Form of the same type as to which the given record belongs, however A is not initialized to contain the same fields of the record.  To do this, one must call the  RecordFillForm( recId, A) function.

Example

A = ResultsGetRec(1)

B = RecordGetForm(A)

RecordFillForm( A, B)

FormShow(B)


RecordRunSearch Function

Action

Defines the end of the search criteria process and starts the searching process.

Syntax

RecordRunSearch( )

Example

This example demonstrates a typical search sequence.

RecordStartSearch("Phone Book")

RecordSearchValue("NAME", "<>" , "A")

•

•

Results% = RecordRunSearch( )

•

ResultsFree(Results%)


RecordSearchAll Function

Action

Searches the entire database and returns a set of results.

See Remarks below for important details.

Syntax

Results% = RecordSearchAll()

Remarks

If run from the Action Bar of an object that contains records, then the parameters are ignored and the search finds all records within the scope of that object.

If run from an Action Bar on the desktop, then a message will be sent to all objects on the active folder to do a SearchAll.


RecordSearchAnd Statement

Action

Connects two record search values for all values satisfying both criteria.

Syntax

Record SearchAnd( )

Example

RecordStartSearch(Category$, Form$)

'Set up the search criteria for each field.  The RecordSearchAnd 'function will only return records satisfying All of the criteria.  To return 'records satisfying any of the criteria, use RecordSearchOr().

RecordSearchValue("NAME", "=", Name$)

RecordSearchAnd()

RecordSearchValue("COMPANY", "=", Company$)

RecordSearchAnd()

RecordSearchValue("PHONENUMBER",  "=", Phone$)

Results = RecordRunSearch()


RecordSearchAttaches Function

Action

Searches for Attachments to all the selected records and returns a set of results.

Syntax

Results% = RecordSearchAttaches( )

Example

This function may be run from an Action Bar or Action Button from any object with records.


RecordSearchDlg Function

Action

Will pop-up a dialog box to perform a search based on the supplied Form.

Syntax

RecordSearchDlg( Category$, Form$)

Argument

Category$	The name of the category that the form is in.
Form$	This string contains the name of the active form.
Example

Category$ = "Contacts"

Form$ = "Phone Book"

RecordSearchDlg(Category$, Form$)


RecordSearchOr Statement

See Also

RecordSearchAnd( )

Action

Connects two record search parameters and finds all records satisfying either of the criteria.

Syntax

RecordSearchOr( )

Example

This section of the macro will find all Phone Book entries living in California or Vermont.

RecordStartSearch( "Contacts", "Phone Book" )

RecordSearchValue( "State", " = ", "CA" )

RecordSearchOr( )

RecordSearchValue( "State", " = ", "VT" )

RcList& = RecordRunSearch( )


RecordSearchValue Function

Action

Sets the search criteria used in the search sequence.

Syntax

RecordSearchValue(lpFieldName$, lpOp$, lpValue$)

Arguments

lpFieldName$	This string contains the name of the field to be searched.
lpOp$	The Boolean search operand:    =, <,  >,  <=,  >=, not equal, is exactly,  contains,  is blank.
lpValue$	This string contains the search criteria being looked for in lpFieldName$.
Example

This example demonstrates a typical search sequence.

RecordStartSearch( "Contacts", "Phone Book" )

RecordSearchValue("NAME",  "=",  "A")

•

Results% = RecordRunSearch( )


RecordSetField Function

Action

Sets the field value used when adding or updating a record.

Syntax

RecordSetField(lpFieldName$, lpFieldValue$)

Arguments

lpFieldName$	The string containing the field name.
lpFieldValue$	The string containing the information to be added to the field.
Example

This is an example of a record adding sequence.

RecordStartAdd("Contacts:Phone Book")

RecordSetField("NAME", "Dave Jag")

RecordSetField("PHONENUMBER", "555-4111")

•

•

RecordEndAdd()


RecordStartAdd Function

Action

Begins the Add sequence for adding a Record.

Syntax

RecordStartAdd(Form$)

Argument

Form$	This string contains the name of the active form.
Example

This is an example of a record adding sequence.

Form$ = "Contacts:Phone Book"

RecordStartAdd(Form$)

RecordSetField("NAME", "Dave Jag")

RecordSetField(PHONENUMBER", "555-8111")

•

•

RecordEndAdd()


RecordStartSearch Function

See Also

RecordSearchAll( )

Action

Defines the beginning of the search sequence.

Syntax

RecordStartSearch(Cat$, Form$)

Argument

Cat$	The Category to be searched.
Form$	This string contains the name of the active form.
Example

Some typical search sequences:

' search within a specific form

RecordStartSearch( "Contacts", "Phone Book" )

- OR -

' search forms within a specific category

RecordStartSearch( "Contacts", " " )

- OR -

' search all forms in all categories

RecordStartSearch( " ", " " )


RecordStartUpdate Function

Action

Defines the beginning of the update sequence.  Signifies that an update is to be performed.

Syntax

RecordStartUpdate(results%)

Argument

results%	This integer value serves as a link to the search results contained in memory.
Remarks

A search must be performed first in order to use this function.

Example

This section from a "search and update" macro demonstrates how the RecordStartUpdate function is used in context.

' Total the # of records found from a search

Rc = ResultsGetTotal(Results%)

' Set pointer to the first record in the search results list

ResultsSetFirst(Results%)

For J = 1 to Rc

' Define the beginning of the update process

RecordStartUpdate(Results%)

' Set the contents of the Name field to "Bob"

RecordSetField("NAME", "Bob")

' Define end of update process and initialize changes

RecordEndUpdate( )

' Set pointer to next record and return pointer index

ResultsSetNext(Results%)

Next J

' Delete the specified list index from the buffer

ResultsFree(Results%)


RecVarFree Function

Action

Frees the given record variable without changing that record in the database.

Syntax

RecVarFree( recId )

Argument

recId	Index of the record.
Example

BeginSub Free( )

•

PBIndex = ResultsGetRec( 1 )

•

RecVarFree( PBIndex )

EndSub


RecVarFreeAll Function

Action

Frees all the given record variables.  Does not change the records in the database.

Syntax

RecVarFreeAll( )

Example

BeginSub FreeMacro( )

RecVarFreeAll( )

•

EndSub


Rem Statement

Action

Allows explanatory remarks in a program.

Syntax1

Rem remark

Syntax 2

' remark

Remarks

The argument remark is the text of any comments you want to include with your program.  Spaces and punctuation are permitted.  Rem statements are ignored when you create an executable file.  They appear exactly as entered when the program is listed.

Comments are useful to document how your code works or provide any other information you may want to include with your code.  As shown in the syntax, a single quotation mark (apostrophe) can be used instead of the Rem keyword.

Example

Rem This section creates an array containing the days of the week.

Dim DayList$[1 to 7]  ' creates an array variable for the days

DayList$[1] = "Sunday" ' assign Sunday as the 1st element

DayList$[2] = "Monday" ' assign Monday as the 2nd element

Rem  You should have the hang of Rem statements by now.


ReplaceString Function

Action

Loads the Replace dialog box.  Works on the current edit control or the Memo Pad.  Use this to search for a text string and replace it with another, either on a case by case basis, or throughout the entire document.

Syntax

ReplaceString( )

Remarks

This function may be run from an Action Bar or an Action Button.  The Replace dialog box displays.


Request$ Function

See Also

Execute

Poke

Initiate

Terminate

Action

Asks the server in a DDE conversation to update the contents of a string buffer.

Syntax

Request$( hCh&, Item$ )

Arguments

hCh&	The return value of the Initiate function.
Item$	String expression to be sent through the server.
Returns

String representing the value of the requested item.

Example

Dim hChannel As Long

hChannel = Initiate( "Excel", "test.xls")

A$ = Request$ (hChannel, "R1C1")


ResultsDelete Function

Action

Deletes one or more records as identified by SetId.

Syntax

ResultsDelete( SetId )

Argument

SetId	The Id to the search results.
Example

BeginSub Del()

RecordStartSearch("", "")

Results = RecordRunSearch()

ResultsDelete(Results)

EndSub


ResultsFree Statement

Action

Deletes the specified List index from the memory buffer.

Important:  After a search or update is perfomed, you should wipe everything from the buffer, else all search results will stay in memory.

Syntax

ResultsFree(result%)

Argument

result%	This integer value serves as a link to the search results contained in memory.
Example

The macro lines shown below demonstrate how the ResultsFree statement is used in context.  The results of a search are viewed, and afterward, deleted from the memory buffer.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

Rem  View the contents of the NAME field for the entire result1% Rem   list.

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

For J = 1 to total%

' Assign contents of NAME field to lpFieldBuff$

ResultsGetField( result1%,"NAME", lpFieldBuff$ )

' Display the name in lpFieldBuff$

PackRatMessage( lpFieldBuff$ )

' Move the pointer to the next record and return the pointer index

ResultsSetNext( result1% )

Next J

ResultsFree( result1% )


ResultsGetCount Function

Action

Returns the number of records in the current list.

Syntax

ResultsGetCount( RcList )

Argument

RcList	The list index returned from a RecordRunSearch(), RecordSearchAll() or other search function.
Example

BeginSub Attach( )

•

PBIndex = ResultsGetRec( 1 )

RcList = RecSearchAttachResults( PBIndex )

Rc = ResultsGetCount( RcList )

•

EndSub


ResultsGetCurr Statement

See Also

ResultsGetField	ResultsSetLast
ResultsSetNext	ResultsSetPrev
ResultsSetCurr	ResultsFree
ResultsSetFirst
Action

Returns the current position (value) of the pointer index.

Syntax

ResultsGetCurr(result%)

Argument

result%	This integer value serves as a link to the search results contained in memory.
Example

This macro section demonstrates how the ResultsGetCurr function can be used to display the current pointer location.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' Get total number of records found in the search

total% = ResultsGetTotal( result1% )

' Assign the current index location to i%

i% = ResultsGetCurr ( result1% )

i$ = STR$( i% )

' Display the index location

PackRatMessage ( i$ )


ResultsGetField Statement

See Also

ResultsSetNext	ResultsSetLast
ResultsSetCurr	ResultsSetPrev
ResultsSetFirst	ResultsFree
Action

Retrieves the search results and puts the value of the specified field in a buffer.

Syntax

ResultsGetField(results%, lpField$, lpFieldBuff$)

Arguments

results%	This integer value is returned by a Search function and is a link to the search results contained in memory.
lpField$	This string holds the name of the field.
lpFieldBuff$	This string holds the contents of lpField$.
Remarks

Works off the current record in results%.

Example

These macro lines demonstrate how the ResultsGetField statement is used in context.  The results of a search are assigned to a variable and viewed.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

'  View the contents of the NAME field for the entire result1% list.

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

ResultsSetFirst(result1%)

For J = 1 to total%

' Assign contents of NAME field to lpFieldBuff$

ResultsGetField( result1%,"NAME", lpFieldBuff$ )

' Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)

'Move the pointer to the next record and return the pointer index

ResultsSetNext(result1%)

Next J


ResultsGetRec Function

Action

Returns the record Id for the current record pointed to by the search results.

Syntax

ResultsGetRec(Results)

Results	Results returned from a previous search.
Example

' This macro will search for attachments to a record found in a 'search.

' RCList1 is the pointer from the previously performed search.

' RCList2 will point to the search performed for the attaches.

BeginSub

DIM RCList1 as Long  	'Variable for initial search results

DIM RCList2 as Long	'Variable for attach search results

.

'Point to the first item in the search results.

ResultsSetFirst(RCList1)

'Get the ID of the record and store it in the variable PointID

PointID=ResultsGetRec(RCList1)

' Search for attachments to that record

RCList2=RecSearchAttachResults(PointID)

'Display the attachments in the list viewer

ObjectSetResults(RCList2)

'Free up all the used memory for the record and the searches.

RecVarFree(PointID)

ResultsFree(RCList1)

ResultsFree(RCList2)

EndSub


ResultsGetTotal Statement

See Also

ResultsGetField	ResultsSetLast
ResultsSetNext	ResultsSetPrev
ResultsSetCurr	ResultsFree
ResultsSetFirst
Action

Calculates the total number of records found in a search.

Syntax

ResultsGetTotal(result%)

Argument

result%	This integer value is a link to the search results contained in memory.  This is the number returned by RecordRunSearch() or any other function which returns results.
Example

These macro lines demonstrate how the ResultsGetTotal statement is used in context.  The results of a search are assigned to a variable, viewed, and then deleted from the memory buffer.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' View the contents of the NAME field for the entire result1% list.

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

For J = 1 to total%

' Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

' Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)

' Move the pointer to the next record and returns the pointer index

ResultsSetNext(result1%)

Next J

ResultsFree(result1%)


ResultsSetCurr Function

See Also

ResultsGetField	ResultsSetLast
ResultsSetNext	ResultsSetPrev
ResultsGetCurr	ResultsFree
ResultsSetFirst
Action

Sets the pointer to the specified index value.

Syntax

ResultsSetCurr(Result%, SetIndex%)

Argument

Result%	This integer value serves as a link to the search results contained in memory.
SetIndex%	The index value that sets the pointer.
Example

These macro lines demonstrate how the ResultsSetCurr statement is used in context.  In this case, the pointer is set to a specific location on the search results list and the value of the NAME field is viewed for that record.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

' Set the pointer to the third item on the search list

ResultsSetCurr( result1%, 3 )

' Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

'Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)


ResultsSetFirst Statement

See Also

ResultsGetField	ResultsSetLast
ResultsSetNext	ResultsSetPrev
ResultsSetCurr	ResultsFree
Action

Sets the pointer to the first record in the search results.

Syntax

ResultsSetFirst(result%)

Argument

result%	This integer value is a link to the search results returned by RecordRunSearch().
Example

This macro segment demonstrates how the ResultsSetFirst statement is used in context.  In this case, the pointer is set to the top of the search results list and the value of the NAME field is viewed for that record.

' Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

' Set the pointer to the third item on the search list

ResultsSetFirst( result1% )

' Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

' Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)


ResultsSetLast Statement

See Also

ResultsGetField	ResultsSetFirst
ResultsSetNext	ResultsSetPrev
ResultsSetCurr	ResultsFree
Action

Sets the pointer to the last record in the search results.

Syntax

ResultsSetLast(result%)

Argument

result%	This integer value is a link to the search results returned by RecordRunSearch().
Example

This macro segment demonstrates how the ResultsSetLast statement is used in context.  In this case, the pointer is set to the top of the search results list and the value of the NAME field is viewed for that record.

'  Assign the results of a search to result1%

result1% = RecordRunSearch ( )

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

' Set the pointer to the third item on the search list

ResultsSetLast( result1% )

'   Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

'   Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)


ResultsSetNext Statement

See Also

ResultsGetField	ResultsSetLast
ResultsSetCurr	ResultsSetPrev
ResultsSetFirst	ResultsFree
Action

Sets the pointer to the next record and returns the pointer index.

Syntax

ResultsSetNext(result%)

Argument

result%	This integer value is a link to the search results returned by RecordRunSearch().
Example

This macro section demonstrates how the ResultsSetNext statement is used in context.  The results of a search are assigned to a variable, viewed, and then deleted from the memory buffer.

'Assign the results of a search to result1%

result1% = RecordRunSearch ( )

Rem  View the contents of the NAME field for the entire result1% list.

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

For J = 1 to total%

'   Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

'   Displays the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)

'   Move the pointer to the next record and return the pointer index.

ResultsSetNext(result1%)

Next J

ResultsFree(result1%)


ResultsSetPrev Statement

See Also

ResultsGetField	ResultsSetFirst
ResultsSetNext	ResultsSetLast
ResultsSetCurr	ResultsFree
Action

Sets the pointer to the previous record.

Syntax

ResultsSetPrev(result%)

Argument

result%	This integer value is a link to the search results contained in memory.
Example

This macro section demonstrates how the ResultsSetPrev statement is used in context.  The results of a search are assigned to a variable, viewed, and then deleted from the memory buffer. This is identical to the example shown for the ResultsSetNext statement, except the search list is traversed in reverse order.

'Assign the results of a search to result1%

result1% = RecordRunSearch ( )

Rem  View the contents of the NAME field for the entire result1% list.

' Get total number of records found in the search

total% = ResultsGetTotal(result1%)

ResultsSetLast(result1%)

For J = total% to 1

'   Assign contents of NAME field to lpFieldBuff$

ResultsGetField(result1%,"NAME", lpFieldBuff$)

'   Display the name in lpFieldBuff$

PackRatMessage(lpFieldBuff$)

'   Move the pointer to the record above it and returns the pointer 'index.

ResultsSetPrev(result1%)

Next J

ResultsFree(result1%)


Right$ Function

See Also

Left$

Mid$

Action

Returns a string consisting of the rightmost n% characters of a string.

Syntax

Right$(StringExpression$, n%)

Argument

StringExpression$	Can be any string variable, string constant, or string expression.
n%	An integer expression indicating how many characters to return.  It must be between 0 and approximately 32,767, inclusive.
Remarks

If n% is 0, the null string (zero-length) is returned.  If n% is greater than or equal to the number of characters in StringExpression$, the entire string is returned.

To find the number of characters in StringExpression$, use Len(StringExpression$).

Example

A$ = "Massachusetts"

B$ = Right$(A$, 6)

Results: B$ = "usetts"


RTrim$ Function

See Also

LTrim$

Action

Returns a copy of a string with rightmost spaces removed.

Syntax

RTrim$(StringExpression$)

Argument

StringExpression$	Can be any string expression.
Remarks

The RTrim$ function works with both fixed and variable-length string variables.

Example

A$ = "ABC     "

B$ = RTrim$(A$)

'Results:  B$ = "ABC"


RunScript Function

Action

Runs the specified Script.

Syntax

RunScript( ScriptName$ )

Argument

ScriptName$	The Name of the Script to run.  Must use the following format:  Category:ScriptName
Example

BeginSub RunTestScript( )

RunScript( "Miscellaneous:Test" )

EndSub


SearchUsingCatalog Function

Action

Searches using the specified report and returns the results.

Syntax

Results% = SearchUsingCatalog( Catalog$ )

Argument

Catalog$	The name of the report specified in the following format:  Category: ReportName
Example

BeginSub

Catalog$ = "Contacts:  Hot Prospects"

Results% = SearchUsingCatalog(Catalog$)

PrintReport(Report$, Results%)

EndSub


Seek Function

See Also

Open

Seek Statement

Action

Returns the current file position.

Syntax

Seek(filenumber%)

Argument

filenumber%	The number used in the Open statement to open the file.
Returns

Seek returns a value between 1 and 2,147,483,647, inclusive (equivalent to 2^31-1).

Example

This macro opens a file and reads the contents into a string.  When completed a message displays the location of the pointer.

BeginSub GetInput( )

Open "Test1.txt" For Input As #1

While Eof(1) <> 1 Then

Line Input #1, String$

Wend

' Assign the current location of the pointer to x%

x% = Seek(#1)

x$ = STR$( x%)

Status$ = "Line Input completed, pointer at " + x$

PackRatMessage (Status$)

EndSub


Seek Statement

See Also

Open

Seek Function

Action

Sets the position in a file for the next read or write.

Syntax

Seek [#]filenumber%, position%

Arguments

filenumber%	Number used in the Open statement to open the file.
position%	Numeric expression that indicates where the next read or write occurs.   Sets the file pointer at position%.  The position% value must be between 1 and 32,767, inclusive.
Remarks

At this time, position is an integer value -- it may accept long integers also.

Example

Open "Test.txt" For Input As #1

Seek #1, 10  ' Set the file pointer at the tenth byte

While Not Eof(1) Then

Line Input #1, String$

Wend


Select Case Statement

See Also

If...Then...Else

Action

Executes one of several statement blocks depending on the value of an expression.

Syntax

Select Case TestExpression

[Case expression

[StatementBlock1] ]

[Case expression

[StatementBlock2] ]

•

•

[Case Else

[StatementBlockn] ]

End Select

Arguments

TestExpression	Any numeric or string expression.
StatementBlock	The elements StatementBlock can consist of any number of statements on one or more lines.
expression	Any expression which evaluates to a type compatible with TestExpression.
Remarks

If TestExpression matches the expression associated with a Case clause, the statement block following that Case clause is executed up to the next Case clause, or for the last one, up to the End Select.  Control then passes to the statement following End Select.

If Case Else is used, its associated statements are executed only if TestExpression does not match any of the other Case selections.  Although not required, it is a good idea to have a Case Else statement in your Select Case block to handle unforeseen TestExpression values.

When there is no Case Else statement and no expression listed in the Case clause matches TestExpression, program execution continues at the statement following End Select.

Example

This Case statement tabulates data concerning people's ages.  Depending on the age, different variables are incremented.

Select Case Age%

Case Age% >= 1 And Age% <= 12

Children% = Children% + 1

Case Age% >= 13 And Age% <= 19

Teenagers% = Teenagers% + 1

Case Age% >= 20 and Age% <= 65

Adults% = Adults% + 1

Case Else

Seniors% = Seniors% + 1

End Select


SendKeys Function

Action

Sends the keyboard characters or actions specified by Key$ to the active application, just as if they were typed at the keyboard.  Alphabetic and numeric characters must be enclosed in brackets[ ].

See Example

Syntax

SendKeys( Keys$)

Argument

Keys$	A Key stroke, enabling you to enter letters and keyboard commands.
Use the table below to specify "invisible" Key$ characters.

Keyboard Key	Code
BackSpace	[bs]
Break	[break]
Caps Lock	[capslock]
Clear	[clear]
Del	[del]
Down Arrow	[down]
End	[end]
Enter	[enter]
Esc	[esc]
Help	[help]
Home	[home]
Ins	[insert]
Left Arrow	[left]
Num Lock	[numlock]
Page Down	[pgdn]
Page Up	[pgup]
Print Screen	[prtsc]
Right Arrow	[right]
Tab	[tab]
Up Arrow	[up]
F1	[F1]
F2	[F2]
F3	[F3]
F4	[F4]
F5	[F5]
F6	[F6]
F7	[F7]
F8	[F8]
F9	[F9]
F10	[F10]
F11	[F11]
F12	[F12]
F13	[F13]
F14	[F14]
F15	[F15]
Remarks

Sending Key Combinations

Repeating a Key Sequence

Tips for Using SendKeys()

Example

SendKeys( "[q]" )  ' sends the letter q

SendKeys( "[Q]" )  ' sends a [Shift] Q

SendKeys( "[esc]" )  ' sends an Escape key character

SendKeys( "[enter]*4" ) ' sends 4 Enter characters

SendKeys( "^[S]" )  ' sends Ctrl+Shift s

SendKeys("[s][t]")  'sends the characters st


Sending Key Combinations

When combining your key strokes with the [Alt], [Ctrl], or [Shift] keys, use the following table.

Important:  These key codes operate only on the [ ] immediately following it.  Sending an uppercase letter automatically implies that a [Shift] precedes it.  (see Examples)

To combine with:	Precede the Key's code with:
Alt	+  (plus)
Ctrl	%  (percent)
Shift	^  (caret)


Repeating a Key Sequence

To repeat a key sequence multiple times, use the following syntax:

[KeyCode]*n

where n is the number of times you want the key character repeated.  There must be an asterisk between the KeyCode and n.

n operates only on whatever is in the [ ] immediately preceding it.


Tips for Using SendKeys()

SendKeys() must be executed after an ActivateApp() function.

SendKeys should be used cautiously when used to send key commands to other programs.  It has no way of detecting problems in the other applications and should be tested extensively to verify that the input required by the application does not vary.  When possible DDE should be used, which provides a channel for two-way communication between applications, and also provides a path for error control.


Space$ Function

See Also

String$

Action

Initializes a string consisting of the given number of spaces.

Syntax

A$ = Space$(number%)

Argument

number%	Numeric expression indicating the length of the string to return.  Must be between 0 and approximately 32,767, inclusive.
Example

Dim A$ As String*500

A$ = Space$(500)


SpellCheck Function

Action

Tests the spelling of the text from the current edit control.

Syntax

SpellCheck( )

Remarks

The text can be anything:  Last Name field, Memo Pad, and such.

Example

The SpellCheck function displays the Speller dialog box.


StartTimeAccount Function

See Also

StopTimeAccount( )

Action

Starts running the specified Time Account.

Syntax

StartTimeAccount(lpAccountName$ )

Arguments

lpAccountName$	The name of the Time Account to be started.
Example

StartTimeAccount( "Long Distance" )

This function is run from an Action Bar or an Action Button.


Stop Statement

See Also

Run menu - Continue command

Action

Suspends execution of the program.

Syntax

Stop

Remarks

You can place Stop statements anywhere in the program to suspend program execution.  The Stop statement suspends program execution, but does not close files or clear variables.  To continue a program suspended with the Stop statement, choose Continue from the Run menu.

Example

BeginSub StopTest( )

Answer% = Message("Coffee Break ", "Do you wish to halt this macro? ", 2 )

' If Answer = yes then halt program

If Answer% = 6 Then

PackRatMessage("Select the File Menu - CONTINUE command to resume")

Stop

Else

'Continue program execution

EndIf

EndSub


StopTimeAccount Function

See Also

StartTimeAccount( )

Action

Stops running the specified Time Account.

Syntax

StopTimeAccount( lpAccountName$ )

Arguments

lpAccountName$	The name of the Time Account to be stopped.
Example

StopTimeAccount( "Long Distance" )

This is run from an Action Bar or an Action Button.


Str$ Statement

See Also

Val

Action

Returns a string representation of the value of a numeric expression.

Syntax

Str$(numeric-expression)

Argument

numeric-expression	Any numeric expression.
Remarks

Use the Str$ function to convert numeric characters to string characters.  The Val function complements Str$.

Examples

x# = 12.8

A$ = Str$(x#)

'Results:  A$ = "12.8"


String$ Function

See Also

Space$

Action

Returns a string of characters that all have the same ANSI code.  Use the String$ function to create a string of one character repeated over and over.

Syntax

String$(number%, charcode%)

Arguments

number%	Numeric expression indicating the length of the string to return.  It must be between 0 and approximately 32,767, inclusive.
charcode%	ANSI code of the character to use to build the string.
Example

BeginSub TestString( )

number% = 10

' ANSI code for "A"

charcode% = 65

x$ = String$( number%, charcode% )

PackRatMessage (x$)

EndSub

Running the TestString() macro generates the string "AAAAAAAAAA".


SysVar_GetDouble Function

See Also

SysVar_SetDouble

System Variables

Action

Retrieves the value of a System Variable containing double-precision numeric information.  System variables can only be updated by a SysVar_Set* function or using Hot Links.

Syntax

x! = SysVar_GetDouble( lpVar$ )

Arguments

lpVar$	A System Variable containing double-precision numeric information.


SysVar_GetInt Function

See Also

SysVar_SetInt

System Variables

Action

Retrieves the value of System Variables containing integers.  System variables can only be updated by a SysVar_Set* function or using Hot Links.

Syntax

SysVar_GetInt( lpVar$ )

Arguments

lpVar$	A System Variable containing numeric integer information. (-32,768 to 32,767)


SysVar_GetLong Function

See Also

SysVar_SetLong

System Variables

Action

Retrieves the value of System Variables containing long integers.  System variables can only be updated by a SysVar_Set* function or using Hot Links.

Syntax

SysVar_GetLong( lpVar$ )

Arguments

lpVar$	The System Variable containing numeric long integer information. (-2,147,483,648 to 2,147,483,647)


SysVar_GetString Function

See Also

SysVar_SetString

System Variables

Action

Retrieves the value of System Variables containing strings.  System variables can only be updated by a SysVar_Set* function or using Hot Links.

Syntax

SysVar_GetString( lpVar$, lpStr$ )

Arguments

lpVar$	The System Variable containing string information.
lpStr$	Buffer to hold the string information from the System Variable.
Example

In this example, MyNumber is a System Variable set using a Hot Link.

BeginSub DoMacro()

SysVar_GetString( "MyNumber", Phone$ )

PackRatMessage( "This number is on hold: " + Phone$ )

EndSub


SysVar_SetDouble Function

See Also

SysVar_GetDouble

System Variables

Action

Enables you to set the value of a Double-precision System Variable.  System variables can only be updated by running a SysVar_Set macro or using Hot Links.

Once set, System Variables remain set until you exit PackRat.

Syntax

SysVar_SetDouble( lpVar$, d# )

Arguments

lpVar$	The double-precision System Variable.
d#	The new value for the System Variable.


SysVar_SetInt Function

See Also

SysVar_GetInt

System Variables

Action

Enables you to set the value of an integer System Variable.  System variables can only be updated by running a SysVar_Set macro or using Hot Links.

Once set, System Variables remain set until you exit PackRat.

Syntax

SysVar_SetInt( lpVar$, i% )

Arguments

lpVar$	The double-precision System Variable for integers.
i%	The new value for the System Variable.


SysVar_SetLong Function

See Also

SysVar_GetLong

System Variables

Action

Enables you to set the value of a long integer System Variable.  System variables can only be updated by running a SysVar_Set macro or using Hot Links.

Once set, System Variables remain set until you exit PackRat.

Syntax

SysVar_SetLong( lpVar$, n& )

Arguments

lpVar$	The  System Variable for long integers.
n&	The new value for the System Variable.


SysVar_SetString Function

See Also

SysVar_GetString

System Variables

Action

Enables you to set the value of the String-type System Variable.  System variables can only be updated by running a SysVar_Set macro or using Hot Links.

Once set, System Variables remain set until you exit PackRat.

Syntax

SysVar_SetString( lpVar$, lpStr$ )

Arguments

lpVar$	The  System Variable for strings.
lpStr$	A string variable that updates the value of the System Variable.
Example

BeginSub Macro()

lpStr$ = "555 - 8024"

'  Define "MyNumber" as a system variable and assign it a value.

SysVar_SetString("MyNumber", lpStr$)

'  "MyNumber" is now a global variable in any other macro routine run 'after this.

EndSub


Terminate Function

See Also

Execute

Request$

Poke

Initiate

Action

Terminates a DDE conversation.

Syntax

Terminate(hCh&)

Argument

hCh&	The value identifying the other application.  (returned by the Initiate() function.)
Returns

Non zero on error

Zero if successful

Example

Dim hChannel As Long

hChannel = Initiate ("Excel", "Test.xls")

Terminate(hChannel)


ToggleContactPriority Function

Action

Toggles the priority of the selected record(s) on the Contact List form's "HIPRIORITY" field.

Syntax

ToggleContactPriority( )


Type Statement

Action

Used to define a data type containing one or more elements.

Syntax

Type usertype

  elementName As typename

[ elementName As typename]

EndType

Arguments

usertype	Name of the user-defined data type.  The argument usertype follows the same rules as a PackRatBASIC variable name.
elementname	Name of an element of the user-defined data type.  Follows the same rules as a PackRatBASIC variable name, but cannot be the name of an array.
typename	One of these data types: Integer, Long, Single, Double, String, or another user-defined type.
Remarks

A user-defined type must be declared in a type declaration before it can be used in the program.  Use Dim to declare a variable to be of a user-defined type.

Example

Type automobile

Manufacturer As string * 20

Model As string * 15

Year As integer

EndType


UCase$ Function

See Also

LCase$

Action

Returns a string in which all letters have been converted to all uppercase.

Syntax

UCase$(StringExpression$)

Argument

StringExpression$	A string variable, string constant, or string expression.
Remarks

Only lowercase letters are converted to uppercase; all uppercase letters and non-letter characters remain unchanged.

UCase$ works with both variable and fixed-length strings.  UCase$ and LCase$ are helpful when comparing strings without regard to capitalization.

Example

A$ = "This is a Case"

B$ = UCase$(A$)

' Results:  B$ = "THIS IS A CASE"


Val Function

See Also

Str$

Action

Returns the numeric value of a string of characters.

Syntax

A = Val(StringExpression$)

Argument

StringExpression$	A sequence of characters that can be interpreted as a numeric value.
Remarks

Use the Val function to convert strings to numbers.  The Val function stops reading the string at the first character that it cannot recognize as part of a number.

Symbols and characters often thought of as being part of a numeric value, such as the dollar sign and commas, are not recognized by Val as numeric.

Example

A = Val(" 57th Street West.")

Returns:  A =  57


While...Wend Statement

Action

Executes a series of statements in a loop, as long as a given condition is true.

Syntax

While condition

[Instructions]

Wend

Argument

condition	A numeric expression that PackRatBASIC evaluates as true (Non zero) or false (0).
Remarks

If condition is true, any intervening statements are executed until the Wend statement is encountered.  PackRatBASIC then returns to the While statement and checks condition.  If it is still true, the process is repeated.  If it is not true, execution resumes with the statement following the Wend statement.

While...Wend loops can be nested to any level.  Each Wend matches the most recent While.  When PackRatBASIC encounters an unmatched While statement, it generates the error message "While without Wend".  If PackRatBASIC encounters an unmatched Wend statement, it generates the error message, "Wend without While".

Do not branch into the body of a While...Wend loop without executing a While statement.

Example

Open "Test.txt" For Input As #1

While Eof(1) = 0 Then

Input #1, String$

Wend


Write Statement

See Also

Open

Print

Read

Input

Action

Writes data to a sequential file.

Syntax

Writefilenumber% [, expressionlist]

Arguments

filenumber%	This is the number used in the Open statement to open the file to write to.  The file must be opened in output or append mode.
expressionlist	The expressions in the argument expressionlist are comma-delimited string and/or numeric expressions, or arrays / user-defined types.
Remarks

The Write statement, unlike the Print statement, does not insert quotation marks around strings as they are written to the file.  A newline character is inserted once the last item in the list has been written to the file.  You can write multiple fields with one statement, but as soon as the line of code is executed, a newline character is inserted.  The data from the next Write statement will begin on a new line.


Data Types

This table contains the elementary data types supported by PackRatBASIC.


PackRat Field Names

PackRatBASIC field names enable you to retrieve and set the information in your Forms.

Due to the large number of fields and the ability for users to create their own fields, it is not possible to supply a complete list of PackRatBASIC field names. You should access PackRat's Form Editor to view the complete list of Field Names available.

The field names associated with a form generally are NOT the same as the field label shown in the form.  For example, the Phone Number field on the Phone Book form is PHONENUMBER regardless of whether the label appears as Phone, Phone #, Phone No., etc. on the form.

PackRatBASIC requires that field names always be referenced in upper case letters, such as:

NAME

COMPANY

PHONENUMBER

ADDRESS

CITY


String Types

There are two kinds of strings:

Default strings.

A Default string can contain up to 255 characters.

User-defined strings.

User-defined strings allow the user to declare strings larger or smaller than the default strings.  They can be up to 32,765 characters long.

User-defined string types can be declared wherever the keyword String appears in a PackRatBASIC Statement.

Examples

Declare User-defined string types in a Dim statement:

Dim Sample$ As String * 500

This statement defines a user-defined string type (String*500), which can contain up to 500 characters.  It sets the variable Sample$  to be of this type, and finally allocates 501 Bytes for Sample$  [1 extra Byte for NULL terminator]

Declare User-defined string types in a Typedef statement:

Type Point

Name$ As String * 25

x As Integer

y As Integer

EndType

This statement defines a user-defined string type, String*25, which can contain up to 25 characters, before processing the Type statement.  Thus a variable defined to be of type Point, will require 30 Bytes of storage - 26 for String*25 , and 2 bytes for each integer.


System Variables

System variables are global variables that can only be updated by running a SysVar_Set function or using Hot Links.

You can create and set the value of System Variables using one of the SysVar_Set functions.  There are SysVar functions dedicated to each data type as well as specific types of information (date, time).  When you need to retrieve the value of a System Variable, use the associated SysVar_Get function.

Example

This macro defines and sets a system variable.  It then checks and displays the value of it.

BeginSub SysVarMacro()

lpStr$ = "555 - 2524"

'Define MyNumber$ as a system variable and assign it a value.

SysVar_SetString(MyNumber$, lpStr$)

' MyNumber$ is now like a global variable in any other macro routine 'run after this.

•	{Assume MyNumber$ is updated by a Hot Link}

'Check and display the current value of MyNumber$

SysVar_GetString(MyNumber$, Phone$)

PackRatMessage("The current value is " + Phone$)

EndSub


Naming Variables

There are only a few simple rules to remember when naming variables:

1.	The first character of any variable must be a letter and the following characters must be either letters, numbers, or an underscore.  No other characters are allowed in the variable name.

Note: This does not include the type-declaration characters:

$, #, %, &,  which may be the suffix of any variable name.

2.	A variable name cannot exceed 40 characters.

3.	A variable name cannot be a PackRatBASIC reserved word. (For, Dim, Int, Instr, and so forth)

Example

pi# = 3.14  'Legal

2pi# = 6.24  'Illegal first character

Freds_File$ = " "  'Legal

Fred's_File$ = " "  'Illegal apostrophe character

This_has_too_many_characters_to_be_a_variable$ = " " 'Illegal

Right$ = "  " ' Illegal: PackRatBASIC Reserved word


Numeric Operators

The standard BASIC operators are demonstrated below using the following variable definitions:

Num1 = 2

Num2 = 5

Num3 = 20


Logical Operators (Bitwise Operators)

True = 1,  False = 0


String Variables

String variables can consist of any combination of numbers and/or letters and, like most PackRatBASIC variable types, are not case sensitive.  String variables must end with a dollar sign ($), and the text they are assigned to (the String Constant) must be in quotations (" ").

For example:

BeginSub AnimalType( )

StringVariable$ = "This part is called the String Constant"

Animal$ = "Dog"

Breed1$ = "St. Bernard"

NewString$ = "This "   +  Animal$  +   " is a "   +  Breed1$  +  "."

PackRatMessage( NewString$ )

EndSub

String variables can be added together to create a longer string.  In the AnimalType() Macro shown, a complete sentence is defined as NewString$ and then displayed with a PackRatMessage statement.

Running this macro would generate a a dialog box stating:  This dog is a Saint Bernard.


String Operators

Asc("string")

Returns the ASCI or ANSI value for the first character in the string.

Example:  Asc( "BOB") = 66 = Asc("B")

Chr$(ANSI code)

Returns a one character string corresponding to the ANSI code character.

Example:  Chr$(66) = "B"

InStr("string", "character")

Returns the location of the first occurence of a certain character in the string.

Example:    Instr("Bernard", "n") = 4

LCase$("string")

Returns a string with all lower case characters.

Example:     A$ = LCase$("BUBBA")

          Returns:  A$ =  "bubba"

Left$("string", integer )

Returns the number of characters in the string specified by the integer, starting with the leftmost character.

Example:     Left$("Spudster", 4) = "Spud"

Len("string")

Returns the number of characters in the string.

Example:     Len("Bob") = 3

Mid$("string", int1, int2)

Returns the number of characters specified by int2, starting int1 characters from the left.

Example:    Mid$("MeadowRock", 7, 3) = "Roc"

Right$("string", integer)

Returns the number of characters in the string specified by the integer, starting with the rightmost character.

Example:    Right$("Prelude", 4) = "lude"

Str$(integer)

Returns the integer as a character string.

    Example:   Str$(27) =  "27"

UCase$("string")

Returns a string with all upper case characters.

Example:    A$ = UCase$("bubba") =

         Returns:  A$ = "BUBBA"

Val("string")

Returns the integer equivalent of a numeric character string.

Example:   Val("27") =  27


Index of PackRatBASIC Commands
PackRatBASIC Commands

A

Abs Function

ActivateApp Function

AddToContactList Function

Asc Function

Associate Statement

AttachItems Function

AttachRecs Function

B

C

Chr$ Function

Close Statement

CompleteItem Function

CopyRecToClipBoard Function

CopyRecToFile Function

D

Declare Statement

Dim Statement

DocumentFax Function

DocumentMail Function

DocumentNew Function

DocumentOpen Function

DocumentPrint Function

E

EditCopy Function

EditCut Function

EditPaste Function

EOF Function

Execute Function

F

File_Close Function

File_Copy Statement

File_Delete Function

File_New  Function

File_Open Statement

Files_Enum Function

Finance_ClearTransaction Function

Finance_Reconcile Function

Finance_Summary Function

Finance_UnclearTransaction Function

FindString Function

FindSynonym Function

For...Next Statement

FormAddRec Function

FormCreate Function

FormDestroy Function

FormEditRec Function

FormEnumFields Function

FormGetFieldFromDlg Function

FormGetFieldName Function

FormGetNotes Function

FormGetNotesLen Function

FormSelect Function

FormsEnum Function

FormSetFieldFromDlg Function

FormSetNotes Function

FormShow Statement

G

GetDate$ Function

GetSelectedResults Function

GetTime$ Function

GoTo Statement

H

HotLink_Connect Function

HotLink_Disconnect Function

I

If...Then...Else Statement

Initiate Function

Input Statement

Input$ Function

InStr Function

Int Function

J

K

L

LCase$ Function

Left$ Function

Len Function

LowerPriority Function

LTrim$ Function

M

MailSend Function

Message Function

Mid$ Function

N

O

Object_Create Function

Object_GetData Function

Object_SetData Function

Object_SetResults Function

Object_SetSearch Function

Object_Show Function

Open Statement

P

PackRatMessage Statement

PasteRecFromClipBoard Function

PhoneCall Statement

PlayWaveFile  Function

Poke Function

Print Statement

PrintReport Function

Prompt Function

Q

R

RaisePriority Function

Read Statement

RecDelete Function

RecGetField Function

RecordAddDlg Function

RecordDelete Function

RecordEditDlg Function

RecordEndAdd Function

RecordEndUpdate Function

RecordFillForm Function

RecordGetField Function

RecordGetForm Function

RecordRunSearch Function

RecordSearchAll Function

RecordSearchAnd Statement

RecordSearchAttaches Function

RecordSearchDlg Function

RecordSearchOr Statement

RecordSearchValue Function

RecordSetField Function

RecordStartAdd Function

RecordStartSearch Function

RecordStartUpdate Function

RecVarFree Function

RecVarFreeAll Function

Rem Statement

ReplaceString Function

Request$ Function

ResultsDelete Function

ResultsFree Statement

ResultsGetCount Function

ResultsGetCurr Statement

ResultsGetField Statement

ResultsGetRec Function

ResultsGetTotal Statement

ResultsSetCurr Function

ResultsSetFirst Statement

ResultsSetLast Statement

ResultsSetNext Statement

ResultsSetPrev Statement

Right$ Function

RTrim$ Function

RunScript Function

S

SearchUsingCatalog Function

Seek Function

Seek Statement

Select Case Statement

SendKeys Function

Space$ Function

SpellCheck Function

StartTimeAccount Function

Stop Statement

StopTimeAccount Function

Str$ Statement

String$ Function

SysVar_GetDouble Function

SysVar_GetInt Function

SysVar_GetLong Function

SysVar_GetString Function

SysVar_SetDouble Function

SysVar_SetInt Function

SysVar_SetLong Function

SysVar_SetString Function

T

Terminate Function

ToggleContactPriority Function

Type Statement

U

UCase$ Function

V

Val Function

W

While...Wend Statement

Write Statement

X

Y

Z


Index
Index of Help Topics

A

Abs Function

ActivateApp Function

AddToContactList Function

Asc Function

Associate Statement

AttachItems Function

AttachRecs Function

B

C

Calling a Macro from Within a Macro

Calling Forms in a Macro

Categories Dialog Box

Chr$ Function

Close Statement

Common Search and Update Procedures

CompleteItem Function

CopyRecToClipBoard Function

CopyRecToFile Function

D

Data Types

Declare Statement

Dim Statement

Displaying Messages and Gathering Input

DocumentFax Function

DocumentMail Function

DocumentNew Function

DocumentOpen Function

DocumentPrint Function

E

Edit Menu

EditCopy Function

EditCut Function

EditPaste Function

EOF Function

Execute Function

F

File_Close Function

File_Copy Statement

File_Delete Function

File_New  Function

File_Open Statement

Files_Enum Function

Finance_ClearTransaction Function

Finance_Reconcile Function

Finance_Summary Function

Finance_UnclearTransaction Function

FindString Function

FindSynonym Function

For...Next Statement

FormAddRec Function

FormCreate Function

FormDestroy Function

FormEditRec Function

FormEnumFields Function

FormGetFieldFromDlg Function

FormGetFieldName Function

FormGetNotes Function

FormGetNotesLen Function

FormSelect Function

FormsEnum Function

FormSetFieldFromDlg Function

FormSetNotes Function

FormShow Statement

G

GetDate$ Function

GetSelectedResults Function

GetTime$ Function

GoTo Statement

H

Help Menu

HotLink_Connect Function

HotLink_Disconnect Function

I

If...Then...Else Statement

Initiate Function

Input Statement

Input$ Function

InStr Function

Int Function

J

K

L

LCase$ Function

Left$ Function

Len Function

Logical Operators

LowerPriority Function

LTrim$ Function

M

Macro Menu

Macros Dialog Box - Accessing the Macro Editor

MailSend Function

Message Function

Mid$ Function

N

Naming Variables

Numeric Operators

O

Object_Create Function

Object_GetData Function

Object_SetData Function

Object_SetResults Function

Object_SetSearch Function

Object_Show Function

Open Statement

P

PackRat Field Names

PackRatBASIC Editor Menu Bar

PackRatBASIC Editor Screen

PackRatMessage Statement

PasteRecFromClipBoard Function

PhoneCall Statement

PlayWaveFile  Function

Poke Function

Print Statement

PrintReport Function

Programming Your First PackRatBASIC Macro

Prompt Function

Q

R

RaisePriority Function

Read Statement

RecDelete Function

RecGetField Function

RecordAddDlg Function

RecordDelete Function

RecordEditDlg Function

RecordEndAdd Function

RecordEndUpdate Function

RecordFillForm Function

RecordGetField Function

RecordGetForm Function

RecordRunSearch Function

RecordSearchAll Function

RecordSearchAnd Statement

RecordSearchAttaches Function

RecordSearchDlg Function

RecordSearchOr Statement

RecordSearchValue Function

RecordSetField Function

RecordStartAdd Function

RecordStartSearch Function

RecordStartUpdate Function

RecVarFree Function

RecVarFreeAll Function

Rem Statement

Repeating a Key Sequence

ReplaceString Function

Request$ Function

ResultsDelete Function

ResultsFree Statement

ResultsGetCount Function

ResultsGetCurr Statement

ResultsGetField Statement

ResultsGetRec Function

ResultsGetTotal Statement

ResultsSetCurr Function

ResultsSetFirst Statement

ResultsSetLast Statement

ResultsSetNext Statement

ResultsSetPrev Statement

Right$ Function

RTrim$ Function

Run Menu

RunScript Function

S

Sample Macros

Sample Macro #1

Sample Macro #2

Sample Macro #3

Sample Macro #4

Search Menu

Searching a Form

Searching Forms

SearchUsingCatalog Function

Seek Function

Seek Statement

Select Case Statement

Sending Key Combinations

SendKeys Function

Space$ Function

SpellCheck Function

StartTimeAccount Function

Stop Statement

StopTimeAccount Function

Str$ Statement

String Operators

String Types

String Variables

String$ Function

System Variables

SysVar_GetDouble Function

SysVar_GetInt Function

SysVar_GetLong Function

SysVar_GetString Function

SysVar_SetDouble Function

SysVar_SetInt Function

SysVar_SetLong Function

SysVar_SetString Function

T

Terminate Function

Tips for Using the SendKeys Function

ToggleContactPriority Function

Type Statement

U

UCase$ Function

Updating Search Results

V

Val Function

View Menu

W

What is a Macro?

What is PackRatBASIC?

While...Wend Statement

Write Statement

X

Y

Z